Commit 5c907487 authored by Médéric Boquien's avatar Médéric Boquien Committed by Yannick Roehlly
Browse files

Typo and spelling corrections

PEP8-fication of the code and correction of various typos and spelling
mistakes.
parent 4f422dc6
...@@ -215,7 +215,7 @@ class Database(object): ...@@ -215,7 +215,7 @@ class Database(object):
self.session.commit() self.session.commit()
except exc.IntegrityError: except exc.IntegrityError:
self.session.rollback() self.session.rollback()
raise StandardError('The filter is yet in the base.') raise StandardError('The filter is already in the base.')
else: else:
raise StandardError('The database is not writable.') raise StandardError('The database is not writable.')
......
...@@ -159,7 +159,7 @@ class SED(object): ...@@ -159,7 +159,7 @@ class SED(object):
If the key is present in the dictionary, it will raise an exception. If the key is present in the dictionary, it will raise an exception.
Use this method (instead of direct value assignment ) to avoid Use this method (instead of direct value assignment ) to avoid
overriding a yet present information. overriding an already present information.
Parameters Parameters
---------- ----------
...@@ -171,7 +171,7 @@ class SED(object): ...@@ -171,7 +171,7 @@ class SED(object):
If True, the added variable is set as proportional to the If True, the added variable is set as proportional to the
mass. mass.
force : boolean force : boolean
If false (default), adding a key that yet exists in the info If false (default), adding a key that already exists in the info
dictionary will raise an error. If true, doing this will update dictionary will raise an error. If true, doing this will update
the associated value. the associated value.
...@@ -181,7 +181,7 @@ class SED(object): ...@@ -181,7 +181,7 @@ class SED(object):
if mass_proportional: if mass_proportional:
self.mass_proportional_info.append(key) self.mass_proportional_info.append(key)
else: else:
raise KeyError("The information %s is yet present " raise KeyError("The information %s is already present "
"in the SED. " % key) "in the SED. " % key)
def add_module(self, module_name, module_conf): def add_module(self, module_name, module_conf):
...@@ -392,7 +392,7 @@ class SED(object): ...@@ -392,7 +392,7 @@ class SED(object):
transmission[1]) transmission[1])
# TODO: Can we avoid to normalise as the filter transmission is # TODO: Can we avoid to normalise as the filter transmission is
# yet normalised? # already normalised?
f_lambda = utils.luminosity_to_flux( f_lambda = utils.luminosity_to_flux(
(np.trapz(transmission_r * l_lambda_r, wavelength_r) / (np.trapz(transmission_r * l_lambda_r, wavelength_r) /
np.trapz(transmission_r, wavelength_r)), np.trapz(transmission_r, wavelength_r)),
......
...@@ -59,9 +59,9 @@ def complete_parameters(given_parameters, parameter_list): ...@@ -59,9 +59,9 @@ def complete_parameters(given_parameters, parameter_list):
if unexpected_parameters: if unexpected_parameters:
message += ("Unexpected parameters: " + message += ("Unexpected parameters: " +
", ".join(unexpected_parameters) + ", ".join(unexpected_parameters) +
".") ". ")
raise KeyError("The parameters passed are different from the " raise KeyError("The parameters passed are different from the "
"expected one." + message) "expected one. " + message)
return given_parameters return given_parameters
......
...@@ -56,13 +56,10 @@ class Module(common.SEDCreationModule): ...@@ -56,13 +56,10 @@ class Module(common.SEDCreationModule):
) )
} }
out_parameter_list = { out_parameter_list = {'qpah': 'Mass fraction of PAH',
'qpah': 'Mass fraction of PAH', 'umin': 'Minimum radiation field',
'umin': 'Minimum radiation field', 'umax': 'Maximum radiation field',
'umax': 'Maximum radiation field', 'gamma': 'Fraction illuminated from Umin to Umax'}
'gamma': 'Fraction illuminated from Umin to Umax'
}
def _init_code(self): def _init_code(self):
"""Get the model out of the database""" """Get the model out of the database"""
...@@ -84,15 +81,14 @@ class Module(common.SEDCreationModule): ...@@ -84,15 +81,14 @@ class Module(common.SEDCreationModule):
# mass in W kg¯¹, The gamma parameter does not affect the fact that it # mass in W kg¯¹, The gamma parameter does not affect the fact that it
# is for 1 kg because it represents a mass fraction of each component. # is for 1 kg because it represents a mass fraction of each component.
self.emissivity = np.trapz((1. - gamma) * self.model_minmin.lumin + self.emissivity = np.trapz((1. - gamma) * self.model_minmin.lumin +
gamma * self.model_minmax.lumin, gamma * self.model_minmax.lumin,
x=self.model_minmin.wave) x=self.model_minmin.wave)
# We want to be able to display the respective constributions of both # We want to be able to display the respective constributions of both
# components, therefore we keep they separately. # components, therefore we keep they separately.
self.model_minmin.lumin *= (1. - gamma) / self.emissivity self.model_minmin.lumin *= (1. - gamma) / self.emissivity
self.model_minmax.lumin *= gamma / self.emissivity self.model_minmax.lumin *= gamma / self.emissivity
def process(self, sed): def process(self, sed):
"""Add the IR re-emission contributions """Add the IR re-emission contributions
......
...@@ -6,4 +6,3 @@ Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt ...@@ -6,4 +6,3 @@ Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
@author: Yannick Roehlly <yannick.roehlly@oamp.fr> @author: Yannick Roehlly <yannick.roehlly@oamp.fr>
""" """
...@@ -135,7 +135,7 @@ class Module(common.AnalysisModule): ...@@ -135,7 +135,7 @@ class Module(common.AnalysisModule):
os.mkdir(OUT_DIR) os.mkdir(OUT_DIR)
except OSError: except OSError:
print("pcigale can't create the {} directory, maybe " print("pcigale can't create the {} directory, maybe "
"it yet exists.".format(OUT_DIR)) "it already exists.".format(OUT_DIR))
sys.exit() sys.exit()
# Open the warehouse # Open the warehouse
......
...@@ -6,4 +6,3 @@ Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt ...@@ -6,4 +6,3 @@ Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
@author: Yannick Roehlly <yannick.roehlly@oamp.fr> @author: Yannick Roehlly <yannick.roehlly@oamp.fr>
""" """
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