estim8.datatypes#
This model defines the datatypes used to store simulated and experimental data in the estim8 package. Further it implements methods for calculation of discrepancy measures or statistical likelhoods.
- class estim8.datatypes.Constants#
Bases:
object- Attributes:
- SINGLE_ID
Methods
VALID_METRICS
- SINGLE_ID = None#
- VALID_METRICS#
alias of
Literal[‘SS’, ‘WSS’, ‘negLL’]
- class estim8.datatypes.Experiment(measurements: List[Measurement] | DataFrame, replicate_ID=None, errors: DataFrame = None, error_model: BaseErrorModel = <estim8.error_models.LinearErrorModel object>, observation_mapping: Dict[str, str] | None=None)#
Bases:
objectA class to represent an experiment.
- Attributes:
- measurementslist of Measurement
The measurements of the experiment.
- replicate_IDstr
The replicate ID of the experiment.
- observation_mappingdict of str to str
The mapping of observation names to measurement names.
Methods
__getitem__(name)
Gets the measurement with the given name.
getbysimkey(name)
Gets the measurement by the simulation key.
calculate_loss(simulation, metric)
Calculates the loss between the experiment and the simulation.
generate_mc_samples(n_samples)
Generates Monte Carlo samples from the experiment.
- calculate_loss(simulation: Simulation, metric: Literal['SS', 'WSS', 'negLL'] = 'SS') float#
Calculates the loss between the experiment and the simulation.
- Parameters:
- simulationSimulation
The simulation.
- metricstr, optional
The metric to use for calculating the loss (default is “SS”).
- Returns:
- float
The loss between the experiment and the simulation.
- generate_mc_samples(n_samples: int) List[Experiment]#
Generates Monte Carlo samples from the experiment.
- Parameters:
- n_samplesint
The number of samples to generate.
- Returns:
- list of Experiment
The generated samples.
- getbysimkey(name)#
Gets the measurement by the simulation key.
- Parameters:
- namestr
The simulation key.
- Returns:
- Measurement
The measurement with the given simulation key.
- class estim8.datatypes.Measurement(name, timepoints: array, values: array, replicate_ID: str | None = None, errors: array = None, error_model: BaseErrorModel = <estim8.error_models.LinearErrorModel object>)#
Bases:
TimeSeriesA class to represent a measurement, inheriting from TimeSeries.
- Attributes:
errorsnp.arrayGets the errors of the measurement.
- error_modelerror_models.BaseErrorModel
The error model used for the measurement.
Methods
get_loss(model_prediction, metric)
Calculates the loss between the measurement and the model prediction.
get_sampling(n_samples)
Generates samples from the measurement.
- property errors#
Gets the errors of the measurement.
- Returns:
- np.array
The errors of the measurement.
- get_loss(model_prediction: ModelPrediction, metric: Literal['SS', 'WSS', 'negLL'] = 'SS') float#
Calculates the loss between the measurement and the model prediction.
- Parameters:
- model_predictionModelPrediction
The model prediction.
- metricstr, optional
The metric to use for calculating the loss (default is “SS”).
- Returns:
- float
The loss between the measurement and the model prediction.
- Raises:
- NotImplementedError
If the metric is not supported.
- get_sampling(n_samples) List[Measurement]#
Generates samples from the measurement.
- Parameters:
- n_samplesint
The number of samples to generate.
- Returns:
- list of Measurement
The generated samples.
- class estim8.datatypes.ModelPrediction(name: str, timepoints: array, values: array, replicate_ID: str | None = None)#
Bases:
TimeSeriesA class to represent model predictions, inheriting from TimeSeries.
Methods
interpolate(measurement_timepoints)
Interpolates the model predictions to the given measurement timepoints.
- interpolate(measurement_timepoints: array) TimeSeries#
Interpolates the model predictions to the given measurement timepoints.
- Parameters:
- measurement_timepointsnp.array
The time points at which to interpolate the model predictions.
- Returns:
- TimeSeries
The interpolated model predictions.
- class estim8.datatypes.Simulation(simulation: Dict[str, array], replicate_ID: str | None = None)#
Bases:
objectA class to represent a simulation.
- Attributes:
- model_predictionslist of ModelPrediction
The model predictions for the simulation.
- replicate_IDstr
The replicate ID of the simulation.
Methods
__getitem__(name)
Gets the model prediction with the given name.
- class estim8.datatypes.TimeSeries(name: str, timepoints: array, values: array, replicate_ID: str | None = None)#
Bases:
objectA class to represent a time series.
- Attributes:
- namestr
The name of the time series.
- timepointsnp.array
The time points of the time series.
- valuesnp.array
The values of the time series.
- replicate_IDstr
The replicate ID of the time series.
Methods
_equal_shapes(array1, array2)
Checks if two arrays have equal shapes.
_get_mask()
Creates a mask for non-NaN values.
drop_nans()
Drops NaN values from timepoints and values.
- drop_nans()#
Drops NaN values from timepoints and values.