Model#

class Model(oseries, constant=True, noisemodel=True, name=None, metadata=None, freq='D')[source]#

Class that initiates a Pastas time series model.

Parameters
  • oseries (pandas.Series) – pandas.Series object containing the dependent time series. The observation can be non-equidistant.

  • constant (bool, optional) – Add a constant to the model (Default=True).

  • noisemodel (bool, optional) – Add the default noisemodel to the model. A custom noisemodel can be added later in the modelling process as well.

  • name (str, optional) – String with the name of the model, used in plotting and saving.

  • metadata (dict, optional) – Dictionary containing metadata of the oseries, passed on to the oseries when creating a pastas TimeSeries object. hence, ml.oseries.metadata will give you the metadata.

  • freq (str, optional) – String with the frequency the stressmodels are simulated. Must be one of the following: (D, h, m, s, ms, us, ns) or a multiple of that e.g. “7D”. Default is “D”. New in 0.18.0.

Returns

ml – Pastas Model instance, the base object in Pastas.

Return type

pastas.model.Model

Examples

A minimal working example of the Model class is shown below:

>>> oseries = pd.Series([1,2,1], index=pd.to_datetime(range(3), unit="D"))
>>> ml = Model(oseries)

Methods#

__init__

add_constant

Add a Constant to the time series Model.

add_noisemodel

Adds a noisemodel to the time series Model.

add_stressmodel

Add a stressmodel to the main model.

add_transform

Add a Transform to the time series Model.

copy

Method to copy a model.

del_constant

Method to safely delete the Constant from the Model.

del_noisemodel

Method to safely delete the noise model from the Model.

del_stressmodel

Method to safely delete a stress model from the Model.

del_transform

Method to safely delete the transform from the Model.

fit_report

Method that reports on the fit after a model is optimized.

get_block_response

Method to obtain the block response for a stressmodel.

get_contribution

Method to get the contribution of a stressmodel.

get_contributions

Method to get contributions of all stressmodels.

get_init_parameters

Method to get all initial parameters from the individual objects.

get_output_series

Method to get all the modeled output time series from the Model.

get_parameters

Method to obtain the parameters needed for calculation.

get_response_tmax

Method to get the tmax used for the response function.

get_step_response

Method to obtain the step response for a stressmodel.

get_stress

Method to obtain the stress(es) from the stressmodel.

get_stressmodel_names

Returns list of stressmodel names.

get_stressmodel_settings

Method to obtain the time series settings for a stress model.

get_tmax

Method that checks and returns valid values for tmax.

get_tmin

Method that checks and returns valid values for tmin.

get_transform_contribution

Method to get the contribution of a transform.

initialize

Method to initialize the model.

noise

Method to simulate the noise when a noisemodel is present.

noise_weights

Internal method to calculate the noise weights.

observations

Method that returns the observations series used for calibration.

residuals

Method to calculate the residual series.

set_parameter

Method to change the parameter properties.

simulate

Method to simulate the time series model.

solve

Method to solve the time series model.

to_dict

Method to export a model to a dictionary.

to_file

Method to save the Pastas model to a file.