Commit 39ee66b7 authored by Médéric Boquien's avatar Médéric Boquien

Rename ParametersHandler to ParametersManager to be consistent with new...

Rename ParametersHandler to ParametersManager to be consistent with new managers that will come in the near future.
parent a71a1db5
...@@ -9,7 +9,7 @@ import sys ...@@ -9,7 +9,7 @@ import sys
from .session.configuration import Configuration from .session.configuration import Configuration
from .analysis_modules import get_module from .analysis_modules import get_module
from .handlers.parameters_handler import ParametersHandler from .handlers.parameters_handler import ParametersManager
__version__ = "0.10.0" __version__ = "0.10.0"
...@@ -40,7 +40,7 @@ def check(config): ...@@ -40,7 +40,7 @@ def check(config):
if configuration: if configuration:
print("With this configuration cigale will compute {} " print("With this configuration cigale will compute {} "
"models.".format(ParametersHandler(configuration).size)) "models.".format(ParametersManager(configuration).size))
def run(config): def run(config):
......
...@@ -41,7 +41,7 @@ from .workers import sed as worker_sed ...@@ -41,7 +41,7 @@ from .workers import sed as worker_sed
from .workers import init_sed as init_worker_sed from .workers import init_sed as init_worker_sed
from .workers import init_analysis as init_worker_analysis from .workers import init_analysis as init_worker_analysis
from .workers import analysis as worker_analysis from .workers import analysis as worker_analysis
from ...handlers.parameters_handler import ParametersHandler from ...handlers.parameters_handler import ParametersManager
# Tolerance threshold under which any flux or error is considered as 0. # Tolerance threshold under which any flux or error is considered as 0.
...@@ -134,12 +134,12 @@ class PdfAnalysis(AnalysisModule): ...@@ -134,12 +134,12 @@ class PdfAnalysis(AnalysisModule):
z = np.array(conf['sed_modules_params']['redshifting']['redshift']) z = np.array(conf['sed_modules_params']['redshifting']['redshift'])
# The parameters handler allows us to retrieve the models parameters # The parameters manager allows us to retrieve the models parameters
# from a 1D index. This is useful in that we do not have to create # from a 1D index. This is useful in that we do not have to create
# a list of parameters as they are computed on-the-fly. It also has # a list of parameters as they are computed on-the-fly. It also has
# nice goodies such as finding the index of the first parameter to # nice goodies such as finding the index of the first parameter to
# have changed between two indices or the number of models. # have changed between two indices or the number of models.
params = ParametersHandler(conf) params = ParametersManager(conf)
n_params = params.size n_params = params.size
# Retrieve an arbitrary SED to obtain the list of output parameters # Retrieve an arbitrary SED to obtain the list of output parameters
......
...@@ -25,8 +25,8 @@ def init_sed(params, filters, analysed, fluxes, variables, t_begin, n_computed): ...@@ -25,8 +25,8 @@ def init_sed(params, filters, analysed, fluxes, variables, t_begin, n_computed):
Parameters Parameters
---------- ----------
params: ParametersHandler params: ParametersManager
Handles the parameters from a 1D index. Manages the parameters from a 1D index.
filters: List filters: List
Contains the names of the filters to compute the fluxes. Contains the names of the filters to compute the fluxes.
analysed: list analysed: list
...@@ -78,8 +78,8 @@ def init_analysis(params, filters, analysed, z, fluxes, variables, ...@@ -78,8 +78,8 @@ def init_analysis(params, filters, analysed, z, fluxes, variables,
Parameters Parameters
---------- ----------
params: ParametersHandler params: ParametersManager
Handles the parameters from a 1D index. Manages the parameters from a 1D index.
filters: list filters: list
Contains filters to compute the fluxes. Contains filters to compute the fluxes.
analysed: list analysed: list
......
...@@ -25,7 +25,7 @@ from .. import AnalysisModule ...@@ -25,7 +25,7 @@ from .. import AnalysisModule
from ..utils import save_fluxes from ..utils import save_fluxes
from .workers import init_fluxes as init_worker_fluxes from .workers import init_fluxes as init_worker_fluxes
from .workers import fluxes as worker_fluxes from .workers import fluxes as worker_fluxes
from ...handlers.parameters_handler import ParametersHandler from ...handlers.parameters_handler import ParametersManager
class SaveFluxes(AnalysisModule): class SaveFluxes(AnalysisModule):
...@@ -72,12 +72,12 @@ class SaveFluxes(AnalysisModule): ...@@ -72,12 +72,12 @@ class SaveFluxes(AnalysisModule):
name.endswith('_err')] name.endswith('_err')]
n_filters = len(filters) n_filters = len(filters)
# The parameters handler allows us to retrieve the models parameters # The parameters manager allows us to retrieve the models parameters
# from a 1D index. This is useful in that we do not have to create # from a 1D index. This is useful in that we do not have to create
# a list of parameters as they are computed on-the-fly. It also has # a list of parameters as they are computed on-the-fly. It also has
# nice goodies such as finding the index of the first parameter to # nice goodies such as finding the index of the first parameter to
# have changed between two indices or the number of models. # have changed between two indices or the number of models.
params = ParametersHandler(conf) params = ParametersManager(conf)
n_params = params.size n_params = params.size
info = conf['analysis_params']['variables'] info = conf['analysis_params']['variables']
......
...@@ -21,8 +21,8 @@ def init_fluxes(params, filters, save_sed, variables, fluxes, info, t_begin, ...@@ -21,8 +21,8 @@ def init_fluxes(params, filters, save_sed, variables, fluxes, info, t_begin,
Parameters Parameters
---------- ----------
params: ParametersHandler params: ParametersManager
Handles the parameters from a 1D index. Manages the parameters from a 1D index.
filters: List filters: List
Contains the names of the filters to compute the fluxes. Contains the names of the filters to compute the fluxes.
save_sed: boolean save_sed: boolean
...@@ -75,7 +75,7 @@ def fluxes(idx): ...@@ -75,7 +75,7 @@ def fluxes(idx):
---------- ----------
idx: int idx: int
Index of the model to retrieve its parameters from the parameters Index of the model to retrieve its parameters from the parameters
handler. manager.
""" """
global gbl_previous_idx, gbl_keys global gbl_previous_idx, gbl_keys
......
...@@ -9,14 +9,14 @@ import itertools ...@@ -9,14 +9,14 @@ import itertools
import numpy as np import numpy as np
from ..utils import read_table from ..utils import read_table
from ..warehouse import SedWarehouse
class ParametersManager(object):
class ParametersHandler(object): """Class to abstract the call to the relevant parameters manager depending
"""Class to abstract the call to the relevant parameters handler depending
how the physical parameters of the models are provided (directly in the how the physical parameters of the models are provided (directly in the
pcigale.ini file ). pcigale.ini file ).
A ParametersHandler allows to generate a list containing the parameters for A ParametersManager allows to generate a list containing the parameters for
a modules whose index is passed as an argument. It also allows to know what a modules whose index is passed as an argument. It also allows to know what
modules have changed their parameters given their indices. Because the modules have changed their parameters given their indices. Because the
order of the modules is optimised to minimise the computations, this allows order of the modules is optimised to minimise the computations, this allows
...@@ -25,13 +25,13 @@ class ParametersHandler(object): ...@@ -25,13 +25,13 @@ class ParametersHandler(object):
def __new__(object, configuration): def __new__(object, configuration):
if configuration['parameters_file']: if configuration['parameters_file']:
return ParametersHandlerFile(configuration) return ParametersManagerFile(configuration)
else: else:
return ParametersHandlerGrid(configuration) return ParametersManagerGrid(configuration)
class ParametersHandlerGrid(object): class ParametersManagerGrid(object):
"""Class to generate a parameters handler for a systematic grid using the """Class to generate a parameters manager for a systematic grid using the
parameters given in the pcigale.ini file.""" parameters given in the pcigale.ini file."""
def __init__(self, configuration): def __init__(self, configuration):
...@@ -134,8 +134,8 @@ class ParametersHandlerGrid(object): ...@@ -134,8 +134,8 @@ class ParametersHandlerGrid(object):
return len(self.shape) return len(self.shape)
class ParametersHandlerFile(object): class ParametersManagerFile(object):
"""Class to generate a parameters handler for list of parameters given in an """Class to generate a parameters manager for list of parameters given in an
input file.""" input file."""
def __init__(self, configuration): def __init__(self, configuration):
......
...@@ -14,7 +14,7 @@ from glob import glob # To allow the use of glob() in "eval..." ...@@ -14,7 +14,7 @@ from glob import glob # To allow the use of glob() in "eval..."
import numpy as np import numpy as np
import validate import validate
from ..handlers.parameters_handler import ParametersHandler from ..handlers.parameters_handler import ParametersManager
from ..data import Database from ..data import Database
from ..utils import read_table from ..utils import read_table
from .. import sed_modules from .. import sed_modules
...@@ -315,7 +315,7 @@ class Configuration(object): ...@@ -315,7 +315,7 @@ class Configuration(object):
configuration file and must be extracted from a dummy run.""" configuration file and must be extracted from a dummy run."""
if not self.config['analysis_params']['variables']: if not self.config['analysis_params']['variables']:
warehouse = SedWarehouse() warehouse = SedWarehouse()
params = ParametersHandler(self.config.dict()) params = ParametersManager(self.config.dict())
sed = warehouse.get_sed(params.modules, params.from_index(0)) sed = warehouse.get_sed(params.modules, params.from_index(0))
info = list(sed.info.keys()) info = list(sed.info.keys())
info.sort() info.sort()
......
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