Commit 2b42fef0 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Clarify the description of the module parameters to ensure that the time grid...

Clarify the description of the module parameters to ensure that the time grid is correctly formatted and add a test to ensure this.
parent 2a63bbd4
......@@ -11,6 +11,7 @@
- When using the dustatt_calzleit module, choosing ẟ≠0 leads to an effective E(B-V) different from the one set by the user. Now the E(B-V) will always correspond to the one specified by the user. This means that at fixed E(B-V), A(V) depends on ẟ. (Médéric Boquien)
- The pcigale-mock tool has been merged into pcigale-plots; the mock plots can be obtained with the "mock" command.
- The sfhdelayed module is now initialised with _init_code() to be consistent with the way things are done in other modules. This should give a slight speedup under some sircumstances too. (Médéric Boquien)
- In sfhfromfile, the specification of the time grid was vague and therefore could lead to incorrect results if it was not properly formatted by the end user. The description has been clarified and we now check that the time starts from 0 and that the time step is always 1 Myr. If it is not the case we raise an exception. (Médéric Boquien)
### Fixed
- To estimate parameters in log, pcigale determines which variables end with the "_log" string and removed it to compute the models. However in some circumstances, it was overzealous. This has been fixed. (Médéric Boquien)
......@@ -34,19 +34,20 @@ class SfhFromFile(CreationModule):
("filename", (
"Name of the file containing the SFH. The first column must be "
"the time [Myr] and the other column must contain the SFR "
"the time in Myr, starting from 0 with a step of 1 Myr. The other
"columns must contain the SFR in Msun/yr."
("sfr_column", (
"List of column numbers where the star formation rates will "
"be read.",
"List of column indices of the SFR. The first SFR column has the "
"index 1.",
("age", (
"Age [Myr] where each SFH will be looked at.",
"Age in Myr at which the SFH will be looked at.",
("normalise", (
......@@ -68,7 +69,13 @@ class SfhFromFile(CreationModule):
filename = self.parameters['filename']
table = read_table(filename)
time_grid = table.columns[0].data
time_grid = table.columns[0].data.astype(
if time_grid[0] != 0:
raise Exception("The time grid must start from 0.")
if np.all(time_grid[1:]-time_grid[:-1] == 1) == False:
raise Exception("The time step must be 1 Myr. Computed models will "
"be wrong.")
sfr_column_number = int(self.parameters['sfr_column'])
sfr = table.columns[sfr_column_number].data.astype(np.float)
Supports Markdown
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