libcuflynx 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. libcuflynx-0.4.0/LICENSE +204 -0
  2. libcuflynx-0.4.0/PKG-INFO +266 -0
  3. libcuflynx-0.4.0/README.md +196 -0
  4. libcuflynx-0.4.0/pyproject.toml +304 -0
  5. libcuflynx-0.4.0/setup.cfg +4 -0
  6. libcuflynx-0.4.0/src/checks/__init__.py +11 -0
  7. libcuflynx-0.4.0/src/emulators/__init__.py +11 -0
  8. libcuflynx-0.4.0/src/generators/__init__.py +11 -0
  9. libcuflynx-0.4.0/src/libcuflynx/__init__.py +1 -0
  10. libcuflynx-0.4.0/src/libcuflynx/_deprecated_aliases.py +229 -0
  11. libcuflynx-0.4.0/src/libcuflynx/checks/LumpedModelChecks.py +112 -0
  12. libcuflynx-0.4.0/src/libcuflynx/checks/__init__.py +1 -0
  13. libcuflynx-0.4.0/src/libcuflynx/coupler/__init__.py +1 -0
  14. libcuflynx-0.4.0/src/libcuflynx/emulators/__init__.py +32 -0
  15. libcuflynx-0.4.0/src/libcuflynx/emulators/emulator_bundle.py +426 -0
  16. libcuflynx-0.4.0/src/libcuflynx/emulators/emulator_trainer.py +675 -0
  17. libcuflynx-0.4.0/src/libcuflynx/funcs/__init__.py +19 -0
  18. libcuflynx-0.4.0/src/libcuflynx/funcs/cost_funcs_user.py +269 -0
  19. libcuflynx-0.4.0/src/libcuflynx/funcs/modifier_funcs_user.py +43 -0
  20. libcuflynx-0.4.0/src/libcuflynx/funcs/operation_funcs_user.py +727 -0
  21. libcuflynx-0.4.0/src/libcuflynx/generators/CVSCellMLGenerator.py +2591 -0
  22. libcuflynx-0.4.0/src/libcuflynx/generators/CVSCppGenerator.py +3849 -0
  23. libcuflynx-0.4.0/src/libcuflynx/generators/Python1DModelFilesGenerator.py +741 -0
  24. libcuflynx-0.4.0/src/libcuflynx/generators/PythonGenerator.py +755 -0
  25. libcuflynx-0.4.0/src/libcuflynx/generators/__init__.py +0 -0
  26. libcuflynx-0.4.0/src/libcuflynx/generators/cppGeneratorTemplateFunctions.cpp +360 -0
  27. libcuflynx-0.4.0/src/libcuflynx/generators/main0dTemplate.cpp +193 -0
  28. libcuflynx-0.4.0/src/libcuflynx/generators/resources/BG_modules.cellml +21043 -0
  29. libcuflynx-0.4.0/src/libcuflynx/generators/resources/BG_modules_config.json +19569 -0
  30. libcuflynx-0.4.0/src/libcuflynx/generators/resources/FitzHugh_Nagumo_module_config.json +56 -0
  31. libcuflynx-0.4.0/src/libcuflynx/generators/resources/FitzHugh_Nagumo_modules.cellml +73 -0
  32. libcuflynx-0.4.0/src/libcuflynx/generators/resources/Lotka_Volterra_module_config.json +22 -0
  33. libcuflynx-0.4.0/src/libcuflynx/generators/resources/Lotka_Volterra_modules.cellml +64 -0
  34. libcuflynx-0.4.0/src/libcuflynx/generators/resources/TwoMinima_module_config.json +38 -0
  35. libcuflynx-0.4.0/src/libcuflynx/generators/resources/TwoMinima_modules.cellml +35 -0
  36. libcuflynx-0.4.0/src/libcuflynx/generators/resources/VanDerPol_module_config.json +19 -0
  37. libcuflynx-0.4.0/src/libcuflynx/generators/resources/VanDerPol_modules.cellml +55 -0
  38. libcuflynx-0.4.0/src/libcuflynx/generators/resources/base_script.cellml +13 -0
  39. libcuflynx-0.4.0/src/libcuflynx/generators/resources/boundary_condition_modules.cellml +592 -0
  40. libcuflynx-0.4.0/src/libcuflynx/generators/resources/boundary_condition_modules_config.json +234 -0
  41. libcuflynx-0.4.0/src/libcuflynx/generators/resources/cell_modules.cellml +6209 -0
  42. libcuflynx-0.4.0/src/libcuflynx/generators/resources/cell_modules_config.json +834 -0
  43. libcuflynx-0.4.0/src/libcuflynx/generators/resources/control_modules.cellml +2481 -0
  44. libcuflynx-0.4.0/src/libcuflynx/generators/resources/control_modules_config.json +783 -0
  45. libcuflynx-0.4.0/src/libcuflynx/generators/resources/control_system_modules.cellml +114 -0
  46. libcuflynx-0.4.0/src/libcuflynx/generators/resources/control_system_modules_config.json +45 -0
  47. libcuflynx-0.4.0/src/libcuflynx/generators/resources/coupling_modules.cellml +103 -0
  48. libcuflynx-0.4.0/src/libcuflynx/generators/resources/coupling_modules_config.json +241 -0
  49. libcuflynx-0.4.0/src/libcuflynx/generators/resources/delay_modules.cellml +80 -0
  50. libcuflynx-0.4.0/src/libcuflynx/generators/resources/delay_modules_config.json +29 -0
  51. libcuflynx-0.4.0/src/libcuflynx/generators/resources/diffusion_volume_modules.cellml +234 -0
  52. libcuflynx-0.4.0/src/libcuflynx/generators/resources/diffusion_volume_modules_config.json +70 -0
  53. libcuflynx-0.4.0/src/libcuflynx/generators/resources/elic_modules.cellml +1165 -0
  54. libcuflynx-0.4.0/src/libcuflynx/generators/resources/elic_modules_config.json +147 -0
  55. libcuflynx-0.4.0/src/libcuflynx/generators/resources/gas_exchange_modules.cellml +4130 -0
  56. libcuflynx-0.4.0/src/libcuflynx/generators/resources/gas_exchange_modules_config.json +561 -0
  57. libcuflynx-0.4.0/src/libcuflynx/generators/resources/heart_modules.cellml +11528 -0
  58. libcuflynx-0.4.0/src/libcuflynx/generators/resources/heart_modules_config.json +1040 -0
  59. libcuflynx-0.4.0/src/libcuflynx/generators/resources/input_stimulation_modules.cellml +184 -0
  60. libcuflynx-0.4.0/src/libcuflynx/generators/resources/input_stimulation_modules_config.json +83 -0
  61. libcuflynx-0.4.0/src/libcuflynx/generators/resources/ion_channel_modules.cellml +4268 -0
  62. libcuflynx-0.4.0/src/libcuflynx/generators/resources/ion_channel_modules_config.json +1210 -0
  63. libcuflynx-0.4.0/src/libcuflynx/generators/resources/lung_modules.cellml +2477 -0
  64. libcuflynx-0.4.0/src/libcuflynx/generators/resources/lung_modules_config.json +270 -0
  65. libcuflynx-0.4.0/src/libcuflynx/generators/resources/open_loop_modules.cellml +4552 -0
  66. libcuflynx-0.4.0/src/libcuflynx/generators/resources/open_loop_modules_config.json +165 -0
  67. libcuflynx-0.4.0/src/libcuflynx/generators/resources/parasympathetic_modules.cellml +1444 -0
  68. libcuflynx-0.4.0/src/libcuflynx/generators/resources/parasympathetic_modules_config.json +623 -0
  69. libcuflynx-0.4.0/src/libcuflynx/generators/resources/test_modules.cellml +143 -0
  70. libcuflynx-0.4.0/src/libcuflynx/generators/resources/test_modules_config.json +115 -0
  71. libcuflynx-0.4.0/src/libcuflynx/generators/resources/units.cellml +625 -0
  72. libcuflynx-0.4.0/src/libcuflynx/generators/resources/vessel_properties_modules.cellml +687 -0
  73. libcuflynx-0.4.0/src/libcuflynx/generators/resources/vessel_properties_modules_config.json +313 -0
  74. libcuflynx-0.4.0/src/libcuflynx/identifiabilty_analysis/__init__.py +1 -0
  75. libcuflynx-0.4.0/src/libcuflynx/identifiabilty_analysis/identifiabilityAnalysis.py +442 -0
  76. libcuflynx-0.4.0/src/libcuflynx/models/LumpedModels.py +27 -0
  77. libcuflynx-0.4.0/src/libcuflynx/models/__init__.py +0 -0
  78. libcuflynx-0.4.0/src/libcuflynx/param_id/__init__.py +1 -0
  79. libcuflynx-0.4.0/src/libcuflynx/param_id/aadc_backend.py +1038 -0
  80. libcuflynx-0.4.0/src/libcuflynx/param_id/casadi_backend.py +350 -0
  81. libcuflynx-0.4.0/src/libcuflynx/param_id/cost_kwargs.py +209 -0
  82. libcuflynx-0.4.0/src/libcuflynx/param_id/differentiable.py +70 -0
  83. libcuflynx-0.4.0/src/libcuflynx/param_id/external_funcs.py +99 -0
  84. libcuflynx-0.4.0/src/libcuflynx/param_id/fd_backend.py +173 -0
  85. libcuflynx-0.4.0/src/libcuflynx/param_id/fsa_backend.py +395 -0
  86. libcuflynx-0.4.0/src/libcuflynx/param_id/math_backend.py +209 -0
  87. libcuflynx-0.4.0/src/libcuflynx/param_id/modifier_funcs.py +155 -0
  88. libcuflynx-0.4.0/src/libcuflynx/param_id/operation_funcs.py +340 -0
  89. libcuflynx-0.4.0/src/libcuflynx/param_id/optimisers.py +1897 -0
  90. libcuflynx-0.4.0/src/libcuflynx/param_id/paramID.py +4435 -0
  91. libcuflynx-0.4.0/src/libcuflynx/param_id/plot_outputs.py +1268 -0
  92. libcuflynx-0.4.0/src/libcuflynx/param_id/pymc_backend.py +382 -0
  93. libcuflynx-0.4.0/src/libcuflynx/param_id/run_history.py +261 -0
  94. libcuflynx-0.4.0/src/libcuflynx/parsers/ModelParsers.py +613 -0
  95. libcuflynx-0.4.0/src/libcuflynx/parsers/OMEXParsers.py +421 -0
  96. libcuflynx-0.4.0/src/libcuflynx/parsers/PrimitiveParsers.py +4487 -0
  97. libcuflynx-0.4.0/src/libcuflynx/parsers/__init__.py +0 -0
  98. libcuflynx-0.4.0/src/libcuflynx/protocol_runners/__init__.py +11 -0
  99. libcuflynx-0.4.0/src/libcuflynx/protocol_runners/protocol_executor.py +196 -0
  100. libcuflynx-0.4.0/src/libcuflynx/protocol_runners/protocol_runner.py +226 -0
  101. libcuflynx-0.4.0/src/libcuflynx/scripts/__init__.py +1 -0
  102. libcuflynx-0.4.0/src/libcuflynx/scripts/_cli.py +99 -0
  103. libcuflynx-0.4.0/src/libcuflynx/scripts/convert_0d_to_1d.py +148 -0
  104. libcuflynx-0.4.0/src/libcuflynx/scripts/example_data/example_data_for_conversion.csv +1802 -0
  105. libcuflynx-0.4.0/src/libcuflynx/scripts/example_format_obs_data_json_file.py +119 -0
  106. libcuflynx-0.4.0/src/libcuflynx/scripts/generate_modules_files.py +479 -0
  107. libcuflynx-0.4.0/src/libcuflynx/scripts/generate_obs_json.py +72 -0
  108. libcuflynx-0.4.0/src/libcuflynx/scripts/generate_omex_analysis_script.py +337 -0
  109. libcuflynx-0.4.0/src/libcuflynx/scripts/heart_paper_plots.py +483 -0
  110. libcuflynx-0.4.0/src/libcuflynx/scripts/identifiability_run_script.py +96 -0
  111. libcuflynx-0.4.0/src/libcuflynx/scripts/param_id_run_script.py +180 -0
  112. libcuflynx-0.4.0/src/libcuflynx/scripts/plot_param_id_script.py +171 -0
  113. libcuflynx-0.4.0/src/libcuflynx/scripts/read_and_insert_parameters.py +75 -0
  114. libcuflynx-0.4.0/src/libcuflynx/scripts/run_multiple_param_id.py +188 -0
  115. libcuflynx-0.4.0/src/libcuflynx/scripts/script_generate_with_new_architecture.py +293 -0
  116. libcuflynx-0.4.0/src/libcuflynx/scripts/sensitivity_analysis_run_script.py +47 -0
  117. libcuflynx-0.4.0/src/libcuflynx/scripts/sequential_param_id_run_script.py +138 -0
  118. libcuflynx-0.4.0/src/libcuflynx/scripts/train_emulator_run_script.py +66 -0
  119. libcuflynx-0.4.0/src/libcuflynx/sensitivity_analysis/__init__.py +1 -0
  120. libcuflynx-0.4.0/src/libcuflynx/sensitivity_analysis/sensitivityAnalysis.py +492 -0
  121. libcuflynx-0.4.0/src/libcuflynx/sensitivity_analysis/sobolSA.py +884 -0
  122. libcuflynx-0.4.0/src/libcuflynx/solver1d/Make_files/Makefile +46 -0
  123. libcuflynx-0.4.0/src/libcuflynx/solver1d/Make_files/MakefilePETSC +59 -0
  124. libcuflynx-0.4.0/src/libcuflynx/solver1d/Make_files/runCVODE.bash +15 -0
  125. libcuflynx-0.4.0/src/libcuflynx/solver1d/Make_files/runPETSc.bash +11 -0
  126. libcuflynx-0.4.0/src/libcuflynx/solver1d/__init__.py +1 -0
  127. libcuflynx-0.4.0/src/libcuflynx/solver1d/auxCouplingFunctions.py +891 -0
  128. libcuflynx-0.4.0/src/libcuflynx/solver1d/auxPipeFunctions.py +95 -0
  129. libcuflynx-0.4.0/src/libcuflynx/solver1d/bcs.py +59 -0
  130. libcuflynx-0.4.0/src/libcuflynx/solver1d/main1D.py +1441 -0
  131. libcuflynx-0.4.0/src/libcuflynx/solver1d/model.py +2430 -0
  132. libcuflynx-0.4.0/src/libcuflynx/solver1d/numerics.py +604 -0
  133. libcuflynx-0.4.0/src/libcuflynx/solver1d/vessel.py +206 -0
  134. libcuflynx-0.4.0/src/libcuflynx/solver1d/windkessel.py +699 -0
  135. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/__init__.py +302 -0
  136. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/aadc_python_solver_helper.py +1787 -0
  137. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/casadi_python_solver_helper.py +839 -0
  138. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/emulator_solver_helper.py +322 -0
  139. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/external_simulation_helper.py +591 -0
  140. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/myokit_helper.py +1528 -0
  141. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/name_resolver.py +184 -0
  142. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/opencor_helper.py +387 -0
  143. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/param_grouping.py +56 -0
  144. libcuflynx-0.4.0/src/libcuflynx/solver_wrappers/python_solver_helper.py +457 -0
  145. libcuflynx-0.4.0/src/libcuflynx/utilities/__init__.py +0 -0
  146. libcuflynx-0.4.0/src/libcuflynx/utilities/casadi_solver_diagnostics.py +378 -0
  147. libcuflynx-0.4.0/src/libcuflynx/utilities/diagnostics.py +117 -0
  148. libcuflynx-0.4.0/src/libcuflynx/utilities/elic_run.py +56 -0
  149. libcuflynx-0.4.0/src/libcuflynx/utilities/libcellml_helper_funcs.py +160 -0
  150. libcuflynx-0.4.0/src/libcuflynx/utilities/libcellml_utilities.py +271 -0
  151. libcuflynx-0.4.0/src/libcuflynx/utilities/mpi_utils.py +362 -0
  152. libcuflynx-0.4.0/src/libcuflynx/utilities/obs_data_helpers.py +265 -0
  153. libcuflynx-0.4.0/src/libcuflynx/utilities/package_resources.py +117 -0
  154. libcuflynx-0.4.0/src/libcuflynx/utilities/paperPlotSetup.py +60 -0
  155. libcuflynx-0.4.0/src/libcuflynx/utilities/params_for_id_helpers.py +79 -0
  156. libcuflynx-0.4.0/src/libcuflynx/utilities/paths.py +145 -0
  157. libcuflynx-0.4.0/src/libcuflynx/utilities/plot_generated_model_outputs.py +79 -0
  158. libcuflynx-0.4.0/src/libcuflynx/utilities/protocol_funcs.py +98 -0
  159. libcuflynx-0.4.0/src/libcuflynx/utilities/protocol_shapes.py +435 -0
  160. libcuflynx-0.4.0/src/libcuflynx/utilities/stat_distributions.py +35 -0
  161. libcuflynx-0.4.0/src/libcuflynx/utilities/utility_funcs.py +528 -0
  162. libcuflynx-0.4.0/src/libcuflynx.egg-info/PKG-INFO +266 -0
  163. libcuflynx-0.4.0/src/libcuflynx.egg-info/SOURCES.txt +249 -0
  164. libcuflynx-0.4.0/src/libcuflynx.egg-info/dependency_links.txt +1 -0
  165. libcuflynx-0.4.0/src/libcuflynx.egg-info/entry_points.txt +8 -0
  166. libcuflynx-0.4.0/src/libcuflynx.egg-info/requires.txt +60 -0
  167. libcuflynx-0.4.0/src/libcuflynx.egg-info/top_level.txt +12 -0
  168. libcuflynx-0.4.0/src/models/__init__.py +11 -0
  169. libcuflynx-0.4.0/src/param_id/__init__.py +11 -0
  170. libcuflynx-0.4.0/src/parsers/__init__.py +11 -0
  171. libcuflynx-0.4.0/src/protocol_runners/__init__.py +11 -0
  172. libcuflynx-0.4.0/src/scripts/__init__.py +11 -0
  173. libcuflynx-0.4.0/src/sensitivity_analysis/__init__.py +11 -0
  174. libcuflynx-0.4.0/src/solver_wrappers/__init__.py +11 -0
  175. libcuflynx-0.4.0/src/utilities/__init__.py +11 -0
  176. libcuflynx-0.4.0/tests/test_UQ.py +244 -0
  177. libcuflynx-0.4.0/tests/test_aadc_conditionals.py +186 -0
  178. libcuflynx-0.4.0/tests/test_aadc_coupled_pipeline.py +295 -0
  179. libcuflynx-0.4.0/tests/test_aadc_solvers.py +410 -0
  180. libcuflynx-0.4.0/tests/test_aadc_vs_casadi_3compartment.py +757 -0
  181. libcuflynx-0.4.0/tests/test_autogeneration.py +350 -0
  182. libcuflynx-0.4.0/tests/test_backend_import_errors.py +181 -0
  183. libcuflynx-0.4.0/tests/test_benchmarks.py +269 -0
  184. libcuflynx-0.4.0/tests/test_casadi_conditionals.py +197 -0
  185. libcuflynx-0.4.0/tests/test_cellml_connection_uniqueness.py +184 -0
  186. libcuflynx-0.4.0/tests/test_collect_only_no_summary_wait.py +74 -0
  187. libcuflynx-0.4.0/tests/test_console_entry_points.py +334 -0
  188. libcuflynx-0.4.0/tests/test_cost_kwargs.py +137 -0
  189. libcuflynx-0.4.0/tests/test_cost_weight_indexing.py +183 -0
  190. libcuflynx-0.4.0/tests/test_csv_header_parsing.py +90 -0
  191. libcuflynx-0.4.0/tests/test_dependency_extras.py +402 -0
  192. libcuflynx-0.4.0/tests/test_deprecated_flat_imports.py +317 -0
  193. libcuflynx-0.4.0/tests/test_distribution_ground_truth.py +307 -0
  194. libcuflynx-0.4.0/tests/test_docs_consistency.py +185 -0
  195. libcuflynx-0.4.0/tests/test_emulator_settings.py +365 -0
  196. libcuflynx-0.4.0/tests/test_emulator_solver_helper.py +429 -0
  197. libcuflynx-0.4.0/tests/test_emulator_training.py +658 -0
  198. libcuflynx-0.4.0/tests/test_error_vector_names.py +82 -0
  199. libcuflynx-0.4.0/tests/test_external_simulation_helper.py +760 -0
  200. libcuflynx-0.4.0/tests/test_external_user_funcs.py +410 -0
  201. libcuflynx-0.4.0/tests/test_fd_observable_sensitivities.py +447 -0
  202. libcuflynx-0.4.0/tests/test_flattened_cellml_naming.py +85 -0
  203. libcuflynx-0.4.0/tests/test_fsa_analytic_accuracy.py +311 -0
  204. libcuflynx-0.4.0/tests/test_fsa_grouped_sensitivities.py +266 -0
  205. libcuflynx-0.4.0/tests/test_ga_objective_and_selection.py +198 -0
  206. libcuflynx-0.4.0/tests/test_ga_population.py +68 -0
  207. libcuflynx-0.4.0/tests/test_generate_modules_files.py +124 -0
  208. libcuflynx-0.4.0/tests/test_grouped_params.py +120 -0
  209. libcuflynx-0.4.0/tests/test_heat_fenics_example.py +750 -0
  210. libcuflynx-0.4.0/tests/test_issue_fixes.py +309 -0
  211. libcuflynx-0.4.0/tests/test_laplace_identifiability.py +197 -0
  212. libcuflynx-0.4.0/tests/test_libcellml_shims.py +118 -0
  213. libcuflynx-0.4.0/tests/test_manual_marker.py +132 -0
  214. libcuflynx-0.4.0/tests/test_mcmc_chain_checkpoints.py +264 -0
  215. libcuflynx-0.4.0/tests/test_mcmc_statistics.py +262 -0
  216. libcuflynx-0.4.0/tests/test_modifier_backend_equivalence.py +320 -0
  217. libcuflynx-0.4.0/tests/test_modifier_funcs.py +338 -0
  218. libcuflynx-0.4.0/tests/test_mpi_utils.py +295 -0
  219. libcuflynx-0.4.0/tests/test_myokit_import_race.py +92 -0
  220. libcuflynx-0.4.0/tests/test_myokit_import_race_live.py +162 -0
  221. libcuflynx-0.4.0/tests/test_next_sub_release_asks.py +326 -0
  222. libcuflynx-0.4.0/tests/test_no_writes_into_package.py +393 -0
  223. libcuflynx-0.4.0/tests/test_obs_data_conventions.py +112 -0
  224. libcuflynx-0.4.0/tests/test_omex_analysis_pipeline.py +180 -0
  225. libcuflynx-0.4.0/tests/test_operation_kwargs.py +436 -0
  226. libcuflynx-0.4.0/tests/test_package_resources.py +171 -0
  227. libcuflynx-0.4.0/tests/test_package_syntax.py +147 -0
  228. libcuflynx-0.4.0/tests/test_param_id.py +5385 -0
  229. libcuflynx-0.4.0/tests/test_param_id_model_type.py +40 -0
  230. libcuflynx-0.4.0/tests/test_param_modifiers.py +303 -0
  231. libcuflynx-0.4.0/tests/test_param_priors.py +520 -0
  232. libcuflynx-0.4.0/tests/test_params_for_id_json.py +223 -0
  233. libcuflynx-0.4.0/tests/test_protocol_funcs.py +363 -0
  234. libcuflynx-0.4.0/tests/test_protocol_shapes.py +590 -0
  235. libcuflynx-0.4.0/tests/test_protocol_state_continuity.py +183 -0
  236. libcuflynx-0.4.0/tests/test_release_workflow.py +206 -0
  237. libcuflynx-0.4.0/tests/test_scipy_ode_example.py +272 -0
  238. libcuflynx-0.4.0/tests/test_sensitivity_analysis.py +458 -0
  239. libcuflynx-0.4.0/tests/test_solver_info_validation.py +1795 -0
  240. libcuflynx-0.4.0/tests/test_solvers.py +1884 -0
  241. libcuflynx-0.4.0/tests/test_tmpdir_independence.py +67 -0
  242. libcuflynx-0.4.0/tests/test_unit_conversion.py +259 -0
  243. libcuflynx-0.4.0/tests/test_uq_cost_funcs.py +152 -0
  244. libcuflynx-0.4.0/tests/test_uq_diagnostics.py +194 -0
  245. libcuflynx-0.4.0/tests/test_uq_equal_weights.py +163 -0
  246. libcuflynx-0.4.0/tests/test_uq_on_emulator.py +370 -0
  247. libcuflynx-0.4.0/tests/test_uq_posterior_plots.py +247 -0
  248. libcuflynx-0.4.0/tests/test_uq_pymc_backend.py +178 -0
  249. libcuflynx-0.4.0/tests/test_uq_pymc_live_chain.py +384 -0
  250. libcuflynx-0.4.0/tests/test_uq_pymc_mpi.py +334 -0
  251. libcuflynx-0.4.0/tests/test_user_inputs_archive.py +51 -0
@@ -0,0 +1,204 @@
1
+ Copyright 2024–2026 Finbar J. Argus
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: libcuflynx
3
+ Version: 0.4.0
4
+ Summary: Generation and calibration of CellML circulatory system models from module/vessel arrays
5
+ Author: Finbar J. Argus
6
+ License: Apache-2.0
7
+ Keywords: cellml,circulatory,modeling,parameter-identification
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: numpy>=1.19.0
20
+ Requires-Dist: pandas>=1.3.0
21
+ Requires-Dist: scipy>=1.7.0
22
+ Requires-Dist: pyyaml>=5.4.0
23
+ Requires-Dist: libcellml<0.7.0,>=0.6.3
24
+ Requires-Dist: myokit>=1.39.1
25
+ Requires-Dist: matplotlib>=3.3.0
26
+ Requires-Dist: seaborn>=0.11.0
27
+ Requires-Dist: SALib==1.5.1
28
+ Requires-Dist: rdflib>=5.0.0
29
+ Requires-Dist: emcee>=3.0.0
30
+ Requires-Dist: corner>=2.2.0
31
+ Requires-Dist: pint>=0.18
32
+ Requires-Dist: numdifftools>=0.9.0
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: tqdm>=4.62.0
35
+ Requires-Dist: nevergrad>=1.0.12
36
+ Requires-Dist: statsmodels>=0.12.0
37
+ Provides-Extra: mpi
38
+ Requires-Dist: mpi4py>=3.0.0; extra == "mpi"
39
+ Requires-Dist: schwimmbad>=0.3.0; extra == "mpi"
40
+ Provides-Extra: casadi
41
+ Requires-Dist: casadi>=3.7.2; extra == "casadi"
42
+ Provides-Extra: uq
43
+ Requires-Dist: pymc>=5.0; extra == "uq"
44
+ Requires-Dist: arviz>=0.15; extra == "uq"
45
+ Provides-Extra: emulation
46
+ Requires-Dist: autoemulate<3,>=2.1; extra == "emulation"
47
+ Provides-Extra: cpp
48
+ Provides-Extra: dev
49
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
50
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
51
+ Requires-Dist: pytest-mpi>=0.6.0; extra == "dev"
52
+ Requires-Dist: pytest-xdist>=2.5.0; extra == "dev"
53
+ Requires-Dist: black>=22.0.0; extra == "dev"
54
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
55
+ Requires-Dist: mypy>=0.950; extra == "dev"
56
+ Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
57
+ Requires-Dist: libcuflynx[mpi]; extra == "dev"
58
+ Requires-Dist: libcuflynx[casadi]; extra == "dev"
59
+ Provides-Extra: docs
60
+ Requires-Dist: mkdocs-material>=9.0; extra == "docs"
61
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
62
+ Requires-Dist: black>=22.0.0; extra == "docs"
63
+ Provides-Extra: all
64
+ Requires-Dist: libcuflynx[mpi]; extra == "all"
65
+ Requires-Dist: libcuflynx[casadi]; extra == "all"
66
+ Requires-Dist: libcuflynx[uq]; extra == "all"
67
+ Requires-Dist: libcuflynx[emulation]; extra == "all"
68
+ Requires-Dist: libcuflynx[cpp]; extra == "all"
69
+ Dynamic: license-file
70
+
71
+ # Overview
72
+
73
+ [![Tests](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml/badge.svg?branch=master&event=push)](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml)
74
+
75
+ This project allows the generation and calibration of cellml (and soon to be more) circulatory system models from an array of module/vessel names and connections.
76
+
77
+ **The repository is `circulatory_autogen`; the package it installs is `libcuflynx`.** They are the
78
+ same project under two names: papers, issues and this repository say *circulatory_autogen*, while
79
+ PyPI, `pip install` and every `import` say *libcuflynx*. Searching for either name should find you
80
+ this page.
81
+
82
+ > **Note:** Test results and pass percentage are displayed in the [GitHub Actions workflow summary](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml). The badge above shows the overall test status (passing/failing) for `master` of this repository, which is where pull requests are merged.
83
+
84
+ # Installing, and what each extra costs
85
+
86
+ The package is `libcuflynx`. A plain install gives you generation, simulation, calibration,
87
+ sensitivity analysis and the built-in (emcee) MCMC:
88
+
89
+ ```
90
+ pip install libcuflynx
91
+ ```
92
+
93
+ Everything beyond that is an extra, because the optional parts are not small. These are
94
+ installed sizes on disk, not wheel sizes — measured by installing into a fresh venv on Linux
95
+ and taking `du` of `site-packages`, so they include the shared libraries that show up as
96
+ companion directories (`scipy.libs`, `numpy.libs`) and every transitive dependency:
97
+
98
+ | install | on disk | what it buys |
99
+ |---|---|---|
100
+ | `libcuflynx` | **≈ 540 MB** | generation, simulation, calibration, Sobol SA, emcee MCMC, Laplace identifiability |
101
+ | `libcuflynx[mpi]` | **+5 MB**, and a system MPI toolchain | multi-rank runs under `mpiexec` |
102
+ | `libcuflynx[casadi]` | **+221 MB** | `model_type: casadi_python`, `solver: casadi_integrator`, symbolic AD gradients |
103
+ | `libcuflynx[uq]` | **+65 MB** | the pyMC sampler (`UQ_options: library: pymc`) |
104
+ | `libcuflynx[emulation]` | **+750 MB or more** | training and using surrogate models (`do_emulation` / `use_emulator`) |
105
+ | `libcuflynx[cpp]` | +0 MB | `model_type: cpp` — needs a C++ toolchain, which pip cannot install |
106
+ | `libcuflynx[all]` | **≈ 1.6 GB** | all of the above |
107
+
108
+ `[emulation]` is the one to think about before typing: `autoemulate` pulls in **torch**, which
109
+ is 734 MB on its own — more than the whole default install — and requires Python >=3.10,<3.13.
110
+ On Linux, pip's default torch wheel also drags in the bundled NVIDIA CUDA libraries, which can
111
+ take it past 2 GB; install a CPU-only torch first if you do not want them. Because `[all]`
112
+ includes `[emulation]`, `[all]` inherits that Python range too.
113
+
114
+ The per-package numbers below do not add up to the total: the long tail of small transitive
115
+ dependencies (packaging, dateutil, six, typing-extensions, cycler, joblib, threadpoolctl, ...)
116
+ accounts for the rest.
117
+
118
+ What makes up the default install: scipy 109 (+27 in `scipy.libs`), pandas 65, statsmodels 49,
119
+ scikit-learn 46, numpy 41 (+27 in `numpy.libs`), matplotlib 28 with fontTools 25 / pillow 21,
120
+ myokit 13, lxml 12, libcellml 8, kiwisolver 7, nevergrad 5, SALib 5, rdflib 5, libcuflynx
121
+ itself 4, pint 3, seaborn 3, and emcee / corner / tqdm / numdifftools at about 1 MB each.
122
+
123
+ The two that are larger than they look are **statsmodels (49 MB)** and **scikit-learn (46 MB)**.
124
+ Neither is optional today: statsmodels supplies the Geweke diagnostic run after every emcee
125
+ MCMC chain, and scikit-learn fits the quadratic used by the Laplace identifiability analysis.
126
+ Both are on paths a plain install is expected to reach.
127
+
128
+ **`[mpi]` is an extra, and that is the deliberate part.** `mpi4py` itself is only 5 MB, but it
129
+ compiles against a system MPI toolchain (`libopenmpi-dev`, `mpich`) at install time, and that
130
+ is the commonest `pip install` failure on macOS and Windows. A serial calibration needs none of
131
+ it: `libcuflynx.utilities.mpi_utils` answers rank/size and supplies the one-rank collectives
132
+ without ever importing `mpi4py`. Install the toolchain first, then the extra:
133
+
134
+ ```
135
+ sudo apt install libopenmpi-dev # or: brew install open-mpi
136
+ pip install "libcuflynx[mpi]"
137
+ ```
138
+
139
+ Ask for a model type, solver or analysis whose extra is missing and the error names the extra
140
+ to install rather than reporting a bare missing module.
141
+
142
+ Developing on a checkout instead: `pip install -e ".[dev]"`, which adds the test and lint
143
+ tooling plus `mpi4py` (`tests/conftest.py` imports it at module scope, so the suite will not
144
+ even collect without it) and `casadi` (whose tests otherwise `importorskip` themselves into
145
+ silence).
146
+
147
+ # Quickstart
148
+
149
+ ```
150
+ pip install libcuflynx
151
+ ```
152
+
153
+ No import path setup and no checkout are required — the package is importable, and its
154
+ commands runnable, from any directory:
155
+
156
+ ```python
157
+ from libcuflynx.utilities.utility_funcs import get_default_inp_data_dict
158
+ from libcuflynx.scripts.script_generate_with_new_architecture import generate_with_new_architecture
159
+ from libcuflynx.solver_wrappers import get_simulation_helper_from_inp_data_dict
160
+ from libcuflynx.param_id.paramID import CVS0DParamID
161
+
162
+ inp = get_default_inp_data_dict(file_prefix, input_param_file, resources_dir)
163
+ generate_with_new_architecture(inp_data_dict=inp) # CSV arrays -> CellML
164
+ sim = get_simulation_helper_from_inp_data_dict(inp) # simulate it
165
+ sim.run()
166
+ pid = CVS0DParamID.init_from_dict(inp) # calibrate it
167
+ ```
168
+
169
+ Each pipeline stage also has a console command, all configured from
170
+ `user_run_files/user_inputs.yaml` and all taking `--help`:
171
+
172
+ | Command | Stage |
173
+ |---|---|
174
+ | `cuflynx-generate` | generate a model from the CSV arrays |
175
+ | `cuflynx-param-id` | generate + calibrate (`mpiexec -n N` for parallel) |
176
+ | `cuflynx-sequential-param-id` | staged calibration — declared, not yet implemented |
177
+ | `cuflynx-sensitivity` | Sobol sensitivity analysis |
178
+ | `cuflynx-identifiability` | Laplace / profile-likelihood identifiability |
179
+ | `cuflynx-train-emulator` | train a surrogate of the obs features |
180
+ | `cuflynx-plot` | plot calibration results |
181
+
182
+ ### `CUFLYNX_USER_DIR` — where an installed libcuflynx reads and writes
183
+
184
+ Every stage needs a directory holding `user_run_files/user_inputs.yaml`, and (unless the
185
+ config overrides them) `resources/`, `module_config_user/`, `funcs_user/`,
186
+ `generated_models/` and `param_id_output/`. It is `$CUFLYNX_USER_DIR` if set; otherwise the
187
+ circulatory_autogen checkout being run from, if this is one — so a clone or a
188
+ `pip install -e .` needs no configuration; otherwise the current working directory.
189
+
190
+ After a plain `pip install libcuflynx` there is no checkout, so either run from your working
191
+ directory or point the variable at it:
192
+
193
+ ```bash
194
+ export CUFLYNX_USER_DIR=/path/to/my_study
195
+ cuflynx-param-id
196
+ ```
197
+
198
+ Nothing is ever written inside the installed package.
199
+
200
+ **Imports without the `libcuflynx.` prefix are deprecated.** `from param_id.paramID import
201
+ CVS0DParamID` still works in 0.4.0 and emits a `DeprecationWarning`; the shims are **removed in
202
+ 0.5.0**. See `CHANGELOG.md` for the migration, including the one for anyone who edited
203
+ `funcs_user/*_funcs_user.py` in place.
204
+
205
+ # Tutorial
206
+
207
+ Follow the instructions in the tutorial to run the project: https://physiomelinks.github.io/circulatory_autogen/
208
+
209
+ # AI-generated interactive tutorial
210
+
211
+ BETA MODE: This AI-generated tutorial can be used to further understand the code base: https://deepwiki.com/FinbarArgus/circulatory_autogen/1-overview
212
+
213
+ # The `CVODE_opencor` solver requires OpenCOR
214
+
215
+ Every solver works from a plain install **except** `CVODE_opencor`. That backend needs the
216
+ `opencor` Python module, which is supplied by an [OpenCOR](https://opencor.ws) installation
217
+ and is not published on PyPI — so it cannot be shipped in a wheel and no `pip install` can
218
+ provide it. Asking for it without OpenCOR raises an error naming the alternative rather than
219
+ a bare `ModuleNotFoundError`.
220
+
221
+ - **Use `solver: CVODE_myokit` instead.** It is a drop-in replacement: the same CellML model,
222
+ integrated by CVODE, with no OpenCOR involved. It is what `user_inputs.yaml` ships with,
223
+ and nothing else in the project needs OpenCOR.
224
+ - **Or run inside OpenCOR**, whose bundled interpreter provides `opencor`. That route is
225
+ deprecated — see
226
+ [Deprecated: OpenCOR-based setup](https://physiomelinks.github.io/circulatory_autogen/getting-started/#deprecated-opencor-based-setup).
227
+
228
+ This is expected to be replaced by a plain `pip install libopencor` once
229
+ [libOpenCOR](https://opencor.ws/libopencor/) reaches PyPI; the bundled-interpreter route and
230
+ the scripts that support it will be removed then.
231
+
232
+ The handful of tests that exercise this backend are marked `need_opencor`. They have **no
233
+ auto-skip**, so without OpenCOR they fail rather than skip — deselect them with
234
+ `-m "not need_opencor"`, which is what CI does.
235
+
236
+ # Releasing
237
+
238
+ Releases are cut from a `v*` tag and published to PyPI by
239
+ [`.github/workflows/release.yml`](.github/workflows/release.yml) using trusted publishing
240
+ (OIDC) — no API token is stored anywhere. The procedure, the release-notes checklist, and the
241
+ rules that cannot be undone (the tag must match `version` in `pyproject.toml`; a PyPI version
242
+ can never be re-uploaded) are in [CONTRIBUTING.md](CONTRIBUTING.md#making-a-release).
243
+
244
+ # Citing this work
245
+
246
+ Cite the project as **circulatory_autogen** — that is the name used by the publications, the
247
+ repository and any archived DOI. The PyPI distribution `libcuflynx` is the *same* software under
248
+ its packaging name, so a paper citing circulatory_autogen and an environment listing
249
+ `libcuflynx==0.4.0` refer to one artifact, not two. When it helps reproducibility, record both:
250
+ the citation for the project and the exact package version installed, e.g.
251
+ "circulatory_autogen (PyPI package `libcuflynx`, version 0.4.0)".
252
+
253
+ # License
254
+ circulatory_autogen is fully open source and distributed under the very permissive Apache License 2.0. See LICENSE for more information.
255
+
256
+ ## Optional third-party backends (not part of circulatory_autogen)
257
+
258
+ circulatory_autogen is complete and fully open source on its own. Every feature works
259
+ without installing any proprietary software.
260
+
261
+ Separately, the project ships optional *adapters* that let users who already hold a licence
262
+ for certain third-party products plug them in. Those products are **not part of
263
+ circulatory_autogen**, are **not bundled or installed with it**, are **not covered by the
264
+ Apache-2.0 licence above**, and are **not required by any feature**.
265
+
266
+ - See [Optional third-party backends](https://physiomelinks.github.io/circulatory_autogen/getting-started/) in the tutorial for more info.
@@ -0,0 +1,196 @@
1
+ # Overview
2
+
3
+ [![Tests](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml/badge.svg?branch=master&event=push)](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml)
4
+
5
+ This project allows the generation and calibration of cellml (and soon to be more) circulatory system models from an array of module/vessel names and connections.
6
+
7
+ **The repository is `circulatory_autogen`; the package it installs is `libcuflynx`.** They are the
8
+ same project under two names: papers, issues and this repository say *circulatory_autogen*, while
9
+ PyPI, `pip install` and every `import` say *libcuflynx*. Searching for either name should find you
10
+ this page.
11
+
12
+ > **Note:** Test results and pass percentage are displayed in the [GitHub Actions workflow summary](https://github.com/physiomelinks/circulatory_autogen/actions/workflows/tests.yml). The badge above shows the overall test status (passing/failing) for `master` of this repository, which is where pull requests are merged.
13
+
14
+ # Installing, and what each extra costs
15
+
16
+ The package is `libcuflynx`. A plain install gives you generation, simulation, calibration,
17
+ sensitivity analysis and the built-in (emcee) MCMC:
18
+
19
+ ```
20
+ pip install libcuflynx
21
+ ```
22
+
23
+ Everything beyond that is an extra, because the optional parts are not small. These are
24
+ installed sizes on disk, not wheel sizes — measured by installing into a fresh venv on Linux
25
+ and taking `du` of `site-packages`, so they include the shared libraries that show up as
26
+ companion directories (`scipy.libs`, `numpy.libs`) and every transitive dependency:
27
+
28
+ | install | on disk | what it buys |
29
+ |---|---|---|
30
+ | `libcuflynx` | **≈ 540 MB** | generation, simulation, calibration, Sobol SA, emcee MCMC, Laplace identifiability |
31
+ | `libcuflynx[mpi]` | **+5 MB**, and a system MPI toolchain | multi-rank runs under `mpiexec` |
32
+ | `libcuflynx[casadi]` | **+221 MB** | `model_type: casadi_python`, `solver: casadi_integrator`, symbolic AD gradients |
33
+ | `libcuflynx[uq]` | **+65 MB** | the pyMC sampler (`UQ_options: library: pymc`) |
34
+ | `libcuflynx[emulation]` | **+750 MB or more** | training and using surrogate models (`do_emulation` / `use_emulator`) |
35
+ | `libcuflynx[cpp]` | +0 MB | `model_type: cpp` — needs a C++ toolchain, which pip cannot install |
36
+ | `libcuflynx[all]` | **≈ 1.6 GB** | all of the above |
37
+
38
+ `[emulation]` is the one to think about before typing: `autoemulate` pulls in **torch**, which
39
+ is 734 MB on its own — more than the whole default install — and requires Python >=3.10,<3.13.
40
+ On Linux, pip's default torch wheel also drags in the bundled NVIDIA CUDA libraries, which can
41
+ take it past 2 GB; install a CPU-only torch first if you do not want them. Because `[all]`
42
+ includes `[emulation]`, `[all]` inherits that Python range too.
43
+
44
+ The per-package numbers below do not add up to the total: the long tail of small transitive
45
+ dependencies (packaging, dateutil, six, typing-extensions, cycler, joblib, threadpoolctl, ...)
46
+ accounts for the rest.
47
+
48
+ What makes up the default install: scipy 109 (+27 in `scipy.libs`), pandas 65, statsmodels 49,
49
+ scikit-learn 46, numpy 41 (+27 in `numpy.libs`), matplotlib 28 with fontTools 25 / pillow 21,
50
+ myokit 13, lxml 12, libcellml 8, kiwisolver 7, nevergrad 5, SALib 5, rdflib 5, libcuflynx
51
+ itself 4, pint 3, seaborn 3, and emcee / corner / tqdm / numdifftools at about 1 MB each.
52
+
53
+ The two that are larger than they look are **statsmodels (49 MB)** and **scikit-learn (46 MB)**.
54
+ Neither is optional today: statsmodels supplies the Geweke diagnostic run after every emcee
55
+ MCMC chain, and scikit-learn fits the quadratic used by the Laplace identifiability analysis.
56
+ Both are on paths a plain install is expected to reach.
57
+
58
+ **`[mpi]` is an extra, and that is the deliberate part.** `mpi4py` itself is only 5 MB, but it
59
+ compiles against a system MPI toolchain (`libopenmpi-dev`, `mpich`) at install time, and that
60
+ is the commonest `pip install` failure on macOS and Windows. A serial calibration needs none of
61
+ it: `libcuflynx.utilities.mpi_utils` answers rank/size and supplies the one-rank collectives
62
+ without ever importing `mpi4py`. Install the toolchain first, then the extra:
63
+
64
+ ```
65
+ sudo apt install libopenmpi-dev # or: brew install open-mpi
66
+ pip install "libcuflynx[mpi]"
67
+ ```
68
+
69
+ Ask for a model type, solver or analysis whose extra is missing and the error names the extra
70
+ to install rather than reporting a bare missing module.
71
+
72
+ Developing on a checkout instead: `pip install -e ".[dev]"`, which adds the test and lint
73
+ tooling plus `mpi4py` (`tests/conftest.py` imports it at module scope, so the suite will not
74
+ even collect without it) and `casadi` (whose tests otherwise `importorskip` themselves into
75
+ silence).
76
+
77
+ # Quickstart
78
+
79
+ ```
80
+ pip install libcuflynx
81
+ ```
82
+
83
+ No import path setup and no checkout are required — the package is importable, and its
84
+ commands runnable, from any directory:
85
+
86
+ ```python
87
+ from libcuflynx.utilities.utility_funcs import get_default_inp_data_dict
88
+ from libcuflynx.scripts.script_generate_with_new_architecture import generate_with_new_architecture
89
+ from libcuflynx.solver_wrappers import get_simulation_helper_from_inp_data_dict
90
+ from libcuflynx.param_id.paramID import CVS0DParamID
91
+
92
+ inp = get_default_inp_data_dict(file_prefix, input_param_file, resources_dir)
93
+ generate_with_new_architecture(inp_data_dict=inp) # CSV arrays -> CellML
94
+ sim = get_simulation_helper_from_inp_data_dict(inp) # simulate it
95
+ sim.run()
96
+ pid = CVS0DParamID.init_from_dict(inp) # calibrate it
97
+ ```
98
+
99
+ Each pipeline stage also has a console command, all configured from
100
+ `user_run_files/user_inputs.yaml` and all taking `--help`:
101
+
102
+ | Command | Stage |
103
+ |---|---|
104
+ | `cuflynx-generate` | generate a model from the CSV arrays |
105
+ | `cuflynx-param-id` | generate + calibrate (`mpiexec -n N` for parallel) |
106
+ | `cuflynx-sequential-param-id` | staged calibration — declared, not yet implemented |
107
+ | `cuflynx-sensitivity` | Sobol sensitivity analysis |
108
+ | `cuflynx-identifiability` | Laplace / profile-likelihood identifiability |
109
+ | `cuflynx-train-emulator` | train a surrogate of the obs features |
110
+ | `cuflynx-plot` | plot calibration results |
111
+
112
+ ### `CUFLYNX_USER_DIR` — where an installed libcuflynx reads and writes
113
+
114
+ Every stage needs a directory holding `user_run_files/user_inputs.yaml`, and (unless the
115
+ config overrides them) `resources/`, `module_config_user/`, `funcs_user/`,
116
+ `generated_models/` and `param_id_output/`. It is `$CUFLYNX_USER_DIR` if set; otherwise the
117
+ circulatory_autogen checkout being run from, if this is one — so a clone or a
118
+ `pip install -e .` needs no configuration; otherwise the current working directory.
119
+
120
+ After a plain `pip install libcuflynx` there is no checkout, so either run from your working
121
+ directory or point the variable at it:
122
+
123
+ ```bash
124
+ export CUFLYNX_USER_DIR=/path/to/my_study
125
+ cuflynx-param-id
126
+ ```
127
+
128
+ Nothing is ever written inside the installed package.
129
+
130
+ **Imports without the `libcuflynx.` prefix are deprecated.** `from param_id.paramID import
131
+ CVS0DParamID` still works in 0.4.0 and emits a `DeprecationWarning`; the shims are **removed in
132
+ 0.5.0**. See `CHANGELOG.md` for the migration, including the one for anyone who edited
133
+ `funcs_user/*_funcs_user.py` in place.
134
+
135
+ # Tutorial
136
+
137
+ Follow the instructions in the tutorial to run the project: https://physiomelinks.github.io/circulatory_autogen/
138
+
139
+ # AI-generated interactive tutorial
140
+
141
+ BETA MODE: This AI-generated tutorial can be used to further understand the code base: https://deepwiki.com/FinbarArgus/circulatory_autogen/1-overview
142
+
143
+ # The `CVODE_opencor` solver requires OpenCOR
144
+
145
+ Every solver works from a plain install **except** `CVODE_opencor`. That backend needs the
146
+ `opencor` Python module, which is supplied by an [OpenCOR](https://opencor.ws) installation
147
+ and is not published on PyPI — so it cannot be shipped in a wheel and no `pip install` can
148
+ provide it. Asking for it without OpenCOR raises an error naming the alternative rather than
149
+ a bare `ModuleNotFoundError`.
150
+
151
+ - **Use `solver: CVODE_myokit` instead.** It is a drop-in replacement: the same CellML model,
152
+ integrated by CVODE, with no OpenCOR involved. It is what `user_inputs.yaml` ships with,
153
+ and nothing else in the project needs OpenCOR.
154
+ - **Or run inside OpenCOR**, whose bundled interpreter provides `opencor`. That route is
155
+ deprecated — see
156
+ [Deprecated: OpenCOR-based setup](https://physiomelinks.github.io/circulatory_autogen/getting-started/#deprecated-opencor-based-setup).
157
+
158
+ This is expected to be replaced by a plain `pip install libopencor` once
159
+ [libOpenCOR](https://opencor.ws/libopencor/) reaches PyPI; the bundled-interpreter route and
160
+ the scripts that support it will be removed then.
161
+
162
+ The handful of tests that exercise this backend are marked `need_opencor`. They have **no
163
+ auto-skip**, so without OpenCOR they fail rather than skip — deselect them with
164
+ `-m "not need_opencor"`, which is what CI does.
165
+
166
+ # Releasing
167
+
168
+ Releases are cut from a `v*` tag and published to PyPI by
169
+ [`.github/workflows/release.yml`](.github/workflows/release.yml) using trusted publishing
170
+ (OIDC) — no API token is stored anywhere. The procedure, the release-notes checklist, and the
171
+ rules that cannot be undone (the tag must match `version` in `pyproject.toml`; a PyPI version
172
+ can never be re-uploaded) are in [CONTRIBUTING.md](CONTRIBUTING.md#making-a-release).
173
+
174
+ # Citing this work
175
+
176
+ Cite the project as **circulatory_autogen** — that is the name used by the publications, the
177
+ repository and any archived DOI. The PyPI distribution `libcuflynx` is the *same* software under
178
+ its packaging name, so a paper citing circulatory_autogen and an environment listing
179
+ `libcuflynx==0.4.0` refer to one artifact, not two. When it helps reproducibility, record both:
180
+ the citation for the project and the exact package version installed, e.g.
181
+ "circulatory_autogen (PyPI package `libcuflynx`, version 0.4.0)".
182
+
183
+ # License
184
+ circulatory_autogen is fully open source and distributed under the very permissive Apache License 2.0. See LICENSE for more information.
185
+
186
+ ## Optional third-party backends (not part of circulatory_autogen)
187
+
188
+ circulatory_autogen is complete and fully open source on its own. Every feature works
189
+ without installing any proprietary software.
190
+
191
+ Separately, the project ships optional *adapters* that let users who already hold a licence
192
+ for certain third-party products plug them in. Those products are **not part of
193
+ circulatory_autogen**, are **not bundled or installed with it**, are **not covered by the
194
+ Apache-2.0 licence above**, and are **not required by any feature**.
195
+
196
+ - See [Optional third-party backends](https://physiomelinks.github.io/circulatory_autogen/getting-started/) in the tutorial for more info.