Code Monkey home page Code Monkey logo

pkpd's People

Contributors

barnums avatar davaug avatar rebecca-rumney avatar simonmarchant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pkpd's Issues

set window size

_set_window_size

Method of the MainWindow class to set its window size.

Progress:

  • Implementation complete.
  • Fully tested.

Model unit read-in and dimensional analysis

Model units

Add a function to mmt read-in to grab param units and check that they are consistent. Requested Jan 15th.

Progress:

  • Read in units
  • Check units
  • Give preferred units

mainWindow._set_geometry

"_set_geometry"

"Function to add a layout to the main window."

Progress:

  • Implementation complete.
  • Fully tested.

Create MultiOutputModel class for MultiOutputProblem

MultiOutputModel Class

Extension of pints.ForwardModel for MultiOutputProblem. Changes to to SingleOutputModel are almost trivial and are mainly in the simulate method.

Progress:

  • Implementation complete.
  • Fully tested.

Minimal simulation tab

Minimal simulation tab

Create minimal simulation tab:

  • plot data
  • read parameter in model and allow for input of initial values
  • find optimal parameters upon pressing an inference button
  • display found parameters with stats somewhere
  • plot model solution into data figure

Progress:

  • Implementation complete.
  • Fully tested.

Model Class

Model Class

Adding functionality to model class

Progress:
Most functions copied over

  • Implementation complete.
  • Fully tested.

MCMC sampler

"Method or Function Name"

"Short description of the method/function."

Progress:

  • Implementation complete.
  • Fully tested.

Speed up the model solve method

model.solve()

The model class works properly but is too slow for useful inference times. This is likely because of unnecessary logs in the background of Myokit.

Currently solving the test one compartment model takes 0.745 sec.

more details:

>>> p = pstats.Stats('tests/model/profile_solve')
>>> p.sort_stats('cumulative').print_stats(50)
Wed Dec 18 12:19:03 2019    tests/model/profile_solve

         335637 function calls (324001 primitive calls) in 0.745 seconds

   Ordered by: cumulative time
   List reduced from 3297 to 50 due to restriction <50>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    676/1    0.005    0.000    0.746    0.746 {built-in method builtins.exec}
        1    0.000    0.000    0.746    0.746 tests/model/profile_solve.py:15(<module>)
        1    0.000    0.000    0.498    0.498 /Users/david/Workspace/sabs-r3/PKPD/PKPD/model/model.py:73(solve)
        1    0.000    0.000    0.487    0.487 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/myokit/_sim/cvodesim.py:82(__init__)
        1    0.000    0.000    0.486    0.486 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/myokit/_sim/__init__.py:88(_compile)
   507/21    0.000    0.000    0.410    0.020 <frozen importlib._bootstrap>:211(_call_with_frames_removed)
        1    0.000    0.000    0.339    0.339 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/__init__.py:142(setup)
        1    0.000    0.000    0.327    0.327 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py:57(setup)
        1    0.000    0.000    0.323    0.323 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:960(run_commands)
     10/2    0.000    0.000    0.323    0.162 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:970(run_command)
      8/5    0.000    0.000    0.322    0.064 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py:308(run_command)
        1    0.000    0.000    0.287    0.287 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py:128(run)
        1    0.000    0.000    0.285    0.285 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/command/build_ext.py:75(run)
        1    0.000    0.000    0.285    0.285 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:278(run)
        1    0.000    0.000    0.284    0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:443(build_extensions)
        1    0.000    0.000    0.284    0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:471(_build_extensions_serial)
        1    0.000    0.000    0.284    0.284 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/command/build_ext.py:193(build_extension)
        1    0.000    0.000    0.284    0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:486(build_extension)
   411/16    0.002    0.000    0.283    0.018 <frozen importlib._bootstrap>:978(_find_and_load)
   411/16    0.001    0.000    0.283    0.018 <frozen importlib._bootstrap>:948(_find_and_load_unlocked)
        2    0.000    0.000    0.282    0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py:909(spawn)
        2    0.000    0.000    0.282    0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py:16(spawn)
        2    0.000    0.000    0.282    0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py:88(_spawn_posix)
   387/20    0.001    0.000    0.280    0.014 <frozen importlib._bootstrap>:663(_load_unlocked)
        3    0.280    0.093    0.280    0.093 {built-in method posix.waitpid}
   325/19    0.001    0.000    0.279    0.015 <frozen importlib._bootstrap_external>:722(exec_module)
        1    0.000    0.000    0.243    0.243 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py:511(compile)
        1    0.000    0.000    0.242    0.242 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py:111(_compile)
   425/84    0.000    0.000    0.188    0.002 {built-in method builtins.__import__}
  371/368    0.001    0.000    0.158    0.000 <frozen importlib._bootstrap>:576(module_from_spec)
    41/39    0.000    0.000    0.151    0.004 <frozen importlib._bootstrap_external>:1040(create_module)
    41/39    0.150    0.004    0.151    0.004 {built-in method _imp.create_dynamic}

New execution time: 0.327 including initialization. Just solving the ODE after initialization is now much faster.

Progress:

  • Implementation complete.
  • Fully tested.

Find optimal parameters

find_optimal_parameter

Within the SingleOutputProblem class the find_optimal_parameter method finds a set of parameters that optimises a chosen objective function.

Progress:

  • Implementation complete.
  • Fully tested.

Data display and check boxes for user to clarify data structure

Data display and check boxes for user to clarify data structure

Data file is displayed in home tab, once selected and a first structural analysis is performed (are patient IDs/ dose schedule present. These properties are highlighted in the data display.

The presence of bespoken properties are identified by heuristic methods, are hence prone to errors. Thus check boxes are provided to enable the user to correct the heuristic tests.

Progress:

  • [x ] Implementation complete.
  • [ x] manually tested.

How to run the application

I've just tried to install and run the PKPD gui, pip install looked like it worked fine.

There wasn't any information on how to run the gui? I tried:

python PKPD/gui/mainWindow.py

and got the following error:

WARNING:myokit._config:Unable to auto-detect Sundials version.
WARNING:myokit._config:Sundials version not set in myokit.ini and version auto-detection failed.
Traceback (most recent call last):
  File "PKPD/gui/mainWindow.py", line 8, in <module>
    from PKPD.inference import inference as inf
  File "/home/mrobins/git/PKPD/PKPD/inference/inference.py", line 4, in <module>
    import pints
ModuleNotFoundError: No module named 'pints'

looks like pints isn't installed by setup.py. even though pints doesn't have a pip install route, you can add a url dependency to setup.py, see here: https://stackoverflow.com/questions/32688688/how-to-write-setup-py-to-include-a-git-repo-as-a-dependency

Inference options

Inference options

Allow bounded or non-bounded problems. Requested Jan 15th.

Progress:

  • Implementation complete.
  • Fully tested.

install PINTS with a setup.py

setup.py

"Create a setup.py that install PINTS and other dependencies."

Progress:

  • Implementation complete.
  • Fully tested.

MainWindow._set_tab_structure

_set_tab_structure

Sets up how the tab structure will work and look.

Progress:

  • Implementation complete.
  • Fully tested.

Catch common errors

Catch errors

Use try/except blocks to catch errors that we know are possible. Requested Jan 15th.

Progress:

  • Implementation complete.
  • Fully tested.

Travis install

Hi guys!

Few quick comments after looking at your travis config

  1. There's a lot of PINTS constants that you don't need (these lines can all go, I think)
  2. You have a very big requirements.txt file with "pinned" (version-specific) dependencies, not sure you need this!
  3. PINTS isn't pip installable yet, so you'll need to do something more complicated, e.g. adding this to your travis before_install bit: - pip install -e git://github.com/pints-team/pints.git#egg=pints
  4. There's no setup.py file, so pip install . won't do anything

Create MultiOutputProblem class

MultiOutputProblem class

In spirit the same as the SingleOutputProblem but now solving the ODEs with the MultiOutputModel and suited to infer parameters from higher dimensional models.

Progress:

  • Implementation complete.
  • Fully tested.

Create Model Repository and Refactor Code accordingly

Model Repository

"Create Model Repository in an easily generalizable manner. Update the Code to read-in those model files."

Progress:

  • Create 1-comparment model (bolus + subcut)
  • Update SingleOutput routine
  • Create 2-compartment model (bolus + subcut)
  • Update MultiOutput routine
  • Create 3-compartment model (bolus + subcut)
  • Create handler to choose the dimensionality of output and which compartments should be fitted and which be plotted. (Could by default choose centralCompartment for 1 dim data.)

Plot options

Plot options

Boundaries, logarithmic y-axis option. Requested Jan 15th.

Progress:

  • Implementation complete.
  • Fully tested.

Profile Model and Inference

Performance improvement

Within Myokit and Pints some methods perform, for our means, irrelevant checks and data type conversions, because we only allow interaction via GUI and thus have full control over data types.

We might be able to improve performance by copying the relevant functionality and leave out checks.

Progress:

  • Implementation complete.
  • Fully tested.

Minimal home tab

Minimal home tab

  • File dialog for the model & protocol .mmt file
  • File dialog for the data file
  • Button to forward to simulation tab.

Progress:

  • Implementation complete.
  • manually tested.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.