From 40ba7def98393ed35c30bc3fa357a1e65f5b6eb6 Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Thu, 28 Sep 2017 15:19:07 +0200
Subject: [PATCH 01/13] marked some defaults

---
 analysis/batch/__init__.py     |  2 +-
 analysis/batch/batch_system.py | 10 +++++-----
 analysis/data/__init__.py      | 10 +++++-----
 analysis/data/loaders.py       | 14 +++++++-------
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/analysis/batch/__init__.py b/analysis/batch/__init__.py
index 43c3665..fc9d7da 100644
--- a/analysis/batch/__init__.py
+++ b/analysis/batch/__init__.py
@@ -27,7 +27,7 @@ def get_batch_system(name=None):
     """
     from analysis.batch.batch_system import BATCH_SYSTEMS
     if name:
-        batch_system = BATCH_SYSTEMS.get(name, None)
+        batch_system = BATCH_SYSTEMS.get(name)
         if batch_system:
             return batch_system
     else:
diff --git a/analysis/batch/batch_system.py b/analysis/batch/batch_system.py
index 4e3a572..70c41a7 100644
--- a/analysis/batch/batch_system.py
+++ b/analysis/batch/batch_system.py
@@ -104,7 +104,7 @@ echo "------------------------------------------------------------------------"
         cmd = 'python %s' % cmd_script
         cmd += ' %s' % (' '.join(script_args))
         # Format log file names
-        err_file = batch_config.pop('errfile', log_file)
+        err_file = batch_config.pop('errfile', log_file)  # DEFAULT
         log_file, ext = os.path.splitext(log_file)
         log_file = '%s%s.%s' % (log_file, self.JOBID_FORMAT, ext)
         err_file, ext = os.path.splitext(err_file)
@@ -113,11 +113,11 @@ echo "------------------------------------------------------------------------"
         header = [self.DIRECTIVES['job-name'] % job_name,
                   self.DIRECTIVES['logfile'] % log_file,
                   self.DIRECTIVES['errfile'] % err_file,
-                  self.DIRECTIVES['runtime'] % batch_config.pop('runtime', '02:00:00')]
+                  self.DIRECTIVES['runtime'] % batch_config.pop('runtime', '02:00:00')]  # DEFAULT
         if log_file == err_file:
             header.append(self.DIRECTIVES['mergelogs'])
         for batch_option, batch_value in batch_config.items():
-            directive = self.DIRECTIVES.get(batch_option, None)
+            directive = self.DIRECTIVES.get(batch_option)
             if directive is None:
                 logger.warning("Ignoring directive %s -> %s", batch_option, batch_value)
                 continue
@@ -125,7 +125,7 @@ echo "------------------------------------------------------------------------"
         script = self.SCRIPT.format(workdir=os.getcwd(),
                                     script=cmd,
                                     header='\n'.join(header),
-                                    shell=batch_config.pop('shell', '/bin/bash'))
+                                    shell=batch_config.pop('shell', '/bin/bash'))  # DEFAULT
         # Submit using stdin
         logger.debug('Submitting -> %s', cmd)
         proc = subprocess.Popen(self.SUBMIT_COMMAND,
@@ -135,7 +135,7 @@ echo "------------------------------------------------------------------------"
         return output.rstrip('\n')
 
     def get_job_id(self):
-        return os.environ.get(self.JOBID_VARIABLE, None)
+        return os.environ.get(self.JOBID_VARIABLE)
 
 
 class Torque(BatchSystem):
diff --git a/analysis/data/__init__.py b/analysis/data/__init__.py
index aff1970..fd1a499 100644
--- a/analysis/data/__init__.py
+++ b/analysis/data/__init__.py
@@ -99,21 +99,21 @@ def get_data(data_config, **kwargs):
     for key in ('source', 'tree', 'output-format'):
         if key not in data_config:
             raise KeyError("Bad data configuration -> '%s' key is missing" % key)
-    source_name = data_config.pop('source')
+    source_name = data_config.pop('source')  # DEFAULT OK
     try:
-        source_type = data_config.pop('source-type', None)
+        source_type = data_config.pop('source-type', None)  # DEFAULT
         file_name = source_name if not source_type \
             else getattr(paths, 'get_%s_path' % source_type)(source_name)
         if not os.path.exists(file_name):
             raise OSError("Cannot find input file -> %s" % file_name)
     except AttributeError:
         raise AttributeError("Unknown source type -> %s" % source_type)
-    tree_name = data_config.pop('tree')
-    output_format = data_config.pop('output-format').lower()
+    tree_name = data_config.pop('tree')  # DEFAULT OK
+    output_format = data_config.pop('output-format').lower()  # DEFAULT OK
     # Optional: output-type, cuts, branches
     input_ext = os.path.splitext(file_name)[1]
     try:
-        input_type = data_config.get('input-type', None)
+        input_type = data_config.get('input-type')  # DEFAULT
         if not input_type:
             input_type = get_global_var('FILE_TYPES')[input_ext]
     except KeyError:
diff --git a/analysis/data/loaders.py b/analysis/data/loaders.py
index fdce031..997c111 100644
--- a/analysis/data/loaders.py
+++ b/analysis/data/loaders.py
@@ -166,7 +166,7 @@ def get_root_from_pandas_file(file_name, tree_name, kwargs):
     # Checks and variable preparation
     try:
         name = kwargs['name']
-        title = kwargs.get('title', name)
+        title = kwargs.get('title', name)  # DEFAULT OK
     except KeyError as error:
         raise KeyError("Missing configuration key -> %s" % error)
     # Check weights
@@ -175,7 +175,7 @@ def get_root_from_pandas_file(file_name, tree_name, kwargs):
     except KeyError:
         raise KeyError("Badly specified weights")
     # Variables
-    var_list = kwargs.get('variables', None)
+    var_list = kwargs.get('variables')
     if var_list and weight_var:
         var_list.append(weight_var)
         var_list = list(set(var_list) | set(weights_to_normalize) | set(weights_not_normalized))
@@ -208,7 +208,7 @@ def get_root_from_pandas_file(file_name, tree_name, kwargs):
     # Load the data
     frame = _load_pandas(file_name, tree_name,
                          var_list,
-                         kwargs.get('selection', None))
+                         kwargs.get('selection'))
     if acc_var:
         from analysis.efficiency import get_acceptance
         try:
@@ -234,7 +234,7 @@ def get_root_from_pandas_file(file_name, tree_name, kwargs):
     return dataset_from_pandas(frame, name, title,
                                var_list=var_list,
                                weight_var=weight_var,
-                               categories=kwargs.get('categories', None))
+                               categories=kwargs.get('categories'))
 
 
 ###############################################################################
@@ -306,7 +306,7 @@ def get_root_from_root_file(file_name, tree_name, kwargs):
     # Crosscheck leaves
     if variables - leaves:
         raise ValueError("Cannot find leaves in input -> %s" % (variables - leaves))
-    selection = kwargs.get('selection', None)
+    selection = kwargs.get('selection')
     leave_set = ROOT.RooArgSet()
     leave_list = []
     if selection:
@@ -391,8 +391,8 @@ def get_pandas_from_root_file(file_name, tree_name, kwargs):
                  file_name, tree_name)
     if not os.path.exists(file_name):
         raise OSError("Cannot find input file -> %s" % file_name)
-    selection = kwargs.get('selection', None)
-    variables = kwargs.get('variables', None)
+    selection = kwargs.get('selection')
+    variables = kwargs.get('variables')
     if selection:
         output_data = read_root(file_name, tree_name).query(selection)
         if variables:
-- 
GitLab


From 09f89eb90dadd80e28c7abb372c85e10deda760b Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Thu, 28 Sep 2017 18:49:02 +0200
Subject: [PATCH 02/13] marked some in __init__

---
 analysis/efficiency/__init__.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/analysis/efficiency/__init__.py b/analysis/efficiency/__init__.py
index b317863..ce8fb64 100644
--- a/analysis/efficiency/__init__.py
+++ b/analysis/efficiency/__init__.py
@@ -60,7 +60,7 @@ def get_efficiency_model_class(model_name):
         `Efficiency`: Efficiency class, non-instantiated.
 
     """
-    return get_global_var('EFFICIENCY_MODELS').get(model_name.lower(), None)
+    return get_global_var('EFFICIENCY_MODELS').get(model_name.lower())  # DEFAULT
 
 
 def load_efficiency_model(model_name, **extra_parameters):
@@ -104,7 +104,7 @@ def get_efficiency_model(efficiency_config, **extra_parameters):
         KeyError: If there is a configuration error
 
     """
-    efficiency_config['parameters'].update(extra_parameters)
+    efficiency_config['parameters'].update(extra_parameters)  # Handling missing 'parameters' key?
     # Check the configuration
     for key in ('model', 'variables', 'parameters'):
         if key not in efficiency_config:
@@ -182,10 +182,10 @@ def get_acceptance(config):
     if missing_keys:
         raise ConfigError("Missing configuration key! -> {}".format(missing_keys))
     # Load the efficiencies
-    gen_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['generation'].pop('name')),
+    gen_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['generation'].pop('name')),  # Handle missing 'name' key?
                                                       validate=('model', 'variables', 'parameters')),
                                           **config['generation'])
-    reco_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['reconstruction'].pop('name')),
+    reco_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['reconstruction'].pop('name')),  # Handle missing 'name' key?
                                                        validate=('model', 'variables', 'parameters')),
                                            **config['reconstruction'])
     # Check the variables
-- 
GitLab


From 1d2b872eebde9341074dab9900bd10ef12e3cde0 Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 12:03:09 +0200
Subject: [PATCH 03/13] some defaults marked

---
 analysis/efficiency/__init__.py |  4 ++--
 analysis/efficiency/legendre.py | 10 +++++-----
 analysis/fit/__init__.py        |  5 ++---
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/analysis/efficiency/__init__.py b/analysis/efficiency/__init__.py
index 8d88adb..670a8e2 100644
--- a/analysis/efficiency/__init__.py
+++ b/analysis/efficiency/__init__.py
@@ -104,7 +104,7 @@ def get_efficiency_model(efficiency_config, **extra_parameters):
         KeyError: If there is a configuration error
 
     """
-    efficiency_config['parameters'].update(extra_parameters)  # Handling missing 'parameters' key?
+    efficiency_config['parameters'].update(extra_parameters)  # Handle missing 'parameters' key?
     # Check the configuration
     for key in ('model', 'variables', 'parameters'):
         if key not in efficiency_config:
@@ -178,7 +178,7 @@ def get_acceptance(config):
     config_keys = [key for key, _ in unfold_config(config)]
     # missing_keys should be empty if the needed keys have been provided. Otherwise complain!
     missing_keys = set(('variables', 'generation/name', 'reconstruction/name')) - set(config_keys)
-    
+
     if missing_keys:
         raise ConfigError("Missing configuration key! -> {}".format(missing_keys))
     # Load the efficiencies
diff --git a/analysis/efficiency/legendre.py b/analysis/efficiency/legendre.py
index 538508a..2eecf28 100644
--- a/analysis/efficiency/legendre.py
+++ b/analysis/efficiency/legendre.py
@@ -130,7 +130,7 @@ class LegendreEfficiency(Efficiency):
         """
         super(LegendreEfficiency, self).__init__(var_list, config)
         self._ranges = {var_name: process_range((low, high))
-                        for var_name, (low, high) in config.get('ranges', {}).items()}
+                        for var_name, (low, high) in config.get('ranges', {}).items()}  # DEFAULT? Doc says [-1, 1] assumed
         orders = tuple(config['pol-orders'][var] for var in var_list)
         self._coefficients = np.reshape(config['coefficients'], orders)
         self._covariance = np.reshape(config['covariance'],
@@ -345,14 +345,14 @@ class LegendreEfficiency1D(Efficiency):
         self._ranges = {var_name: process_range((low, high))
                         for var_name, (low, high) in config.get('ranges', {}).items()}
         # Load coefficients
-        if len(config['coefficients']) != sum(order for order in config['pol-orders'].values()):
+        if len(config['coefficients']) != sum(order for order in config['pol-orders'].values()):  # MISSING KEY
             raise KeyError("Wrong number of coefficients")
         self._coefficients = np.array(np.split(config['coefficients'],
                                                np.cumsum([config['pol-orders'][var_name]
                                                           for var_name in self.get_variables()])[:-1]))
-        self._covariance = np.reshape(config['covariance'],
-                                      (sum(config['pol-orders'].values()),
-                                       sum(config['pol-orders'].values())))
+        self._covariance = np.reshape(config['covariance'],  # MISSING KEY
+                                      (sum(config['pol-orders'].values()),  # MISSING KEY
+                                       sum(config['pol-orders'].values())))  # MISSING KEY
         for var_name in config.get('symmetric-variables', []):
             logger.debug("Symmetrizing legendre polynomial for variable %s", var_name)
             try:
diff --git a/analysis/fit/__init__.py b/analysis/fit/__init__.py
index 8c91b55..a2ccc46 100644
--- a/analysis/fit/__init__.py
+++ b/analysis/fit/__init__.py
@@ -77,8 +77,7 @@ def fit(factory, pdf_name, strategy, dataset, verbose=False, **kwargs):
 
     fit_config = [ROOT.RooFit.Save(True),
                   ROOT.RooFit.PrintLevel(2 if verbose else -1)]
-    if 'Range' not in kwargs:
-        kwargs['Range'] = 'Full'
+    kwargs.setdefault('Range', 'Full')  # DEFAULT
     for command, val in kwargs.items():
         roo_cmd = getattr(ROOT.RooFit, command, None)
         if not roo_cmd:
@@ -99,7 +98,7 @@ def fit(factory, pdf_name, strategy, dataset, verbose=False, **kwargs):
     except ValueError as error:
         logger.error("Problem getting the PDF -> %s", error)
         raise
-    if kwargs.get('Extended', False) != factory.is_extended():
+    if kwargs.get('Extended', False) != factory.is_extended():  # DEFAULT OK
         logger.warning("Requested fit with Extended=%s fit on %sextended PDF. Check this is what you want.",
                        kwargs.get('Extended', False),
                        'an ' if factory.is_extended() else 'a non-')
-- 
GitLab


From 63b36b7662e6f14c949975e88e399c20d2ed253c Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 12:08:34 +0200
Subject: [PATCH 04/13] up to 'fit' module defaults marked

---
 analysis/fit/result.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/analysis/fit/result.py b/analysis/fit/result.py
index 97619e2..2f5fca8 100644
--- a/analysis/fit/result.py
+++ b/analysis/fit/result.py
@@ -215,9 +215,9 @@ class FitResult(object):
                        for val, suffix in zip(param, _SUFFIXES)}
         pandas_dict.update({param_name: val for param_name, val
                             in self._result['const-parameters'].items()})
-        pandas_dict['status_migrad'] = self._result['status'].get('MIGRAD', -1)
-        pandas_dict['status_hesse'] = self._result['status'].get('HESSE', -1)
-        pandas_dict['status_minos'] = self._result['status'].get('MINOS', -1)
+        pandas_dict['status_migrad'] = self._result['status'].get('MIGRAD', -1)  # DEFAULT
+        pandas_dict['status_hesse'] = self._result['status'].get('HESSE', -1)  # DEFAULT
+        pandas_dict['status_minos'] = self._result['status'].get('MINOS', -1)  # DEFAULT
         pandas_dict['cov_quality'] = self._result['covariance-matrix']['quality']
         pandas_dict['edm'] = self._result['edm']
         if not skip_cov:
-- 
GitLab


From 33b9880966cdf0562f8e27bc9320157fb2c82531 Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 15:54:50 +0200
Subject: [PATCH 05/13] marked some defaults in physics.__init__

---
 analysis/physics/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/analysis/physics/__init__.py b/analysis/physics/__init__.py
index 0ae972e..e6e817b 100644
--- a/analysis/physics/__init__.py
+++ b/analysis/physics/__init__.py
@@ -181,7 +181,7 @@ def configure_model(config, shared_vars=None, external_vars=None):
                 if pdf_name not in yields:
                     yields[pdf_name] = sanitize_parameter(yield_, 'Yield', 'Yield')
                     # yields[pdf_name][0].setStringAttribute('shared', 'true')
-            if isinstance(pdf_config.get('pdf', None), str):
+            if isinstance(pdf_config.get('pdf'), str):
                 factories[pdf_name] = configure_model({pdf_name: pdf_config}, shared_vars)
             else:
                 factories[pdf_name] = configure_model(pdf_config, shared_vars[pdf_name])
@@ -254,7 +254,7 @@ def configure_model(config, shared_vars=None, external_vars=None):
         return configure_simul_factory(config, shared_vars)
     else:
         if 'pdf' not in config:
-            if isinstance(config.values()[0].get('pdf', None), str):
+            if isinstance(config.values()[0].get('pdf'), str):
                 shared = {'pdf': shared_vars}
                 return configure_prod_factory({'pdf': config}, shared)
             else:
-- 
GitLab


From e9d042832bfb92074f1e65d9dee5d3a7dc620823 Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 17:31:08 +0200
Subject: [PATCH 06/13] physics.factory: marked defaults, internal item access

---
 analysis/physics/factory.py | 75 +++++++++++++++++--------------------
 1 file changed, 35 insertions(+), 40 deletions(-)

diff --git a/analysis/physics/factory.py b/analysis/physics/factory.py
index 94585e0..f3b52e2 100644
--- a/analysis/physics/factory.py
+++ b/analysis/physics/factory.py
@@ -142,7 +142,7 @@ class BaseFactory(object):
         if recursive:
             obj = self._find_object(key)
         else:
-            obj = self._objects.get(key, None)
+            obj = self._objects.get(key)
         return obj if obj else default
 
     def __getitem__(self, key):
@@ -298,9 +298,7 @@ class BaseFactory(object):
             raise ValueError("Requested non-extended PDF, "
                              "but the factory needs to be extended")
         pdf_name = 'pdf_%s' % name
-        return self.get(pdf_name) \
-            if pdf_name in self \
-            else self.set(pdf_name, self.get_unbound_pdf(name, title))
+        return self.get(pdf_name, self.set(pdf_name, self.get_unbound_pdf(name, title)))
 
     def get_unbound_pdf(self, name, title):
         """Get the physics PDF.
@@ -330,9 +328,7 @@ class BaseFactory(object):
             logger.warning("Specified yield value but it's already defined. Ignoring.")
         # Avoid name clashes
         pdf_name = 'pdfext_%s' % name
-        return self.get(pdf_name) \
-            if pdf_name in self \
-            else self.set(pdf_name, self.get_unbound_extended_pdf(name, title))
+        return self.get(pdf_name, self.set(pdf_name, self.get_unbound_extended_pdf(name, title)))
 
     def get_unbound_extended_pdf(self, name, title):
         """Get an extedned physics PDF."""
@@ -348,14 +344,13 @@ class BaseFactory(object):
         """Get the physics observables.
 
         """
-        return tuple((self.get(obs_id)
-                      if obs_id in self
-                      else self.set(obs_id, execute_and_return_self(ROOT.RooRealVar(obs_name, obs_title,
-                                                                                    obs_min, obs_max,
-                                                                                    unit),
-                                                                    'setStringAttribute',
-                                                                    'originalName',
-                                                                    obs_id)))
+        return tuple((self.get(obs_id,
+                               self.set(obs_id, execute_and_return_self(ROOT.RooRealVar(obs_name, obs_title,
+                                                                                        obs_min, obs_max,
+                                                                                        unit),
+                                                                        'setStringAttribute',
+                                                                        'originalName',
+                                                                        obs_id))))
                      for obs_id, (obs_name, obs_title, obs_min, obs_max, unit)
                      in self.OBSERVABLES.items())
 
@@ -418,7 +413,7 @@ class BaseFactory(object):
         raise NotImplementedError()
 
     def get_yield_var(self):
-        return self._objects.get('Yield', None)
+        return self._objects.get('Yield')  # DEFAULT: should an Error be raised if Yield not there?
 
     def set_yield_var(self, yield_):
         raise NotImplementedError()
@@ -500,7 +495,7 @@ class PhysicsFactory(BaseFactory):
         return ROOT.RooExtendPdf(name,
                                  title,
                                  self.get_pdf(name+'_{noext}', title+'_{noext}'),
-                                 self._objects['Yield'])
+                                 self['Yield'])
 
     def has_to_be_extended(self):
         return False
@@ -515,7 +510,7 @@ class PhysicsFactory(BaseFactory):
         params = self.PARAMETERS[:]
         if extended and 'Yield' in self:
             params.append('Yield')
-        return tuple(self.get(param_name) for param_name in params)
+        return tuple(self.get(param_name) for param_name in params)  # Remove default? should fail if not found
 
     def get_gen_parameters(self):
         """Get all the necessary generation parameters.
@@ -534,13 +529,13 @@ class PhysicsFactory(BaseFactory):
         else:
             if isinstance(yield_, tuple):
                 yield_ = yield_[0]
-            if isinstance(self._objects['Yield'], ROOT.RooRealVar):
+            if isinstance(self['Yield'], ROOT.RooRealVar):
                 if isinstance(yield_, ROOT.RooRealVar):
-                    self._objects['Yield'].setVal(yield_.getVal())
-                    self._objects['Yield'].SetName(yield_.GetName())
-                    self._objects['Yield'].SetTitle(yield_.GetTitle())
+                    self['Yield'].setVal(yield_.getVal())
+                    self['Yield'].SetName(yield_.GetName())
+                    self['Yield'].SetTitle(yield_.GetTitle())
                 elif isinstance(yield_, (float, int)):
-                    self._objects['Yield'].setVal(yield_)
+                    self['Yield'].setVal(yield_)
             else:
                 logger.warning("Trying to set a yield that cannot be overriden")
 
@@ -586,7 +581,7 @@ class ProductPhysicsFactory(BaseFactory):
         return ROOT.RooExtendPdf(name,
                                  title,
                                  self.get_pdf(name+'_{noext}', title+'_{noext}'),
-                                 self._objects['Yield'])
+                                 self['Yield'])
 
     def has_to_be_extended(self):
         return False
@@ -649,14 +644,14 @@ class ProductPhysicsFactory(BaseFactory):
         if isinstance(yield_, tuple):
             yield_, constraint = yield_
         if 'Yield' not in self._objects:
-            self._objects['Yield'] = yield_
+            self['Yield'] = yield_
             if constraint:
                 self._constraints.add(constraint)
         else:
-            if isinstance(self._objects['Yield'], ROOT.RooRealVar):
-                self._objects['Yield'].setVal(yield_.getVal())
-                self._objects['Yield'].SetName(yield_.GetName())
-                self._objects['Yield'].SetTitle(yield_.GetTitle())
+            if isinstance(self['Yield'], ROOT.RooRealVar):
+                self['Yield'].setVal(yield_.getVal())
+                self['Yield'].SetName(yield_.GetName())
+                self['Yield'].SetTitle(yield_.GetTitle())
             else:
                 logger.warning("Trying to set a yield that cannot be overriden")
 
@@ -717,7 +712,7 @@ class SumPhysicsFactory(BaseFactory):
         if len(factories) == len(children_yields):  # Extended
             if yield_ is not None:
                 raise KeyError("Specified yield on a sum of RooExtendPdf")
-            self._objects['Yield'] = ROOT.RooAddition("Yield", "Yield", list_to_rooarglist(yield_values))
+            self['Yield'] = ROOT.RooAddition("Yield", "Yield", list_to_rooarglist(yield_values))
             self._constraints.update({constraint for _, constraint in children_yields.values()})
             for child_name, child in self._children.items():
                 child.set_yield_var(children_yields[child_name])
@@ -734,7 +729,7 @@ class SumPhysicsFactory(BaseFactory):
                 if yield_val.getStringAttribute('shared') != 'true':
                     yield_val.SetName(yield_val.GetName().replace('Yield', 'Fraction'))
                     yield_val.SetTitle(yield_val.GetTitle().replace('Yield', 'Fraction'))
-            self._objects['Fractions'] = yield_values
+            self['Fractions'] = yield_values
             for child_name, child in self._children.items():
                 if child_name in children_yields.keys():
                     child_yield, child_constraint = children_yields[child_name]
@@ -769,7 +764,7 @@ class SumPhysicsFactory(BaseFactory):
             pdfs.add(child.get_pdf(new_name, new_name))
         return ROOT.RooAddPdf(name, title,
                               pdfs,
-                              list_to_rooarglist(self._objects['Fractions']))
+                              list_to_rooarglist(self['Fractions']))
 
     def get_unbound_extended_pdf(self, name, title):
         if 'Fractions' in self:
@@ -777,7 +772,7 @@ class SumPhysicsFactory(BaseFactory):
             return ROOT.RooExtendPdf(name,
                                      title,
                                      self.get_pdf(name+'_{noext}', title+'_{noext}'),
-                                     self._objects['Yield'])
+                                     self['Yield'])
         else:
             pdfs = ROOT.RooArgList()
             for child_name, child in self._children.items():
@@ -845,13 +840,13 @@ class SumPhysicsFactory(BaseFactory):
                                                     child['Fraction'].GetTitle().replace('Fraction', 'Yield'),
                                                     list_to_rooarglist([yield_, child['Fraction']])))
         else:
-            if isinstance(self._objects['Yield'], ROOT.RooRealVar):
+            if isinstance(self['Yield'], ROOT.RooRealVar):
                 if isinstance(yield_, ROOT.RooRealVar):
-                    self._objects['Yield'].setVal(yield_.getVal())
-                    self._objects['Yield'].SetName(yield_.GetName())
-                    self._objects['Yield'].SetTitle(yield_.GetTitle())
+                    self['Yield'].setVal(yield_.getVal())
+                    self['Yield'].SetName(yield_.GetName())
+                    self['Yield'].SetTitle(yield_.GetTitle())
                 elif isinstance(yield_, (float, int)):
-                    self._objects['Yield'].setVal(yield_)
+                    self['Yield'].setVal(yield_)
             else:
                 logger.warning("Trying to set a yield that cannot be overriden")
 
@@ -910,7 +905,7 @@ class SimultaneousPhysicsFactory(BaseFactory):
                            if category.count(';') > 0
                            else category)
             yields.add(child.get_yield_var())
-        self._objects['Yield'] = ROOT.RooAddition('Yield', 'Yield', yields)
+        self['Yield'] = ROOT.RooAddition('Yield', 'Yield', yields)
         return sim_pdf
 
     def is_extended(self):
@@ -944,7 +939,7 @@ class SimultaneousPhysicsFactory(BaseFactory):
                 if child_obs.GetName() not in self._objects:
                     obs_list[child_obs.GetName()] = self.set(child_obs.GetName(), child_obs)
                 elif child_obs.GetName() not in obs_list:
-                    obs_list[child_obs.GetName()] = self.get(child_obs.GetName())
+                    obs_list[child_obs.GetName()] = self[child_obs.GetName()]  # Should fail if not there?
         return tuple(obs_list.values())
 
     def set_observable(self, obs_id, obs=None, name=None, title=None, limits=None, units=None):
-- 
GitLab


From 214d6f665764e7f3a838f3f291f5c720e12de05a Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 19:21:16 +0200
Subject: [PATCH 07/13] physics.pdf_models: marked defaults

---
 analysis/physics/pdf_models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/analysis/physics/pdf_models.py b/analysis/physics/pdf_models.py
index 89050a9..7489744 100644
--- a/analysis/physics/pdf_models.py
+++ b/analysis/physics/pdf_models.py
@@ -199,7 +199,7 @@ class ArgusConvGaussPdfMixin(object):
 
         """
         super(ArgusConvGaussPdfMixin, self).__init__(config, parameters)
-        self._buffer_fraction = config.get('buffer_fraction', 1.0)
+        self._buffer_fraction = config.get('buffer_fraction', 1.0)  # DEFAULT
 
     def get_unbound_pdf(self, name, title):
         """Get the convolved PDF.
@@ -353,7 +353,7 @@ class RooWorkspaceMixin(object):
             var = self._workspace.var(obs_name)
             if not var:
                 raise KeyError("Observable %s not present in RooWorkspace" % obs_name)
-            if obs_id not in self._objects or var != self._objects[obs_id]:
+            if obs_id not in self or var != self[obs_id]:
                 self.set(obs_id, var)
                 self.set_observable(obs_id, title=obs_title, limits=(obs_min, obs_max), units=unit)
         return super(RooWorkspaceMixin, self).get_observables()
-- 
GitLab


From b85c9dca37ebf0a3989f66f2ba76c1848c934f38 Mon Sep 17 00:00:00 2001
From: Jonas 'Mayou36' Eschle <mayou36@jonas.eschle.com>
Date: Fri, 29 Sep 2017 19:48:07 +0200
Subject: [PATCH 08/13] marked defaults in toys package

---
 analysis/toys/fit_toys.py      | 18 +++++++++---------
 analysis/toys/generate_toys.py |  6 +++---
 analysis/toys/submitter.py     |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/analysis/toys/fit_toys.py b/analysis/toys/fit_toys.py
index 3687b7b..a1d190a 100644
--- a/analysis/toys/fit_toys.py
+++ b/analysis/toys/fit_toys.py
@@ -136,14 +136,14 @@ def run(config_files, link_from, verbose):
     try:
         models = {model_name: config[model_name]
                   for model_name
-                  in config['fit'].get('models', ['model'])}
+                  in config['fit'].get('models', ['model'])}  # DEFAULT
     except KeyError as error:
         logger.error("Missing model configuration -> %s", str(error))
         raise KeyError("Missing model configuration")
     if not models:
         logger.error("No model was specified in the config file!")
         raise KeyError()
-    fit_strategies = config['fit'].get('strategies', ['simple'])
+    fit_strategies = config['fit'].get('strategies', ['simple'])  # DEFAULT
     if not fit_strategies:
         logger.error("Empty fit strategies were specified in the config file!")
         raise KeyError()
@@ -173,9 +173,9 @@ def run(config_files, link_from, verbose):
                                    'source-type': 'toy',
                                    'tree': 'data',
                                    'output-format': 'pandas',
-                                   'selection': data_source.get('selection', None)}),
-                         data_source['nevents'],
-                         data_source.get('category', None))
+                                   'selection': data_source.get('selection')}),
+                         data_source['nevents'],  # explicit fail?
+                         data_source.get('category'))
         # Generator values
         toy_info = get_data({'source': source_toy,
                              'source-type': 'toy',
@@ -200,7 +200,7 @@ def run(config_files, link_from, verbose):
         gen_values_frame = {}
         # pylint: disable=E1101
         with _paths.work_on_file(config['name'],
-                                 config.get('link-from', None),
+                                 config.get('link-from'),
                                  _paths.get_toy_fit_path) as toy_fit_file:
             with pd.HDFStore(toy_fit_file, mode='w') as hdf_file:
                 logger.debug("Checking generator values")
@@ -275,8 +275,8 @@ def run(config_files, link_from, verbose):
                                      fit_strategy,
                                      dataset,
                                      verbose,
-                                     Extended=config['fit'].get('extended', True),
-                                     Minos=config['fit'].get('minos', True))
+                                     Extended=config['fit'].get('extended', True),  # DEFAULT
+                                     Minos=config['fit'].get('minos', True))  # DEFAULT
                 except ValueError:
                     raise RuntimeError()
                 # Now results are in fit_parameters
@@ -307,7 +307,7 @@ def run(config_files, link_from, verbose):
     try:
         # pylint: disable=E1101
         with _paths.work_on_file(config['name'],
-                                 config.get('link-from', None),
+                                 config.get('link-from'),
                                  _paths.get_toy_fit_path) as toy_fit_file:
             with modify_hdf(toy_fit_file) as hdf_file:
                 # First fit results
diff --git a/analysis/toys/generate_toys.py b/analysis/toys/generate_toys.py
index 60aad25..1499486 100644
--- a/analysis/toys/generate_toys.py
+++ b/analysis/toys/generate_toys.py
@@ -72,7 +72,7 @@ def generate(physics_factory, n_events):
             raise ValueError("Generation of a simultaneous requires a dictionary for the number of events.")
         output_dataset = None
         for label, n_events_label in n_events.items():
-            label_factory = physics_factory.get_children().get(label, None)
+            label_factory = physics_factory.get_children().get(label, None)  # None is default?
             if not label_factory:
                 raise KeyError("Unknown label -> %s" % label)
             label_df = generate_events(label_factory.get_pdf("GenPdf_%s" % label,
@@ -158,7 +158,7 @@ def run(config_files, link_from):
         logger.warning("Generating a RooAddPdf or a RooSimultaneous: "
                        "yields will be generated at a fixed value")
     try:
-        dataset = generate(physics, config['gen'].get('nevents-per-job', config['gen']['nevents']))  # TODO: catch config error?
+        dataset = generate(physics, config['gen'].get('nevents-per-job', config['gen']['nevents']))  # DEFAULT
     except ValueError as error:
         logger.exception("Exception on generation")
         raise RuntimeError(str(error))
@@ -174,7 +174,7 @@ def run(config_files, link_from):
     try:
         # Save
         with work_on_file(config['name'],
-                          config.get('link-from', None),
+                          config.get('link-from'),
                           get_toy_path) as toy_file:
             with modify_hdf(toy_file) as hdf_file:
                 hdf_file.append('data', dataset.assign(jobid=job_id))
diff --git a/analysis/toys/submitter.py b/analysis/toys/submitter.py
index 7084183..9b2174a 100644
--- a/analysis/toys/submitter.py
+++ b/analysis/toys/submitter.py
@@ -91,7 +91,7 @@ class ToySubmitter(object):
         # Store infotmation
         self.config = config
         # Assign link-from giving priority to the argument
-        self.config['link-from'] = link_from if link_from else config.get('link-from', None)
+        self.config['link-from'] = link_from if link_from else config.get('link-from')
         self.link_from = link_from
         self.extend = extend
         self.overwrite = overwrite
@@ -159,7 +159,7 @@ class ToySubmitter(object):
                                                  None)  # No linking is done for logs
         # Calculate number of jobs and submit
         ntoys = config[self.NTOYS_KEY]
-        ntoys_per_job = config.get(self.NTOYS_PER_JOB_KEY, ntoys)
+        ntoys_per_job = config.get(self.NTOYS_PER_JOB_KEY, ntoys)  # DEFAULT
         n_jobs = int(1.0*ntoys/ntoys_per_job)
         if ntoys % ntoys_per_job:
             n_jobs += 1
-- 
GitLab


From c4c87b745d406214851a96391f2aa7a6e83da0ee Mon Sep 17 00:00:00 2001
From: Jonas Eschle 'Mayou36 <jonas.eschle@cern.ch>
Date: Mon, 30 Oct 2017 23:40:18 +0000
Subject: [PATCH 09/13] Reformulated docstring legendre.py

---
 analysis/efficiency/legendre.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/analysis/efficiency/legendre.py b/analysis/efficiency/legendre.py
index 2eecf28..8ce9a85 100644
--- a/analysis/efficiency/legendre.py
+++ b/analysis/efficiency/legendre.py
@@ -116,8 +116,8 @@ class LegendreEfficiency(Efficiency):
                         var_name2: [min_var2, max_var2]},
              'symmetric-variables': [var_1]}
 
-        The range is used to rescale the data in the `fit` method. If it's not
-        given, it's assumed it is [-1, 1].
+        The range is used to rescale the data in the `fit` method. If no range
+        is given, the data is assumed to be already in the range [-1, 1].
 
         Arguments:
             var_list (list): List of observables to apply the efficiency to.
-- 
GitLab


From 2096583c1f7a2a4a921c31f93ca6f1a9fdd64ac9 Mon Sep 17 00:00:00 2001
From: Jonas Eschle 'Mayou36 <mayou36@jonas.eschle.com>
Date: Wed, 1 Nov 2017 15:01:58 +0100
Subject: [PATCH 10/13] applied changes from resolved discussions

---
 analysis/data/__init__.py       | 4 ++--
 analysis/efficiency/__init__.py | 6 +++---
 analysis/efficiency/legendre.py | 4 ++--
 analysis/fit/__init__.py        | 2 +-
 analysis/toys/fit_toys.py       | 6 +++---
 analysis/toys/generate_toys.py  | 4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/analysis/data/__init__.py b/analysis/data/__init__.py
index fd1a499..53133e2 100644
--- a/analysis/data/__init__.py
+++ b/analysis/data/__init__.py
@@ -99,9 +99,9 @@ def get_data(data_config, **kwargs):
     for key in ('source', 'tree', 'output-format'):
         if key not in data_config:
             raise KeyError("Bad data configuration -> '%s' key is missing" % key)
-    source_name = data_config.pop('source')  # DEFAULT OK
+    source_name = data_config.pop('source')
     try:
-        source_type = data_config.pop('source-type', None)  # DEFAULT
+        source_type = data_config.pop('source-type', None)
         file_name = source_name if not source_type \
             else getattr(paths, 'get_%s_path' % source_type)(source_name)
         if not os.path.exists(file_name):
diff --git a/analysis/efficiency/__init__.py b/analysis/efficiency/__init__.py
index 670a8e2..77f4f21 100644
--- a/analysis/efficiency/__init__.py
+++ b/analysis/efficiency/__init__.py
@@ -104,7 +104,7 @@ def get_efficiency_model(efficiency_config, **extra_parameters):
         KeyError: If there is a configuration error
 
     """
-    efficiency_config['parameters'].update(extra_parameters)  # Handle missing 'parameters' key?
+    efficiency_config['parameters'].update(extra_parameters)
     # Check the configuration
     for key in ('model', 'variables', 'parameters'):
         if key not in efficiency_config:
@@ -182,10 +182,10 @@ def get_acceptance(config):
     if missing_keys:
         raise ConfigError("Missing configuration key! -> {}".format(missing_keys))
     # Load the efficiencies
-    gen_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['generation'].pop('name')),  # Handle missing 'name' key?
+    gen_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['generation'].pop('name')),
                                                       validate=('model', 'variables', 'parameters')),
                                           **config['generation'])
-    reco_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['reconstruction'].pop('name')),  # Handle missing 'name' key?
+    reco_efficiency = get_efficiency_model(load_config(get_efficiency_path(config['reconstruction'].pop('name')),
                                                        validate=('model', 'variables', 'parameters')),
                                            **config['reconstruction'])
     # Check the variables
diff --git a/analysis/efficiency/legendre.py b/analysis/efficiency/legendre.py
index 8ce9a85..f38ccb8 100644
--- a/analysis/efficiency/legendre.py
+++ b/analysis/efficiency/legendre.py
@@ -130,7 +130,7 @@ class LegendreEfficiency(Efficiency):
         """
         super(LegendreEfficiency, self).__init__(var_list, config)
         self._ranges = {var_name: process_range((low, high))
-                        for var_name, (low, high) in config.get('ranges', {}).items()}  # DEFAULT? Doc says [-1, 1] assumed
+                        for var_name, (low, high) in config.get('ranges', {}).items()}
         orders = tuple(config['pol-orders'][var] for var in var_list)
         self._coefficients = np.reshape(config['coefficients'], orders)
         self._covariance = np.reshape(config['covariance'],
@@ -345,7 +345,7 @@ class LegendreEfficiency1D(Efficiency):
         self._ranges = {var_name: process_range((low, high))
                         for var_name, (low, high) in config.get('ranges', {}).items()}
         # Load coefficients
-        if len(config['coefficients']) != sum(order for order in config['pol-orders'].values()):  # MISSING KEY
+        if len(config['coefficients']) != sum(order for order in config['pol-orders'].values()):
             raise KeyError("Wrong number of coefficients")
         self._coefficients = np.array(np.split(config['coefficients'],
                                                np.cumsum([config['pol-orders'][var_name]
diff --git a/analysis/fit/__init__.py b/analysis/fit/__init__.py
index a2ccc46..b6c7f42 100644
--- a/analysis/fit/__init__.py
+++ b/analysis/fit/__init__.py
@@ -77,7 +77,7 @@ def fit(factory, pdf_name, strategy, dataset, verbose=False, **kwargs):
 
     fit_config = [ROOT.RooFit.Save(True),
                   ROOT.RooFit.PrintLevel(2 if verbose else -1)]
-    kwargs.setdefault('Range', 'Full')  # DEFAULT
+    kwargs.setdefault('Range', 'Full')
     for command, val in kwargs.items():
         roo_cmd = getattr(ROOT.RooFit, command, None)
         if not roo_cmd:
diff --git a/analysis/toys/fit_toys.py b/analysis/toys/fit_toys.py
index a1d190a..0199721 100644
--- a/analysis/toys/fit_toys.py
+++ b/analysis/toys/fit_toys.py
@@ -136,7 +136,7 @@ def run(config_files, link_from, verbose):
     try:
         models = {model_name: config[model_name]
                   for model_name
-                  in config['fit'].get('models', ['model'])}  # DEFAULT
+                  in config['fit'].get('models', ['model'])}
     except KeyError as error:
         logger.error("Missing model configuration -> %s", str(error))
         raise KeyError("Missing model configuration")
@@ -275,8 +275,8 @@ def run(config_files, link_from, verbose):
                                      fit_strategy,
                                      dataset,
                                      verbose,
-                                     Extended=config['fit'].get('extended', True),  # DEFAULT
-                                     Minos=config['fit'].get('minos', True))  # DEFAULT
+                                     Extended=config['fit'].get('extended', False),
+                                     Minos=config['fit'].get('minos', False))
                 except ValueError:
                     raise RuntimeError()
                 # Now results are in fit_parameters
diff --git a/analysis/toys/generate_toys.py b/analysis/toys/generate_toys.py
index 1499486..42a1439 100644
--- a/analysis/toys/generate_toys.py
+++ b/analysis/toys/generate_toys.py
@@ -72,7 +72,7 @@ def generate(physics_factory, n_events):
             raise ValueError("Generation of a simultaneous requires a dictionary for the number of events.")
         output_dataset = None
         for label, n_events_label in n_events.items():
-            label_factory = physics_factory.get_children().get(label, None)  # None is default?
+            label_factory = physics_factory.get_children().get(label)
             if not label_factory:
                 raise KeyError("Unknown label -> %s" % label)
             label_df = generate_events(label_factory.get_pdf("GenPdf_%s" % label,
@@ -158,7 +158,7 @@ def run(config_files, link_from):
         logger.warning("Generating a RooAddPdf or a RooSimultaneous: "
                        "yields will be generated at a fixed value")
     try:
-        dataset = generate(physics, config['gen'].get('nevents-per-job', config['gen']['nevents']))  # DEFAULT
+        dataset = generate(physics, config['gen'].get('nevents-per-job', config['gen']['nevents']))
     except ValueError as error:
         logger.exception("Exception on generation")
         raise RuntimeError(str(error))
-- 
GitLab


From 26dadb38d5b0cc3718ae6bfb666b28721fc608d3 Mon Sep 17 00:00:00 2001
From: Jonas Eschle 'Mayou36 <mayou36@jonas.eschle.com>
Date: Wed, 8 Nov 2017 21:31:31 +0100
Subject: [PATCH 11/13] fixed error message slightly

---
 analysis/toys/fit_toys.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/analysis/toys/fit_toys.py b/analysis/toys/fit_toys.py
index 0199721..cc3929b 100644
--- a/analysis/toys/fit_toys.py
+++ b/analysis/toys/fit_toys.py
@@ -141,7 +141,7 @@ def run(config_files, link_from, verbose):
         logger.error("Missing model configuration -> %s", str(error))
         raise KeyError("Missing model configuration")
     if not models:
-        logger.error("No model was specified in the config file!")
+        logger.error("Empty list specified in the config file under 'fit/models'!")
         raise KeyError()
     fit_strategies = config['fit'].get('strategies', ['simple'])  # DEFAULT
     if not fit_strategies:
-- 
GitLab


From 742f77eff81013c450423f7e56d2baf3497ef0ec Mon Sep 17 00:00:00 2001
From: Jonas Eschle 'Mayou36 <mayou36@jonas.eschle.com>
Date: Wed, 8 Nov 2017 21:38:37 +0100
Subject: [PATCH 12/13] removed markings

---
 analysis/data/__init__.py       | 6 +++---
 analysis/data/loaders.py        | 2 +-
 analysis/efficiency/__init__.py | 2 +-
 analysis/fit/__init__.py        | 2 +-
 analysis/fit/result.py          | 6 +++---
 analysis/physics/factory.py     | 2 +-
 analysis/physics/pdf_models.py  | 2 +-
 analysis/toys/fit_toys.py       | 2 +-
 analysis/toys/submitter.py      | 2 +-
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/analysis/data/__init__.py b/analysis/data/__init__.py
index 53133e2..f896a73 100644
--- a/analysis/data/__init__.py
+++ b/analysis/data/__init__.py
@@ -108,12 +108,12 @@ def get_data(data_config, **kwargs):
             raise OSError("Cannot find input file -> %s" % file_name)
     except AttributeError:
         raise AttributeError("Unknown source type -> %s" % source_type)
-    tree_name = data_config.pop('tree')  # DEFAULT OK
-    output_format = data_config.pop('output-format').lower()  # DEFAULT OK
+    tree_name = data_config.pop('tree')
+    output_format = data_config.pop('output-format').lower()
     # Optional: output-type, cuts, branches
     input_ext = os.path.splitext(file_name)[1]
     try:
-        input_type = data_config.get('input-type')  # DEFAULT
+        input_type = data_config.get('input-type')
         if not input_type:
             input_type = get_global_var('FILE_TYPES')[input_ext]
     except KeyError:
diff --git a/analysis/data/loaders.py b/analysis/data/loaders.py
index 51b20d0..7ff5dc0 100644
--- a/analysis/data/loaders.py
+++ b/analysis/data/loaders.py
@@ -160,7 +160,7 @@ def get_root_from_pandas_file(file_name, tree_name, kwargs):
     # Checks and variable preparation
     try:
         name = kwargs['name']
-        title = kwargs.get('title', name)  # DEFAULT OK
+        title = kwargs.get('title', name)
     except KeyError as error:
         raise KeyError("Missing configuration key -> %s" % error)
     # Check weights
diff --git a/analysis/efficiency/__init__.py b/analysis/efficiency/__init__.py
index 77f4f21..a4ae9bb 100644
--- a/analysis/efficiency/__init__.py
+++ b/analysis/efficiency/__init__.py
@@ -60,7 +60,7 @@ def get_efficiency_model_class(model_name):
         `Efficiency`: Efficiency class, non-instantiated.
 
     """
-    return get_global_var('EFFICIENCY_MODELS').get(model_name.lower())  # DEFAULT
+    return get_global_var('EFFICIENCY_MODELS').get(model_name.lower())
 
 
 def load_efficiency_model(model_name, **extra_parameters):
diff --git a/analysis/fit/__init__.py b/analysis/fit/__init__.py
index b6c7f42..f3aacd3 100644
--- a/analysis/fit/__init__.py
+++ b/analysis/fit/__init__.py
@@ -98,7 +98,7 @@ def fit(factory, pdf_name, strategy, dataset, verbose=False, **kwargs):
     except ValueError as error:
         logger.error("Problem getting the PDF -> %s", error)
         raise
-    if kwargs.get('Extended', False) != factory.is_extended():  # DEFAULT OK
+    if kwargs.get('Extended', False) != factory.is_extended():
         logger.warning("Requested fit with Extended=%s fit on %sextended PDF. Check this is what you want.",
                        kwargs.get('Extended', False),
                        'an ' if factory.is_extended() else 'a non-')
diff --git a/analysis/fit/result.py b/analysis/fit/result.py
index 2f5fca8..97619e2 100644
--- a/analysis/fit/result.py
+++ b/analysis/fit/result.py
@@ -215,9 +215,9 @@ class FitResult(object):
                        for val, suffix in zip(param, _SUFFIXES)}
         pandas_dict.update({param_name: val for param_name, val
                             in self._result['const-parameters'].items()})
-        pandas_dict['status_migrad'] = self._result['status'].get('MIGRAD', -1)  # DEFAULT
-        pandas_dict['status_hesse'] = self._result['status'].get('HESSE', -1)  # DEFAULT
-        pandas_dict['status_minos'] = self._result['status'].get('MINOS', -1)  # DEFAULT
+        pandas_dict['status_migrad'] = self._result['status'].get('MIGRAD', -1)
+        pandas_dict['status_hesse'] = self._result['status'].get('HESSE', -1)
+        pandas_dict['status_minos'] = self._result['status'].get('MINOS', -1)
         pandas_dict['cov_quality'] = self._result['covariance-matrix']['quality']
         pandas_dict['edm'] = self._result['edm']
         if not skip_cov:
diff --git a/analysis/physics/factory.py b/analysis/physics/factory.py
index d95c08d..c396ef0 100644
--- a/analysis/physics/factory.py
+++ b/analysis/physics/factory.py
@@ -414,7 +414,7 @@ class BaseFactory(object):
         raise NotImplementedError()
 
     def get_yield_var(self):
-        return self._objects.get('Yield')  # DEFAULT: should an Error be raised if Yield not there?
+        return self._objects.get('Yield')
 
     def set_yield_var(self, yield_):
         raise NotImplementedError()
diff --git a/analysis/physics/pdf_models.py b/analysis/physics/pdf_models.py
index 7489744..edc57ac 100644
--- a/analysis/physics/pdf_models.py
+++ b/analysis/physics/pdf_models.py
@@ -199,7 +199,7 @@ class ArgusConvGaussPdfMixin(object):
 
         """
         super(ArgusConvGaussPdfMixin, self).__init__(config, parameters)
-        self._buffer_fraction = config.get('buffer_fraction', 1.0)  # DEFAULT
+        self._buffer_fraction = config.get('buffer_fraction', 1.0)
 
     def get_unbound_pdf(self, name, title):
         """Get the convolved PDF.
diff --git a/analysis/toys/fit_toys.py b/analysis/toys/fit_toys.py
index cc3929b..bd64b6c 100644
--- a/analysis/toys/fit_toys.py
+++ b/analysis/toys/fit_toys.py
@@ -143,7 +143,7 @@ def run(config_files, link_from, verbose):
     if not models:
         logger.error("Empty list specified in the config file under 'fit/models'!")
         raise KeyError()
-    fit_strategies = config['fit'].get('strategies', ['simple'])  # DEFAULT
+    fit_strategies = config['fit'].get('strategies', ['simple'])
     if not fit_strategies:
         logger.error("Empty fit strategies were specified in the config file!")
         raise KeyError()
diff --git a/analysis/toys/submitter.py b/analysis/toys/submitter.py
index ed51661..82d0dfa 100644
--- a/analysis/toys/submitter.py
+++ b/analysis/toys/submitter.py
@@ -159,7 +159,7 @@ class ToySubmitter(object):
                                                  None)  # No linking is done for logs
         # Calculate number of jobs and submit
         ntoys = config[self.NTOYS_KEY]
-        ntoys_per_job = config.get(self.NTOYS_PER_JOB_KEY, ntoys)  # DEFAULT
+        ntoys_per_job = config.get(self.NTOYS_PER_JOB_KEY, ntoys)
         n_jobs = int(1.0*ntoys/ntoys_per_job)
         if ntoys % ntoys_per_job:
             n_jobs += 1
-- 
GitLab


From fc4b1306f12bc18b116d9e9fb139f0daa1e3f24c Mon Sep 17 00:00:00 2001
From: Jonas Eschle 'Mayou36 <mayou36@jonas.eschle.com>
Date: Wed, 8 Nov 2017 22:00:43 +0100
Subject: [PATCH 13/13] removed last marks

---
 analysis/efficiency/legendre.py | 6 +++---
 analysis/toys/fit_toys.py       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/analysis/efficiency/legendre.py b/analysis/efficiency/legendre.py
index 057b041..717a79c 100644
--- a/analysis/efficiency/legendre.py
+++ b/analysis/efficiency/legendre.py
@@ -350,9 +350,9 @@ class LegendreEfficiency1D(Efficiency):
         self._coefficients = np.array(np.split(config['coefficients'],
                                                np.cumsum([config['pol-orders'][var_name]
                                                           for var_name in self.get_variables()])[:-1]))
-        self._covariance = np.reshape(config['covariance'],  # MISSING KEY
-                                      (sum(config['pol-orders'].values()),  # MISSING KEY
-                                       sum(config['pol-orders'].values())))  # MISSING KEY
+        self._covariance = np.reshape(config['covariance'],
+                                      (sum(config['pol-orders'].values()),
+                                       sum(config['pol-orders'].values())))
         for var_name in config.get('symmetric-variables', []):
             logger.debug("Symmetrizing legendre polynomial for variable %s", var_name)
             try:
diff --git a/analysis/toys/fit_toys.py b/analysis/toys/fit_toys.py
index 46ddbd4..a08ea05 100644
--- a/analysis/toys/fit_toys.py
+++ b/analysis/toys/fit_toys.py
@@ -176,7 +176,7 @@ def run(config_files, link_from, verbose):
                                    'tree': 'data',
                                    'output-format': 'pandas',
                                    'selection': data_source.get('selection')}),
-                         data_source['nevents'],  # explicit fail?
+                         data_source['nevents'],
                          data_source.get('category'))
         # Generator values
         toy_info = get_data({'source': source_toy,
-- 
GitLab