Skip to content

edoardo100/timeactML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Learning activation and repolarization times with operator learning techniques

πŸ” Dataset details:

  • 2D case: iapps is a matrix of dimension N_DATA x 2, since we use the same pulse intensity and duration, we have saved only the x and y coordinate where the pulse is applied. actis instead is a matrix N_DATA x nno^2, where nno is the number of discretization points per dimension. Each dataset element is thus flattened.
  • 3D case: iapps is a matrix of dimension N_DATA x 49 x 49 x 9, since we use the same pulse intensity and duration, each data is a tensor with 1 where the pulse is applied, 0 where it is not applied. actis instead is a matrix N_DATA x 49 x 49 x 9. Each dataset element is thus flattened and coordinates for learning the operator mapping are applied.
  • 3D case unstructured: iapps is a matrix of dimension N_DATA x N x 3, where N is the number of nonzeros over the unstructured mesh node regarding the applied current. since we use the same pulse intensity and duration, each data is a tensor with 1 where the pulse is applied. actis instead is a matrix N_DATA x Nn x 3, where Nn is the number of nodes of the unstructured mesh

3D and 3D unstructured datasets available at https://zenodo.org/records/16913206

πŸ”§ Requirements:

numpy==1.26.4 scipy==1.10.1 matplotlib==3.8.0 PyYAML==6.0 torch==2.1.0

πŸ’» Usage:

  • FNO:

(Example for FNO_2D, the others are similar)

cd FNO/FNO_2D

To train a model:

python3 main_fno.py --config_file ../../saved_models/FNO_2D/paper_test_2D_001.yml

To plot results for a trained model and reproduce the results in the paper:

python3 recover_model.py --config_file ../../saved_models/FNO_2D/paper_test_2D_001.yml

  • KOL:

.yml files used for FNO are compatible also with KOL implementation. Since KOL training is fast and can be performed on a laptop, the implementation does not save the model by default. It is possible however to save the model weights with dump() or scipy.io.savemat() as shown in the commented parts if needed.

(Example for KOL_2D, the others are similar) python3 kol_activ_2d.py --config_file ../../saved_models/FNO_2D/paper_test_2D_002.yml

πŸ“ Notes:

In order to visualize results for the 3D unstructured case, you need Paraview installed on your machine.

saved_models folder contains only the best FNO trained models for each case presented in the paper. Other data or details are available upon request to the authors.

πŸ’‘ Cite this work:

Centofanti, Edoardo, Giovanni Ziarelli, Nicola Parolini, Simone Scacchi, Marco Verani, and Luca Franco Pavarino. "Learning cardiac activation and repolarization times with operator learning." arXiv preprint arXiv:2505.08631 (2025).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •