Metadata-Version: 2.1
Name: pycardiolib
Version: 1.0
Summary: A python package to run simulations in cardiac electrophysiology
Home-page: https://gitlab.inria.fr/carmen/pycardiolib
License: GPL-2.0-or-later
Platform: Linux
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26
Requires-Dist: vtk>=9.3
Requires-Dist: gmsh>=4.13
Requires-Dist: scipy>=1.12
Requires-Dist: PyYAML>=6

<!--
This file is originally part of pycardiolib.

Copyright (C) Inria Gwladys Ravon
Copyright (C) Université de Bordeaux Emma Lagracie
Copyright (C) Université de Bordeaux Lisl Weynans
Copyright (C) Université de Bordeaux Valentin Pannetier
Copyright (C) Université de Bordeaux Yves Coudière
Copyright (C) Université de Bordeaux Zeina Chehade

SPDX-License-Identifier: GPL-2.0-or-later
-->

# 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](https://img.shields.io/badge/License-GPL_2.0_or_later-blue.svg)
![Python](https://img.shields.io/badge/Python-3.11-green.svg)

[//]: # "and (later) the EMI micromodel."

## 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](https://carmen.gitlabpages.inria.fr/pycardiolib/).

## Dependencies
Both [gmsh](https://pypi.org/project/gmsh/4.13.1/) and [vtk](https://pypi.org/project/vtk/9.3.0/) 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
[//]: # "lien vers les sources."
* The code have been developed and tested with Python 3.11. You can build a development environment from requirement files.
* Follow the [pep8](https://peps.python.org/pep-0008/) style guide. Make sure your code is formatted according to this guide. You can use [flake8](https://flake8.pycqa.org/en/latest/) 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](https://pdoc3.github.io/pdoc/) following [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) 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](https://docs.pytest.org/en/7.2.x/contents.html). 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](https://pdoc3.github.io/pdoc/)
