Commit b37be08b authored by Yannick Roehlly's avatar Yannick Roehlly
Browse files

Orthographic corrections

s/[Pp]arametre/[Pp]arameter/g
s/[Dd]ictionnary/[Dd]ictionary/g
parent b545a5bd
......@@ -23,13 +23,13 @@ def genconf(config):
"Generate the full configuration."
config.generate_conf()
print("The configuration file has been updated. Please complete the "
"various module parametres and the data file columns to use in "
"various module parameters and the data file columns to use in "
"the analysis.")
def check(config):
"Check the configuration."
# TODO : Check if all the parametres that don't have default values are
# TODO : Check if all the parameters that don't have default values are
# given for each module.
print ("With this configuration, pcigale must compute {} "
"SEDs.".format(len(config.sed_modules_conf_array)))
......@@ -50,7 +50,7 @@ def run(config):
print("Object {}:".format(index))
print("Best SED Chi2: {}".format(chi2))
print("Best SED factor: {}".format(norm_factor))
print("Best SED parametres:")
print("Best SED parameters:")
print(params)
print("Best SED info:")
for (key, value) in sed.info.items():
......
......@@ -102,7 +102,7 @@ class Database(object):
"""
Create a collection giving access to access the pcigale database.
Parametres
Parameters
----------
writable : boolean
If True the user will be able to write new data in the database
......@@ -132,7 +132,7 @@ class Database(object):
"""
Add a filter to pcigale database.
Parametres
Parameters
----------
pcigale_filter : pcigale.data.Filter
"""
......@@ -150,7 +150,7 @@ class Database(object):
"""
Add a Maraston 2005 SSP to pcigale database
Parametres
Parameters
----------
ssp : pcigale.base.SspM2005
......@@ -170,7 +170,7 @@ class Database(object):
"""
Add Dale and Helou (2002) templates the collection.
Parametres
Parameters
----------
data : array
Array containing the templates data.
......@@ -201,7 +201,7 @@ class Database(object):
"""
Get a specific filter from the collection
Parametres
Parameters
----------
name : string
Name of the filter
......@@ -227,7 +227,7 @@ class Database(object):
Query the database for a Maraston 2005 SSP corresponding to the given
initial mass function and metallicity.
Parametres
Parameters
----------
imf : string
Initial mass function (ss for Salpeter, kr for Kroupa)
......@@ -277,9 +277,9 @@ class Database(object):
Returns
-------
names, lamdba_eff : array, dictionnary
names, lamdba_eff : array, dictionary
names is the list of the filter names and lambda_eff is a
dictionnary associating the effective wavelength (in nm) to the
dictionary associating the effective wavelength (in nm) to the
filter name
"""
result = self.session.query(_Filter.name,
......
......@@ -22,7 +22,7 @@ class IrTemplatesDH2002(object):
def __init__(self, alpha_grid, wavelength_grid, templates):
"""Create a new IR template set
Parametres
Parameters
----------
alpha_grid : array
Vector of the various values for the α slope in the templates.
......@@ -46,7 +46,7 @@ class IrTemplatesDH2002(object):
(2002) template set. The new template is normalised in case of errors
in the interpolation.
Parametres
Parameters
----------
alpha : float
α slope of the IR.
......
......@@ -35,7 +35,7 @@ class SspM2005(object):
mass_table, spec_table):
"""Create a new single stellar population as defined in Maraston 2005.
Parametres
Parameters
----------
imf : string
Initial mass function (IMF): either 'ss' for single Salpeter
......@@ -92,7 +92,7 @@ class SspM2005(object):
If 'age' is a float, the computation is a lot faster, based on the
fact that the SFR is given at each age of the SSP age grid.
Parametres
Parameters
----------
sfh : array of floats
Star Formation Rates in Msun/y for each age of the SSP age grid.
......@@ -127,7 +127,7 @@ class SspM2005(object):
raise ValueError("The star formation rate must be base"
"on the same grid than the SSP.")
# Check if the age parametre is a unique float or an array.
# Check if the age parameter is a unique float or an array.
try:
age = float(age)
isAgeUnique = True
......@@ -164,7 +164,7 @@ class SspM2005(object):
spectra = 1.e9 * step * np.dot(spec_table, sfh[::-1])
else:
# If the age parametre is an array, we do the full convolution.
# If the age parameter is an array, we do the full convolution.
# 1. We limit sfh, mass_table, spec_table and time_grid for time
# up to the maximum age.
# Index of the time nearest to the maximum age in the grid.
......
......@@ -19,7 +19,7 @@ class SED(object):
This class represents a Spectral Energy Distribution (SED) as constructed
by pCigale. Such a SED is characterised by:
- A list of tuples (module name, parametre dictionnary) describing all the
- A list of tuples (module name, parameter dictionary) describing all the
pCigale modules the SED 'went through'.
- The wavelengths grid (in nm).
......@@ -33,7 +33,7 @@ class SED(object):
separated from the list of the modules so that one module can result in
various contributions to the SED.
- A dictionnary of arbitrary information associated with the SED.
- A dictionary of arbitrary information associated with the SED.
- The list of the keys from the info dictionary whose value is
proportional to the galaxy mass.
......@@ -89,7 +89,7 @@ class SED(object):
Return the (redshifted if asked) total Fν flux density vs wavelength
spectrum of the SED.
Parametres
Parameters
----------
redshift : float, default = 0
If 0 (the default), the flux at 10 pc is computed.
......@@ -116,11 +116,11 @@ class SED(object):
"""
Add a key / value to the information dictionary
If the key is present in the dictionnary, 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
overriding a yet present information.
Parametres
Parameters
----------
key : any immutable
The key used to retrieve the information.
......@@ -142,15 +142,15 @@ class SED(object):
def add_module(self, module_name, module_conf):
"""Add a new module information to the SED.
Parametres
Parameters
----------
module_name : string
Name of the module. This name can be suffixed with anything
using a dot.
module_conf : dictionary
Dictionary containing the module parametres.
Dictionary containing the module parameters.
TODO: Complete the parametre dictionary with the default values from
TODO: Complete the parameter dictionary with the default values from
the module if they are not present.
"""
......@@ -168,7 +168,7 @@ class SED(object):
luminosity set to 0. Also, the name of the contribution is added to
the contribution names array.
Parametres
Parameters
----------
contribution_name : string
Name of the contribution added. This name is used to retrieve the
......@@ -229,7 +229,7 @@ class SED(object):
If the name of the contribution is not unique in the SED, the flux of
the last one is returned.
Parametres
Parameters
----------
name : string
Name of the contribution
......@@ -269,7 +269,7 @@ class SED(object):
If the SED spectrum does not cover all the filter response table,
-99 is returned.
Parametres
Parameters
----------
transmission : 2D array of floats
A numpy 2D array containing the filter response profile
......
......@@ -16,19 +16,19 @@ from ...extern.lsst import Sed as lsst
class Module(common.SEDCreationModule):
"""Add CCM dust model extinction to the SED
If a contribution name is given in the parametre list, the extinction will
If a contribution name is given in the parameter list, the extinction will
be applied only to the flux of this contribution; else, it will be applied
to the whole spectrum.
This module is based on the code from the Large Synoptic Survey Telescope.
http://dev.lsstcorp.org/trac/
The parametres added and available for the statistical analysis are:
The parameters added and available for the statistical analysis are:
ccmdust_A_v, ccmdust_ebv and ccmdust_R_v.
"""
parametre_list = {
parameter_list = {
'A_v': (
'float',
'kesako',
......@@ -52,35 +52,35 @@ class Module(common.SEDCreationModule):
)
}
comments = ("One must indicate only two of the three parametres 'A_v', "
comments = ("One must indicate only two of the three parameters 'A_v', "
"'ebv' and 'R_v'. The other must be set to 'None'.")
def _process(self, sed, parametres):
def _process(self, sed, parameters):
"""Add CCM dust model extinction to the SED
The computation is done by LSST functions. Two on the three parametres
The computation is done by LSST functions. Two on the three parameters
(A_v, ebv and R_v) are expected. If that's not the case, the LSST
function will raise an exception.
Parametres
Parameters
----------
sed : pcigale.sed.SED object
parametres : dictionnary containing the parametres
parameters : dictionary containing the parameters
"""
# First, we set the parametres that have 'None' (string) as value to
# First, we set the parameters that have 'None' (string) as value to
# None.
for key in parametres:
if parametres[key] == 'None':
parametres[key] = None
for key in parameters:
if parameters[key] == 'None':
parameters[key] = None
wavelen = sed.wavelength_grid
# We get either to contribution flux or the whole spectrum.
if parametres['contribution_name']:
if parameters['contribution_name']:
l_lambda = sed.get_lumin_contribution(
parametres['contribution_name']
parameters['contribution_name']
)
else:
l_lambda = sed.luminosity
......@@ -92,9 +92,9 @@ class Module(common.SEDCreationModule):
wavelen, extended_l_lambda = lsstSed.addCCMDust(
a_x,
b_x,
A_v=parametres['A_v'],
ebv=parametres['ebv'],
R_v=parametres['R_v'],
A_v=parameters['A_v'],
ebv=parameters['ebv'],
R_v=parameters['R_v'],
wavelen=wavelen,
flambda=l_lambda
)
......@@ -111,12 +111,12 @@ class Module(common.SEDCreationModule):
# Base name for adding information to the SED.
name = self.name or 'ccmdust'
sed.add_module(name, parametres)
sed.add_module(name, parameters)
# Add the parametres values to the SED information.
sed.add_info(name + '_A_v', parametres['A_v'])
sed.add_info(name + '_ebv', parametres['ebv'])
sed.add_info(name + '_R_v', parametres['R_v'])
# Add the parameters values to the SED information.
sed.add_info(name + '_A_v', parameters['A_v'])
sed.add_info(name + '_ebv', parameters['ebv'])
sed.add_info(name + '_R_v', parameters['R_v'])
# Add the extinction value to the SED information
sed.add_info(name + '_extinction', extinction_value)
......
......@@ -12,22 +12,22 @@ class SEDCreationModule(object):
"""Abstract class, the pCigale SED creation modules are based on.
"""
# parametre_list is a dictionnary containing all the parametres used by
# the module. Each parametre name is associate to a tuple (variable type,
# parameter_list is a dictionary containing all the parameters used by
# the module. Each parameter name is associate to a tuple (variable type,
# description [string], default value). Each module must define its
# parametre list, unless it does not use any parametre. Using None means
# parameter list, unless it does not use any parameter. Using None means
# that there is no description or default value. If None should be the
# default value, use the 'None' string instead.
parametre_list = {}
parameter_list = {}
# out_parametre_list is a dictionnary containing all the SED parametres
# that are added to the SED info dictionnary and for which a statistical
# analysis may be done. Each parametre name is associated with its
# description. In the SED info dictionary, the parametre name in prefixed
# out_parameter_list is a dictionary containing all the SED parameters
# that are added to the SED info dictionary and for which a statistical
# analysis may be done. Each parameter name is associated with its
# description. In the SED info dictionary, the parameter name in prefixed
# with the name of the module plus an underscore (to allow several
# modules to add a parametre with the same name, for instance a repeated
# modules to add a parameter with the same name, for instance a repeated
# module.)
out_parametre_list = {}
out_parameter_list = {}
# comments is the text that is used to comment the module section in
# the configuration file. For instance, it can be used to give special
......@@ -38,101 +38,101 @@ class SEDCreationModule(object):
"""Instantiate a SED creation module
A name can be given to the module. This can be useful when a same
module is used several times with different parametres in the SED
module is used several times with different parameters in the SED
creation process.
The module parametres values can be passed as keyworded paramatres.
The module parameters values can be passed as keyworded paramatres.
"""
self.name = name
# parametres is a dictionnary containing the actual values for each
# module parametre.
self.parametres = kwargs
# parameters is a dictionary containing the actual values for each
# module parameter.
self.parameters = kwargs
def _process(self, sed, parametres):
def _process(self, sed, parameters):
"""Do the actual processing of the module on a SED object
This method is called with an object and a complete parametres
dictionnary. It is not meant to be called directly but through the
This method is called with an object and a complete parameters
dictionary. It is not meant to be called directly but through the
process method.
Parametres
Parameters
----------
sed : pcigale.sed.SED object
parametres : dictionnary of the module parametres
parameters : dictionary of the module parameters
"""
raise NotImplementedError()
def process(self, sed, parametres=None):
def process(self, sed, parameters=None):
"""Process a SED object with the module
This method is responsible for checking the module parametres (whether
they are given in the method call or are taken from parametres class
This method is responsible for checking the module parameters (whether
they are given in the method call or are taken from parameters class
attribute) before doing the actual processing (_process method). If a
parametre is not given but exists in the parametre_list with a default
parameter is not given but exists in the parameter_list with a default
value, this value is used.
The SED object is updated during the process, one must take care of
copying it before, if needed.
Parametres
Parameters
----------
sed : pcigale.sed.SED object
parametres : dictionnary
Dictionnary containing the module parametre values, if it is not
given, the module parametre values are used
parameters : dictionary
Dictionary containing the module parameter values, if it is not
given, the module parameter values are used
Raises
------
KeyError : when not all the needed parametres are given.
KeyError : when not all the needed parameters are given.
"""
# If the parametre dictionnary is not passed, use the module one
if not parametres:
parametres = self.parametres
# If the parameter dictionary is not passed, use the module one
if not parameters:
parameters = self.parameters
# For parametres that are present on the parametre_list with a default
# value and that are not in the parametres dictionnary, we add them
# For parameters that are present on the parameter_list with a default
# value and that are not in the parameters dictionary, we add them
# with their default value.
for key in self.parametre_list:
if (not key in parametres) and (
self.parametre_list[key][2] is not None):
parametres[key] = self.parametre_list[key][2]
# If the keys of the parametres dictionnary are different from the one
# of the parametre_list dictionnary, we raises a KeyError. That means
# that a parametre is missing (and has no default value) or that an
for key in self.parameter_list:
if (not key in parameters) and (
self.parameter_list[key][2] is not None):
parameters[key] = self.parameter_list[key][2]
# If the keys of the parameters dictionary are different from the one
# of the parameter_list dictionary, we raises a KeyError. That means
# that a parameter is missing (and has no default value) or that an
# unexpected one was given.
if not set(parametres.keys()) == set(self.parametre_list.keys()):
missing_parametres = (set(self.parametre_list.keys())
- set(parametres.keys()))
unexpected_parametres = (set(parametres.keys())
- set(self.parametre_list.keys()))
if not set(parameters.keys()) == set(self.parameter_list.keys()):
missing_parameters = (set(self.parameter_list.keys())
- set(parameters.keys()))
unexpected_parameters = (set(parameters.keys())
- set(self.parameter_list.keys()))
message = ""
if missing_parametres:
message += ("Missing parametres: " +
", ".join(missing_parametres) +
if missing_parameters:
message += ("Missing parameters: " +
", ".join(missing_parameters) +
".")
if unexpected_parametres:
message += ("Unexpected parametres: " +
", ".join(unexpected_parametres) +
if unexpected_parameters:
message += ("Unexpected parameters: " +
", ".join(unexpected_parameters) +
".")
raise KeyError("The parametres passed are different from the "
raise KeyError("The parameters passed are different from the "
"expected one." + message)
# TODO: We should also check that all parametres is from the right
# TODO: We should also check that all parameters is from the right
# type.
# We do the actual processing.
self._process(sed, parametres)
self._process(sed, parameters)
def get_module(name):
"""Get a SED creation module from its name
Parametres
Parameters
----------
module_name : string
The name of the module we want to get the class. This name can be
......
......@@ -26,7 +26,7 @@ class Module(common.SEDCreationModule):
"""
parametre_list = {
parameter_list = {
'alpha': (
'float',
"Alpha slope.",
......@@ -40,19 +40,19 @@ class Module(common.SEDCreationModule):
)
}
out_parametre_list = {'alpha': 'Alpha slope.'}
out_parameter_list = {'alpha': 'Alpha slope.'}
def _process(self, sed, parametres):
def _process(self, sed, parameters):
"""Add the IR re-emission contributions
Parametres
Parameters
----------
sed : pcigale.sed.SED object
parametres : dictionnary containing the parametres
parameters : dictionary containing the parameters
"""
alpha = parametres["alpha"]
extinction_value_names = parametres["extinction_value_names"]
alpha = parameters["alpha"]
extinction_value_names = parameters["extinction_value_names"]
# Get the template set out of the database
database = Database()
......@@ -64,7 +64,7 @@ class Module(common.SEDCreationModule):
# Base name for adding information to the SED.
name = self.name or 'dh2002_ir'
sed.add_module(name, parametres)
sed.add_module(name, parameters)
sed.add_info(name + '_alpha', alpha)
for extinction in extinction_value_names:
......
......@@ -22,7 +22,7 @@ class Module(common.SEDCreationModule):
"""
parametre_list = {
parameter_list = {
"redshift": (
'float',
"Redshift to apply to the galaxy.",
......@@ -36,23 +36,23 @@ class Module(common.SEDCreationModule):
),
"rtau": (
'float',
"Parametre which scale the tau value at each wavelength.",
"Parameter which scale the tau value at each wavelength.",
1.
)
}
def _process(self, sed, parametres):
def _process(self, sed, parameters):
"""Add the redshift + IGM attenuation effect to the SED
Parametres
Parameters
----------
sed : pcigale.sed.SED object
parametres : dictionnary
Dictionnary with the module parametres (redshift and rtau)
parameters : dictionary
Dictionary with the module parameters (redshift and rtau)
"""
if parametres['redshift'] == 0:
if parameters['redshift'] == 0:
# If redshift is 0, we do nothing
pass
else:
......@@ -60,14 +60,14 @@ class Module(common.SEDCreationModule):
lsstSed = lsst.Sed()
# First, we get the redshifted spectrum of the galaxy
wavelen, flambda = lsstSed.redshiftSED(parametres['redshift'],
parametres['dimming'],
wavelen, flambda = lsstSed.redshiftSED(parameters['redshift'],
parameters['dimming'],
sed.wavelength_grid,
sed.luminosity)
wavelen, red_l_lambda = lsstSed.addIGMattenuation(
parametres['redshift'],
parametres['rtau'],
parameters['redshift'],
parameters['rtau'],
wavelen=wavelen,
flambda=flambda
)
......@@ -86,10 +86,10 @@ class Module(common.SEDCreationModule):
# Base name for adding information to the SED.
name = self.name or 'igmattenuation'
sed.add_module(name, parametres)
sed.add_module(name, parameters)
sed.add_info(name + '_redshift', parametres['redshift'])
sed.add_info(name + '_rtau', parametres['rtau'])
sed.add_info(name + '_redshift', parameters['redshift'])
sed.add_info(name + '_rtau', parameters['rtau'])
sed.add_contribution(
name,
......
......@@ -20,7 +20,7 @@ class Module(common.SEDCreationModule):
"""
parametre_list = {