Commit dbd77d82 authored by Médéric Boquien's avatar Médéric Boquien

Remove the output_file and output_format parameters from the savefluxes...

Remove the output_file and output_format parameters from the savefluxes module. Now results are systematically saved as ASCII and FITS tables.
parent c474d7f2
......@@ -4,6 +4,7 @@
### Added
### Changed
- Various descriptions have been improved and clarified. (Médéric Boquien)
- The `output\_file` and `output\_format` parameters have been removed from the `savefluxes` module. They served little purpose and made the code more complex. The same strategy as for the `pdf\_analysis` modules is now adopted, saving the output both as FITS and ASCII tables. Old configuration file still work, with these two parameters simply ignored. (Médéric Boquien)
### Fixed
- With the new sanity check of the input parameters, cigale did not handle the fact that the redshift could be given in the parameters file. Now this is handled properly. (Médéric Boquien)
......
......@@ -47,22 +47,10 @@ class SaveFluxes(AnalysisModule):
"models).",
None
)),
("output_file", (
"string()",
"Name of the output file that contains the parameters of the "
"model(s) and the flux densities in the bands",
"computed_fluxes.txt"
)),
("save_sed", (
"boolean()",
"If True, save the generated spectrum for each model.",
False
)),
("output_format", (
"string()",
"Format of the output file. Any format supported by astropy.table "
"e.g. votable or ascii.",
"ascii"
))
])
......@@ -81,8 +69,6 @@ class SaveFluxes(AnalysisModule):
# Rename the output directory if it exists
backup_dir()
out_file = conf['analysis_params']['output_file']
out_format = conf['analysis_params']['output_format']
save_sed = conf['analysis_params']['save_sed']
filters = [name for name in conf['bands'] if not
......@@ -116,8 +102,7 @@ class SaveFluxes(AnalysisModule):
initargs=initargs) as pool:
pool.map(worker_fluxes, range(n_params))
save_fluxes(model_fluxes, model_parameters, filters, info, out_file,
out_format=out_format)
save_fluxes(model_fluxes, model_parameters, filters, info)
# AnalysisModule to be returned by get_module
Module = SaveFluxes
......@@ -36,8 +36,8 @@ def backup_dir(directory=OUT_DIR):
shutil.copyfile('pcigale.ini.spec', directory + 'pcigale.ini.spec')
def save_fluxes(model_fluxes, model_parameters, filters, names, filename,
directory=OUT_DIR, out_format='ascii.commented_header'):
def save_fluxes(model_fluxes, model_parameters, filters, names,
directory=OUT_DIR):
"""Save fluxes and associated parameters into a table.
Parameters
......@@ -50,12 +50,8 @@ def save_fluxes(model_fluxes, model_parameters, filters, names, filename,
Contains the filter names.
names: List
Contains the parameters names.
filename: str
Name under which the file should be saved.
directory: str
Directory under which the file should be saved.
out_format: str
Format of the output file
"""
out_fluxes = np.ctypeslib.as_array(model_fluxes[0])
......@@ -70,4 +66,6 @@ def save_fluxes(model_fluxes, model_parameters, filters, names, filename,
out_table.add_column(Column(np.arange(model_fluxes[1][0]), name='id'),
index=0)
out_table.write("{}/{}".format(directory, filename), format=out_format)
out_table.write("{}/computed_fluxes.fits".format(directory))
out_table.write("{}/computed_fluxes.txt".format(directory),
format='ascii.commented_header')
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