parpe.misc

Various helper functions

Functions

compare_optimization_results_to_true_parameters(...)

Compare parameter estimates to true parameters.

concatenateStarts(a, b)

Concatenate two optimization trajectory matrices (numIteration x numStarts).

getConditionNames(filename)

getCorrTable(mes, sim[, ...])

Generate correlation table by observable

getCorrTableLegacy(simulationResults[, ...])

Generate correlation table by observable

getCostTrajectories(filename[, starts])

Read cost trajectory from HDF5 result file.

getCostTrajectory2(filename)

Read cost trajectory from file

getCostTrajectoryFromSummary(filename)

Read cost trajectory from file

getFinalCostFromSummary(filename)

Read final cost from file

get_amici_model(model_name[, model_dir])

Load AMICI model module with given name from given path and return a model instance

get_global_name_for_local_parameter(...)

Find a local SBML parameter in kinetic laws and return {reaction_id}_{local_parameter_id}

readSimulationsFromFile(filename)

Read result from simulations at final point from data file for all starts

readSimulationsFromFileLegacy(filename)

Read result from simulations at final point from data file for all starts Returns: (measure, simulated)[startString][nCondition, nTimepoints, nObservables]

simulation_to_df(mes_df, sim, result_file, ...)

Put simulation results in new PEtab simulation df based on PEtab measurement df mes_df: petab measurement dataframe on which optimization was based sim: simulation results obtained by readSimulationsFromFile() result_file: HDF5-file with optimization results (or input HDF5-file) start: start for which simulation results should be taken observable_ids: observable ids which should be considered root_path: root path to where group fixedParameters is saved in HDF5file

unique_ordered(seq)

Make unique, preserving order of first occurrence

Classes

ParameterEstimationResultFile()

Interface to a parPE parameter estimation result file

ParameterEstimationSummaryFile()

Interface to a parPE parameter estimation summary file as created with misc/extractMultiStartParameters.py

Functions

parpe.misc.compare_optimization_results_to_true_parameters(filename, start_idx='0')[source]

Compare parameter estimates to true parameters. Print as table.

Used in example notebooks.

Parameters:
  • filename (str) – Parameter estimation result file name

  • start_idx (str) – optimizer run index/name to use

parpe.misc.concatenateStarts(a, b)[source]

Concatenate two optimization trajectory matrices (numIteration x numStarts). Dimensions can be different for a and b.

parpe.misc.getConditionNames(filename)[source]
parpe.misc.getCorrTable(mes, sim, minimum_number_datapoints=0)[source]

Generate correlation table by observable

Parameters:
  • simulationResults – simulationResults as obtained from

  • parpe.readSimulationsFromFile

Returns:

ndarray with correlations of measurement and simulation for each start and observables in simulationResults

parpe.misc.getCorrTableLegacy(simulationResults, minimum_number_datapoints=0)[source]

Generate correlation table by observable

Old data format

Parameters:
  • simulationResults – simulationResults as obtained from

  • parpe.readSimulationsFromFile

Returns:

ndarray with correlations of measurement and simulation for each start and observables in simulationResults

parpe.misc.getCostTrajectories(filename, starts=None)[source]

Read cost trajectory from HDF5 result file.

Arguments: filename: result file name starts: list with indices or None meaning all starts

parpe.misc.getCostTrajectory2(filename)[source]

Read cost trajectory from file

#Arguments: #filename: HDF5 file as generated by misc/extractMultiStartParameters.py

Returns: ndarray(numIterations x numStarts): cost over iterations for all optimizations

parpe.misc.getCostTrajectoryFromSummary(filename)[source]

Read cost trajectory from file

Arguments: filename: HDF5 file as generated by misc/extractMultiStartParameters.py

Returns: ndarray(numIterations x numStarts): cost over iterations for all optimizations

parpe.misc.getFinalCostFromSummary(filename)[source]

Read final cost from file

Arguments: filename: HDF5 file as generated by misc/extractMultiStartParameters.py

Returns: ndarray(numStarts): cost at last iteration for all optimizations

parpe.misc.get_amici_model(model_name, model_dir=None)[source]

Load AMICI model module with given name from given path and return a model instance

Parameters:
  • model_name (str) – Name of the model module

  • model_dir (Optional[str]) – Path to directory containing the AMICI model module

Return type:

amici.Model

Returns:

The given model instance

parpe.misc.get_global_name_for_local_parameter(sbml_model, needle_parameter_id)[source]

Find a local SBML parameter in kinetic laws and return {reaction_id}_{local_parameter_id}

Return type:

Optional[str]

parpe.misc.readSimulationsFromFile(filename)[source]

Read result from simulations at final point from data file for all starts

Returns:

(measured, simulated, time, llh)[startString]

[nCondition][nTimepoints, nObservables]

parpe.misc.readSimulationsFromFileLegacy(filename)[source]

Read result from simulations at final point from data file for all starts Returns: (measure, simulated)[startString][nCondition, nTimepoints, nObservables]

parpe.misc.simulation_to_df(mes_df, sim, result_file, start, observable_ids, root_path='/')[source]

Put simulation results in new PEtab simulation df based on PEtab measurement df mes_df: petab measurement dataframe on which optimization was based sim: simulation results obtained by readSimulationsFromFile() result_file: HDF5-file with optimization results (or input HDF5-file) start: start for which simulation results should be taken observable_ids: observable ids which should be considered root_path: root path to where group fixedParameters is saved in HDF5file

parpe.misc.unique_ordered(seq)[source]

Make unique, preserving order of first occurrence

Parameters:

seq (Iterable[Any]) – any sequence

Return type:

List[Any]