The default behavior for adding and solving with noisemodels has changed from Pastas 1.5. Find more information here


Model.add_stressmodel(stressmodel, replace=True)[source]#

Add a stressmodel to the main model.

  • stressmodel (pastas.stressmodel or list of pastas.stressmodel) – instance of a pastas.stressmodel class. Multiple stress models can be provided (e.g., ml.add_stressmodel([sm1, sm2]) in one call.

  • replace (bool, optional) – force replace the stressmodel if a stressmodel with the same name already exists. Not recommended but useful at times. Default is True.

Return type



To obtain a list of the stressmodel names, type:

>>> ml.get_stressmodel_names()


>>> sm = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress")
>>> ml.add_stressmodel(sm)

To add multiple stress models at once you can do the following:

>>> sm1 = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress1")
>>> sm2 = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress2")
>>> ml.add_stressmodel([sm1, sm2])