Skip to main content

pycardiolib

pycardiolib is a python package used to solve various types of cardiac numerical models: monodomain, bidomain, bidomain with bath, epicardial source.

License: GPL2.0 or later Python

Submodules

Ionic models

The ionic submodule contains the following ionic models:

  • Mitchell-Schaeffer
  • Modified Mitchell-Schaeffer
  • Beeler-Reuter
  • ten Tusscher-Panfilov
  • BOCF

Mesh

A module to read and manipulate 2d and 3d meshes. Supported formats are:

  • vtk unstructured grid files
  • gmsh .msh files
  • medit .mesh files
  • triangle .ele and .node files

Models

The module that contains cardiac model implementations.

  • Monodomain
  • Bidomain
  • Bidomain with bath
  • Epicardial source
  • Extracellular-Membrane-Intracellular
  • Conductivity homogeneisation

A Poisson equation solver is also implemented.

Space discretization methods (sdm)

Several Finite Element and Volume methods are available:

  • Finite Element P1 Method (fem_p1)
  • Finite volumes Two-Point Flux Approximation Method (fvm_tpfa)
  • Discrete Duality Finite Volume Method (fvm_ddfv)

Time stepping methods (tsm)

Various methods are implemented:

  • Runge-Kutta
  • Rush-Larsen
  • Exponential Adam Bashforth (EAB)
  • Stiff Backward Differentiation (SBDF)

Documentation

The documentation can be found here.

Dependencies

Both gmsh and vtk python packages will be installed at pycardiolib installation. You may need to install extra Ubuntu modules to have them work properly.

License

pycardiolib is registered under a GPL v2 or later license.

Developer guide

Code

  • The code have been developed and tested with Python 3.11. You can build a development environment from requirement files.
  • Follow the pep8 style guide. Make sure your code is formatted according to this guide. You can use flake8 to help you. But do not use an automatic tool: it could lead to unwanted modifications on many files.
  • If implementing a new space discretization method, follow the naming convention fem/fvm_name.py

Doc

The documentation is build with pdoc3 following numpydoc style.

A local version of the html documentation pages can be built in the doc/ directory with the command pdoc3 --html --force --config show_source_code=False --config latex_math=True --config list_class_variables_in_index=False pycardiolib/.

Tests

  • Tests are done using pytest. They can be run under the root directory with the command: pytest
  • In order to test only one package, for instance mesh, simply run: pytest test/mesh
  • In order to run all tests except the long ones (such as convergence tests, but not only), use pytest -m "not long", or to manually run these tests, you can use: pytest -m "long"
  • In order to write convergence output files (txt, pdf and vtk), use: pytest --plot_conv True test/

Continuous Integration

  • On all branches, all tests that are not marked as 'long' are run for any push. Deselected tests are mostly convergence tests that take time to run.
  • If the commit string contains [ALL-TESTS], then all tests are run, including long tests.
  • On master only, the doc is build, using pdoc3

Metadata

Release files for pycardiolib 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycardiolib 1.0
File Size Uploaded
pycardiolib-1.0.tar.gz 82.7 kB Details

Release files / pycardiolib-1.0.tar.gz

Download URL pycardiolib-1.0.tar.gz
Size 82.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e6da61197f595ffc650b07cc85a2ba744e7ad919157c75726c9f0dfdea910793
BLAKE2b-256 checksum
How to use checksums
2db96902ff5844b626a337222f89cb4093e5dccce1a889fc498c4f248c3d0dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page