pymodelfit.core.get_model_instance

pymodelfit.core.get_model_instance(model, baseclass=None, nvarparams=1, **kwargs)[source]

Returns an instance of the supplied model - if the input is actually an instance of a model, the same instance will be passed in - otherwise, a new instance will be created.

Parameters:
  • model – A model name, model class, or model object.
  • baseclass (class or None) – If not None, ensures that the instance is a subclass of the provided base class.
  • nvarparams (int) – The number of parameters to cerate if the model is a variable parameter number model. Otherwise, this is ignored.

kwargs will either be passed into the new model constructor or applied as attributes to an already-existing model object.

Returns:An instance of the request model type
Raises ValueError:
 if the model is not a subclass of the baseclass

Previous topic

pymodelfit.core.get_model_class

Next topic

pymodelfit.core.offset_model

This Page