Parameters#
- class pharmpy.model.Parameters(parameters=())[source]#
Bases:
Sequence
,Immutable
An immutable collection of parameters
Class representing a group of parameters. Usually all parameters in a model. This class give a ways of displaying, summarizing and manipulating more than one parameter at a time.
Specific parameters can be found using indexing on the parameter name
Example
>>> from pharmpy.model import Parameters, Parameter >>> par1 = Parameter("x", 0) >>> par2 = Parameter("y", 1) >>> pset = Parameters((par1, par2)) >>> pset["x"] Parameter("x", 0, lower=-∞, upper=∞, fix=False)
>>> "x" in pset True
Attributes Summary
Fixedness of parameters as dict
All fixed parameters
Initial estimates of parameters as dict
Lower bounds of all parameters as a dictionary
List of all parameter names
All non-fixed parameters
List of all parameter symbols
Upper bounds of all parameters as a dictionary
Methods Summary
create
([parameters])from_dict
(d)replace
(**kwargs)Replace properties and create a new Parameters object
set_fix
(fix)Create a new Parameters with changed fix state
set_initial_estimates
(inits)Create a new Parameters with changed initial estimates
Create a dataframe with a summary of all Parameters
to_dict
()Attributes Documentation
- fix#
Fixedness of parameters as dict
- fixed#
All fixed parameters
- inits#
Initial estimates of parameters as dict
- lower#
Lower bounds of all parameters as a dictionary
- names#
List of all parameter names
- nonfixed#
All non-fixed parameters
- symbols#
List of all parameter symbols
- upper#
Upper bounds of all parameters as a dictionary
Methods Documentation
- set_fix(fix)[source]#
Create a new Parameters with changed fix state
- Parameters:
fix (dict) – A dictionary of parameter names to boolean fix state
- Returns:
Parameters – An update Parameters object
- set_initial_estimates(inits)[source]#
Create a new Parameters with changed initial estimates
- Parameters:
inits (dict) – A dictionary of parameter names to initial estimates
- Returns:
Parameters – An update Parameters object
- to_dataframe()[source]#
Create a dataframe with a summary of all Parameters
- Returns:
DataFrame – A dataframe with one row per parameter. The columns are value, lower, upper and fix Row Index is the names
Example
>>> from pharmpy.model import Parameters, Parameter >>> par1 = Parameter("CL", 1, lower=0, upper=10) >>> par2 = Parameter("V", 10, lower=0, upper=100) >>> pset = Parameters((par1, par2)) >>> pset.to_dataframe() value lower upper fix CL 1 0 10 False V 10 0 100 False