Skip to content

observables but not species supported in noiseFormula #29

Closed
@paulflang

Description

The documentations states that the noiseFormula in the observable table can be specified like so:
noiseParameter1_observable_pErk + noiseParameter2_observable_pErk*pErk

However, when I use a species in the observable formula, I get the following error:

TypeError                                 Traceback (most recent call last)
/media/sf_DPhil_Project/Project07_Parameter Fitting/PEtab/petab/calculate.py in evaluate_noise_formula(measurement, noise_formulas, parameter_df, simulation)
    187     try:
--> 188         noise_value = float(noise_value)
    189     except TypeError:

~/venvs/std/lib/python3.8/site-packages/sympy/core/expr.py in __float__(self)
    324             raise TypeError("can't convert complex to float")
--> 325         raise TypeError("can't convert expression to float")
    326 

TypeError: can't convert expression to float

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-11-8dc41b43303c> in <module>
     34 problem = core.DisFitProblem(PETAB_YAML)
     35 problem.write_jl_file()
---> 36 problem.optimize()
     37 problem.plot_results('c0', path='plot.pdf')
     38 problem.write_results()

/media/sf_DPhil_Project/Project07_Parameter Fitting/df_software/DisFit/DisFit/core.py in optimize(self)
    386         print(self.petab_problem.parameter_df)
    387 
--> 388         self._results['fval'] = -petab.calculate_llh(self.petab_problem.measurement_df.loc[:, cols],
    389             pd.concat([self.petab_problem.simulation_df.rename(columns={'measurement': 'simulation'}), ndf], axis=1),
    390             self.petab_problem.observable_df,

/media/sf_DPhil_Project/Project07_Parameter Fitting/PEtab/petab/calculate.py in calculate_llh(measurement_dfs, simulation_dfs, observable_dfs, parameter_dfs)
    272     for (measurement_df, simulation_df, observable_df, parameter_df) in zip(
    273             measurement_dfs, simulation_dfs, observable_dfs, parameter_dfs):
--> 274         _llh = calculate_llh_for_table(
    275             measurement_df, simulation_df, observable_df, parameter_df)
    276         llhs.append(_llh)

/media/sf_DPhil_Project/Project07_Parameter Fitting/PEtab/petab/calculate.py in calculate_llh_for_table(measurement_df, simulation_df, observable_df, parameter_df)
    314 
    315         # get noise standard deviation
--> 316         noise_value = evaluate_noise_formula(
    317             row, noise_formulas, parameter_df, petab.scale(simulation, scale))
    318 

/media/sf_DPhil_Project/Project07_Parameter Fitting/PEtab/petab/calculate.py in evaluate_noise_formula(measurement, noise_formulas, parameter_df, simulation)
    188         noise_value = float(noise_value)
    189     except TypeError:
--> 190         raise TypeError(
    191             f"Cannot replace all parameters in noise formula {noise_value} "
    192             f"for observable {observable_id}.")

TypeError: Cannot replace all parameters in noise formula 0.1*A + 0.5 for observable obs_a.

When I replace the species with an observable everything works fine.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions