From cdd1cb0e8c4fda3671714bb5ad6ba1825cff16d1 Mon Sep 17 00:00:00 2001
From: Puneet Kohli <punkohl@gmail.com>
Date: Sun, 06 May 2018 21:45:26 +0000
Subject: [PATCH] Change matplotlib backend to 'agg' when 'show_plot' is false. This allows the script to be run from command line without any errors (for ex, on a remote machine)

---
 src/option_list.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/option_list.c b/src/option_list.c
index f935af3..9411be3 100644
--- a/src/option_list.c
+++ b/src/option_list.c
@@ -32,6 +32,25 @@
     return options;
 }
 
+metadata get_metadata(char *file)
+{
+	metadata m = { 0 };
+	list *options = read_data_cfg(file);
+
+	char *name_list = option_find_str(options, "names", 0);
+	if (!name_list) name_list = option_find_str(options, "labels", 0);
+	if (!name_list) {
+		fprintf(stderr, "No names or labels found\n");
+	}
+	else {
+		m.names = get_labels(name_list);
+	}
+	m.classes = option_find_int(options, "classes", 2);
+	free_list(options);
+	printf("Loaded - names_list: %s, classes = %d \n", name_list, m.classes);
+	return m;
+}
+
 int read_option(char *s, list *options)
 {
     size_t i;

--
Gitblit v1.10.0