cli¶
The commands of a model.
A model package registers its commands in [project.scripts] with its model
object, e.g. for hctz:
run_hctz = "pkdb_models.models.hctz:MODEL.run_main"
fit_hctz = "pkdb_models.models.hctz:MODEL.fit_main"
report_hctz = "pkdb_models.models.hctz:MODEL.report_main"
identifiability_hctz = "pkdb_models.models.hctz:MODEL.identifiability_main"
run_<model> creates the models with the factory and runs the simulation
experiments:
run_hctz --action factory
run_hctz --action list_experiments
run_hctz --action simulate --experiments "misc,Anderson1961" --open
run_hctz --action all --results-dir /path/to/results
A single group is written into the directory of the group, any other selection
into custom_selection, both in the simulation folder of the results. The
output ends with the links to the report and to the figures.
fit_<model> fits the parameters of a fit problem and, with
--identifiability (the default of a model with fit_identifiability),
analyses the identifiability of the fitted parameters: the profile likelihood
of every fitted parameter and the Fisher information around the best parameter
set, which end up in the identifiability section of the report of the fit.
report_<model> and identifiability_<model> work on the parameters.json
of an earlier fit (sbmlsim.fit.cli.report_cli, identifiability_cli). All
write into the results of the model unless --output_dir is given.
Action
¶
Bases: StrEnum
The actions of the run command, pkpdsim.model.RUN_ACTIONS.
parse_formats
¶
Get the figure formats of a comma separated list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
the formats, e.g. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The formats in lower case, without blanks and empty entries. |
parse_workers
¶
Get the processes of a run from the option --workers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
|
required |
model
|
PKPDModel
|
the model. |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
The number of processes, |
Raises:
| Type | Description |
|---|---|
ValueError
|
for any other text. |
resolve_experiments
¶
Resolve the names of groups and experiments to the experiment classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
Mapping[str, Sequence[type[SimulationExperiment]]]
|
the groups of experiments of a model. |
required |
names
|
Sequence[str]
|
names of groups or of experiment classes. |
required |
Returns:
| Type | Description |
|---|---|
list[type[SimulationExperiment]]
|
The experiment classes, every class once in the order of the names, and |
list[str]
|
the names which are neither a group nor an experiment. |
run_command
¶
Run the action of the command line of run_<model>.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PKPDModel
|
the model. |
required |
args
|
Sequence[str] | None
|
the command line arguments, |
None
|
A failure of the simulations does not stop the command: the remaining
actions run, then the failures are printed and the command exits with 1.
An extra action gets the settings of the simulator of the run as
options.simulator: those of the model with the processes of --workers.
with_output_dir
¶
Add the output directory of the model to command line arguments.
The commands of sbmlsim.fit.cli write into the working directory by
default, a model writes into its results instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Sequence[str]
|
command line arguments without the program name. |
required |
output_dir
|
Path
|
output directory used if the arguments do not name one. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The arguments with the output directory in front of them. argparse keeps |
list[str]
|
the last value of an option, so an output directory in the arguments, |
list[str]
|
also an abbreviation like |
fit_parser
¶
Get the parser of the fit command of a model.
The fit arguments are those of sbmlsim.fit.cli.fit_cli, the
identifiability arguments are the settings of the profile likelihood which
follows the fit.
analyse_identifiability
¶
Analyse the identifiability of the parameters of a finished fit.
The profile likelihood is the exact answer and the Fisher information the cheap local one next to it; both are computed around the best parameter set of the fit and end up in the identifiability section of its report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
FitRun
|
finished fit whose best parameter set is analysed. |
required |
options
|
Namespace
|
command line arguments of |
required |
Returns:
| Type | Description |
|---|---|
tuple[IdentifiabilityResult | None, FisherInformation | None]
|
The profiles and the Fisher information, |
fit_command
¶
Run a fit of a model and analyse the identifiability of its parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PKPDModel
|
the model. |
required |
args
|
Sequence[str] | None
|
command line arguments, |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, FitRun]
|
The finished fits by optimization id. |
report_command
¶
Report stored parameter sets of a model (sbmlsim.fit.cli.report_cli).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PKPDModel
|
the model. |
required |
args
|
Sequence[str] | None
|
command line arguments, |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The directory of the report. |
identifiability_command
¶
Analyse the identifiability of stored parameters of a model.
See sbmlsim.fit.cli.identifiability_cli.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PKPDModel
|
the model. |
required |
args
|
Sequence[str] | None
|
command line arguments, |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The directory of the report. |