Repository: fitbenchmarking/fitbenchmarking

Issue:
Options printing
Adds the options to the log file and will print given to the terminal given a certain log level.

Discussion:

Patch:
diff --git a/.gitignore b/.gitignore
index 7c463b7d..4c9f0069 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-results/
+fitbenchmarking_results/
 *.pyc
 logs/
 .idea/
diff --git a/fitbenchmarking/cli/main.py b/fitbenchmarking/cli/main.py
index c0920dc3..18ff33f8 100755
--- a/fitbenchmarking/cli/main.py
+++ b/fitbenchmarking/cli/main.py
@@ -11,6 +11,7 @@ import argparse
 import glob
 import inspect
 import os
+import tempfile
 import sys
 import webbrowser
 
@@ -99,6 +100,17 @@ def run(problem_sets, options_file='', debug=False):
                  append=options.log_append,
                  level=options.log_level)
 
+    opt_file = tempfile.NamedTemporaryFile(suffix='.ini',
+                                           mode='w',
+                                           delete=False)
+    options.write_to_stream(opt_file)
+    opt_file.close()
+    LOGGER.debug("The options file used is as follows:")
+    with open(opt_file.name) as f:
+        for line in f:
+            LOGGER.debug(line.replace("\n", ""))
+    os.remove(opt_file.name)
+
     groups = []
     result_dir = []
     for sub_dir in problem_sets:
@@ -142,11 +154,17 @@ def run(problem_sets, options_file='', debug=False):
 
         # resets options to original values
         options.reset()
+    if os.path.basename(options.results_dir) == \
+            options.DEFAULT_PLOTTING['results_dir']:
+        LOGGER.info("\nWARNING: \nThe FitBenchmarking results will be "
+                    "placed into the folder: \n\n   {}\n\nTo change this "
+                    "alter the input options "
+                    "file.\n".format(options.results_dir))
 
     root = os.path.dirname(inspect.getfile(fitbenchmarking))
     template_dir = os.path.join(root, 'templates')
     env = Environment(loader=FileSystemLoader(template_dir))
-    css = get_css(options,options.results_dir)
+    css = get_css(options, options.results_dir)
     template = env.get_template("index_page.html")
     group_links = [os.path.join(d, "{}_index.html".format(g))
                    for g, d in zip(groups, result_dir)]
diff --git a/fitbenchmarking/utils/options.py b/fitbenchmarking/utils/options.py
index 0de1e2e9..946c2660 100644
--- a/fitbenchmarking/utils/options.py
+++ b/fitbenchmarking/utils/options.py
@@ -101,7 +101,7 @@ class Options(object):
                           (np.inf, "#b30000")],
          'comparison_mode': 'both',
          'table_type': ['acc', 'runtime', 'compare', 'local_min'],
-         'results_dir': 'results'}
+         'results_dir': 'fitbenchmarking_results'}
     DEFAULT_LOGGING = \
         {'file_name': 'fitbenchmarking.log',
          'append': False,
@@ -155,10 +155,10 @@ class Options(object):
                                             default_options_list))
 
         minimizers = config['MINIMIZERS']
-        self.minimizers = {}
+        self._minimizers = {}
         for key in self.VALID_FITTING["software"]:
-            self.minimizers[key] = self.read_value(minimizers.getlist,
-                                                   key)
+            self._minimizers[key] = self.read_value(minimizers.getlist,
+                                                    key)
 
         fitting = config['FITTING']
         self.num_runs = self.read_value(fitting.getint, 'num_runs')
@@ -246,6 +246,14 @@ class Options(object):
     def results_dir(self, value):
         self._results_dir = os.path.abspath(value)
 
+    @property
+    def minimizers(self):
+        return {s: self._minimizers[s] for s in self.software}
+
+    @minimizers.setter
+    def minimizers(self, value):
+        self._minimizers = value
+
     def _create_config(self):
         """
         Return the contents of the options object as a ConfigParser object,


Test patch:
diff --git a/fitbenchmarking/systests/test_regression.py b/fitbenchmarking/systests/test_regression.py
index ea9ceaaa..4e1197cb 100644
--- a/fitbenchmarking/systests/test_regression.py
+++ b/fitbenchmarking/systests/test_regression.py
@@ -66,7 +66,7 @@ class TestRegressionAll(TestCase):
                                      'all_parsers.txt')
 
         actual_file = os.path.join(os.path.dirname(__file__),
-                                   'results',
+                                   'fitbenchmarking_results',
                                    'all_parsers_set',
                                    'all_parsers_set_acc_weighted_table.txt')
 
@@ -90,7 +90,7 @@ class TestRegressionAll(TestCase):
                                      'multifit.txt')
 
         actual_file = os.path.join(os.path.dirname(__file__),
-                                   'results',
+                                   'fitbenchmarking_results',
                                    'multifit_set',
                                    'multifit_set_acc_weighted_table.txt')
 
@@ -146,7 +146,7 @@ class TestRegressionDefault(TestCase):
                                      'default_parsers.txt')
 
         actual_file = os.path.join(os.path.dirname(__file__),
-                                   'results',
+                                   'fitbenchmarking_results',
                                    'default_parsers',
                                    'default_parsers_acc_weighted_table.txt')
 
@@ -205,12 +205,14 @@ def setup_options(multifit=False):
         opts.software = ['mantid']
         opts.minimizers = {'mantid': [opts.minimizers['mantid'][0]]}
     elif TEST_TYPE != "default":
+        opts.software = ['bumps', 'dfo', 'gsl', 'mantid', 'minuit',
+                         'ralfit', 'scipy', 'scipy_ls']
         opts.minimizers = {k: [v[0]] for k, v in opts.minimizers.items()}
-        opts.software = sorted(opts.minimizers.keys())
     else:
         opts.software = ['bumps', 'dfo', 'minuit', 'scipy', 'scipy_ls']
         opts.minimizers = {s: [opts.minimizers[s][0]] for s in opts.software}
 
-    opts.results_dir = os.path.join(os.path.dirname(__file__), 'results')
+    opts.results_dir = os.path.join(os.path.dirname(__file__),
+                                    'fitbenchmarking_results')
 
     return opts
diff --git a/fitbenchmarking/utils/tests/test_options_minimizers.py b/fitbenchmarking/utils/tests/test_options_minimizers.py
index 8f3b1a53..eda87815 100644
--- a/fitbenchmarking/utils/tests/test_options_minimizers.py
+++ b/fitbenchmarking/utils/tests/test_options_minimizers.py
@@ -20,6 +20,9 @@ class MininimizerOptionTests(unittest.TestCase):
         Initializes options class with defaults
         """
         self.options = Options()
+        software = ['bumps', 'dfo', 'gsl', 'mantid', 'minuit',
+                    'ralfit', 'scipy', 'scipy_ls']
+        self.options.software = software
 
     def test_minimizer_bumps(self):
         """
@@ -37,6 +40,16 @@ class MininimizerOptionTests(unittest.TestCase):
         actual = self.options.minimizers['dfo']
         self.assertEqual(expected, actual)
 
+    def test_minimizer_gsl(self):
+        """
+        Checks valid gsl minimizers are set correctly
+        """
+        expected = ['lmsder', 'lmder', 'nmsimplex', 'nmsimplex2',
+                    'conjugate_pr', 'conjugate_fr', 'vector_bfgs',
+                    'vector_bfgs2', 'steepest_descent']
+        actual = self.options.minimizers['gsl']
+        self.assertEqual(expected, actual)
+
     def test_minimizer_mantid(self):
         """
         Checks valid mantid minimizers are set correctly
@@ -137,6 +150,8 @@ class UserMininimizerOptionTests(unittest.TestCase):
         """
         opts_file = self.generate_user_ini_file(options_set, software)
         options = Options(opts_file)
+        if software not in options.software:
+            options.software.append(software)
         actual = options.minimizers[software]
         self.assertEqual(options_set, actual)
 
@@ -188,6 +203,20 @@ class UserMininimizerOptionTests(unittest.TestCase):
         set_option = ['CG']
         self.shared_invalid(set_option, 'dfo')
 
+    def test_minimizer_gsl_valid(self):
+        """
+        Checks user set gsl minimizers is valid
+        """
+        set_option = ['lmsder', 'lmder', 'nmsimplex']
+        self.shared_valid(set_option, 'gsl')
+
+    def test_minimizer_gsl_invalid(self):
+        """
+        Checks user set gsl minimizers is invalid
+        """
+        set_option = ['newton']
+        self.shared_invalid(set_option, 'gsl')
+
     def test_minimizer_mantid_valid(self):
         """
         Checks user set mantid minimizers is valid
diff --git a/fitbenchmarking/utils/tests/test_options_plotting.py b/fitbenchmarking/utils/tests/test_options_plotting.py
index 3b8ac9df..9369c201 100644
--- a/fitbenchmarking/utils/tests/test_options_plotting.py
+++ b/fitbenchmarking/utils/tests/test_options_plotting.py
@@ -62,7 +62,7 @@ class PlottingOptionTests(unittest.TestCase):
         """
         Checks results_dir default
         """
-        expected = os.path.abspath('results')
+        expected = os.path.abspath('fitbenchmarking_results')
         actual = self.options.results_dir
         self.assertEqual(expected, actual)