Commit 021e2d75 authored by Médéric Boquien's avatar Médéric Boquien

Some reformatting to try to improve the legibility of the code and to follow PEP8 better.

parent e654154f
...@@ -42,20 +42,22 @@ class ObservationsManagerPassbands(object): ...@@ -42,20 +42,22 @@ class ObservationsManagerPassbands(object):
self.params = params self.params = params
self.allpropertiesnames, self.massproportional = get_info(self) self.allpropertiesnames, self.massproportional = get_info(self)
self.table = read_table(config['data_file']) self.table = read_table(config['data_file'])
self.bands = [band for band in config['bands'] if not self.bands = [band for band in config['bands']
band.endswith('_err')] if not band.endswith('_err')]
self.bands_err = [band for band in config['bands'] if self.bands_err = [band for band in config['bands']
band.endswith('_err')] if band.endswith('_err')]
self.intprops = [prop for prop in config['properties'] if (prop not in self.intprops = [prop for prop in config['properties']
self.massproportional and not prop.endswith('_err'))] if (prop not in self.massproportional
self.intprops_err = [prop for prop in config['properties'] if and not prop.endswith('_err'))]
(prop.endswith('_err') and prop[:-4] not in self.intprops_err = [prop for prop in config['properties']
self.massproportional)] if (prop.endswith('_err')
self.extprops = [prop for prop in config['properties'] if (prop in and prop[:-4] not in self.massproportional)]
self.massproportional and not prop.endswith('_err'))] self.extprops = [prop for prop in config['properties']
self.extprops_err = [prop for prop in config['properties'] if if (prop in self.massproportional
(prop.endswith('_err') and prop[:-4] in and not prop.endswith('_err'))]
self.massproportional)] self.extprops_err = [prop for prop in config['properties']
if (prop.endswith('_err')
and prop[:-4] in self.massproportional)]
self.tofit = self.bands + self.intprops + self.extprops self.tofit = self.bands + self.intprops + self.extprops
self.tofit_err = self.bands_err + self.intprops_err + self.extprops_err self.tofit_err = self.bands_err + self.intprops_err + self.extprops_err
...@@ -106,7 +108,7 @@ class ObservationsManagerPassbands(object): ...@@ -106,7 +108,7 @@ class ObservationsManagerPassbands(object):
for item in self.table.colnames: for item in self.table.colnames:
if (item != 'id' and item != 'redshift' and item != 'distance' and if (item != 'id' and item != 'redshift' and item != 'distance' and
item not in self.tofit + self.tofit_err): item not in self.tofit + self.tofit_err):
self.table.remove_column(item) self.table.remove_column(item)
print("Warning: {} in the input file but not to be taken into" print("Warning: {} in the input file but not to be taken into"
" account in the fit.".format(item)) " account in the fit.".format(item))
...@@ -137,7 +139,7 @@ class ObservationsManagerPassbands(object): ...@@ -137,7 +139,7 @@ class ObservationsManagerPassbands(object):
error = item + '_err' error = item + '_err'
if item in self.intprops: if item in self.intprops:
if (error not in self.intprops_err or if (error not in self.intprops_err or
error not in self.table.colnames): error not in self.table.colnames):
raise ValueError("Intensive properties errors must be in " raise ValueError("Intensive properties errors must be in "
"input file.") "input file.")
elif (error not in self.tofit_err or elif (error not in self.tofit_err or
...@@ -289,6 +291,7 @@ class Observation(object): ...@@ -289,6 +291,7 @@ class Observation(object):
fluxes, intensive properties, extensive properties and their errors, that fluxes, intensive properties, extensive properties and their errors, that
are going to be considered in the fit. are going to be considered in the fit.
""" """
def __init__(self, row, cls): def __init__(self, row, cls):
self.redshift = row['redshift'] self.redshift = row['redshift']
self.id = row['id'] self.id = row['id']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment