bump_model_number#

pharmpy.modeling.bump_model_number(model, path=None)[source]#

If the model name ends in a number increase it

If path is set increase the number until no file exists with the same name in path. If model name does not end in a number do nothing.

Parameters:
  • model (Model) – Pharmpy model object

  • path (Path in which to find next unique number) – Default is to not look for files.

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import bump_model_number, load_example_model
>>> model = load_example_model("pheno")
>>> model = model.replace(name="run2")
>>> model = bump_model_number(model)
>>> model.name
'run3'