Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9,498 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://img.shields.io/pypi/pyversions/pharmpy-core https://codecov.io/gh/pharmpy/pharmpy/branch/main/graph/badge.svg?token=JZTHXXQPII

logo

https://pharmpy.github.io

Pharmpy is a library and toolkit for pharmacometrics. It can be used as a regular Python package, in R via the pharmr package or via its built in command line interface.

Current features:

  • A model abstraction as a foundation for higher level operations on models
  • Functions for manipulation of models, e.g. changing model components like elimination or absorption
  • Reading NONMEM models and results
  • Running models and complex workflows (with NONMEM or to some extent nlmixr)

Getting started

Installation

For installation in R see pharmr.

Install the latest stable version from PyPI:

pip install pharmpy-core    # or 'pip3 install' if that is your default python3 pip

To be able to use components using machine learning the tflite package is needed. It can be installed using:

pip install --index-url https://google-coral.github.io/py-repo/ tflite_runtime

Python Example

>>> from pharmpy.modeling import read_model, read_modelfit_results
>>> model = read_model("run1.mod")
>>> res = read_modelfit_results("run1.mod")
>>> res.parameter_estimates
THETA(1)      0.004696
THETA(2)      0.984258
THETA(3)      0.158920
OMEGA(1,1)    0.029351
OMEGA(2,2)    0.027906
SIGMA(1,1)    0.013241
Name: 2, dtype: float64
>>> model.parameters
       name     value  lower    upper    fix
   THETA(1)  0.004693   0.00  1000000  False
   THETA(2)  1.009160   0.00  1000000  False
   THETA(3)  0.100000  -0.99  1000000  False
 OMEGA(1,1)  0.030963   0.00       oo  False
 OMEGA(2,2)  0.031128   0.00       oo  False
 SIGMA(1,1)  0.013086   0.00       oo  False
>>>

CLI Example

# Get help
pharmpy -h

# Remove first ID from dataset and save new model using new dataset
pharmpy data filter run1.mod 'ID!=1'

# Extract and print ofvs from multiple model runs
pharmpy results ofv run*.mod

Contact

This is the team behind Pharmpy

Please ask a question in an issue or contact one of the maintainers if you have any questions.

Contributing

If you interested in contributing to Pharmpy, you can find more information under Contribute.

About

A library and toolkit for pharmacometrics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages