circulation 0.2.0__tar.gz → 0.2.1__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 (22) hide show
  1. {circulation-0.2.0/src/circulation.egg-info → circulation-0.2.1}/PKG-INFO +1 -1
  2. {circulation-0.2.0 → circulation-0.2.1}/pyproject.toml +2 -2
  3. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/base.py +8 -4
  4. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/bestel.py +4 -4
  5. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/regazzoni2020.py +12 -12
  6. {circulation-0.2.0 → circulation-0.2.1/src/circulation.egg-info}/PKG-INFO +1 -1
  7. {circulation-0.2.0 → circulation-0.2.1}/src/circulation.egg-info/SOURCES.txt +2 -1
  8. circulation-0.2.1/tests/test_regazzoni_steady_state.py +15 -0
  9. {circulation-0.2.0 → circulation-0.2.1}/LICENSE +0 -0
  10. {circulation-0.2.0 → circulation-0.2.1}/README.md +0 -0
  11. {circulation-0.2.0 → circulation-0.2.1}/setup.cfg +0 -0
  12. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/__init__.py +0 -0
  13. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/log.py +0 -0
  14. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/time_varying_elastance.py +0 -0
  15. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/units.py +0 -0
  16. {circulation-0.2.0 → circulation-0.2.1}/src/circulation/zenker.py +0 -0
  17. {circulation-0.2.0 → circulation-0.2.1}/src/circulation.egg-info/dependency_links.txt +0 -0
  18. {circulation-0.2.0 → circulation-0.2.1}/src/circulation.egg-info/requires.txt +0 -0
  19. {circulation-0.2.0 → circulation-0.2.1}/src/circulation.egg-info/top_level.txt +0 -0
  20. {circulation-0.2.0 → circulation-0.2.1}/tests/test_bestel.py +0 -0
  21. {circulation-0.2.0 → circulation-0.2.1}/tests/test_initialization.py +0 -0
  22. {circulation-0.2.0 → circulation-0.2.1}/tests/test_models.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: circulation
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Closed loop blood circulation model in FEniCS
5
5
  Author-email: Henrik Finsberg <henriknf@simula.no>
6
6
  License-Expression: MIT
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0.0", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "circulation"
6
- version = "0.2.0"
6
+ version = "0.2.1"
7
7
  description = "Closed loop blood circulation model in FEniCS"
8
8
  authors = [{ name = "Henrik Finsberg", email = "henriknf@simula.no" }]
9
9
  license = "MIT"
@@ -116,7 +116,7 @@ tag = true
116
116
  sign_tags = false
117
117
  tag_name = "v{new_version}"
118
118
  tag_message = "Bump version: {current_version} → {new_version}"
119
- current_version = "0.2.0"
119
+ current_version = "0.2.1"
120
120
 
121
121
 
122
122
  [[tool.bumpversion.files]]
@@ -267,10 +267,14 @@ class CirculationModel(ABC):
267
267
  unit_R: float = 1.0,
268
268
  unit_p: float = 1.0,
269
269
  ) -> Callable[[float, float], float]:
270
- return lambda w, v: unit_R * 10.0 ** (
271
- np.log10(Rmin / unit_R)
272
- + (np.log10(Rmax / unit_R) - np.log10(Rmin / unit_R))
273
- * smooth_heavyside((v - w) / unit_p)
270
+ return lambda w, v: (
271
+ unit_R
272
+ * 10.0
273
+ ** (
274
+ np.log10(Rmin / unit_R)
275
+ + (np.log10(Rmax / unit_R) - np.log10(Rmin / unit_R))
276
+ * smooth_heavyside((v - w) / unit_p)
277
+ )
274
278
  )
275
279
 
276
280
  def times_n_beats(self, dt: float, n: int = 1) -> np.ndarray:
@@ -106,8 +106,8 @@ class BestelActivation:
106
106
 
107
107
  # print(f"Solving active stress model with parameters: {pprint.pformat(params)}")
108
108
 
109
- f = (
110
- lambda t: 0.25
109
+ f = lambda t: (
110
+ 0.25
111
111
  * (1 + math.tanh((t - ps["t_sys"]) / ps["gamma"]))
112
112
  * (1 - math.tanh((t - ps["t_dias"]) / ps["gamma"]))
113
113
  )
@@ -286,8 +286,8 @@ class BestelPressure:
286
286
 
287
287
  def __call__(self, t, p):
288
288
  ps = self.parameters
289
- f = (
290
- lambda t: 0.25
289
+ f = lambda t: (
290
+ 0.25
291
291
  * (1 + math.tanh((t - ps["t_sys_pre"]) / ps["gamma"]))
292
292
  * (1 - math.tanh((t - ps["t_dias_pre"]) / ps["gamma"]))
293
293
  )
@@ -229,18 +229,18 @@ class Regazzoni2020(base.CirculationModel):
229
229
  @staticmethod
230
230
  def default_initial_conditions() -> dict[str, float]:
231
231
  return {
232
- "V_LA": 80.0 * mL,
233
- "V_LV": 110.0 * mL,
234
- "V_RA": 80.0 * mL,
235
- "V_RV": 110.0 * mL,
236
- "p_AR_SYS": 70.0 * mmHg,
237
- "p_VEN_SYS": 28.32334306787334 * mmHg,
238
- "p_AR_PUL": 25.0 * mmHg,
239
- "p_VEN_PUL": 20.0 * mmHg,
240
- "Q_AR_SYS": 0.0 * mL / s,
241
- "Q_VEN_SYS": 0.0 * mL / s,
242
- "Q_AR_PUL": 0.0 * mL / s,
243
- "Q_VEN_PUL": 0.0 * mL / s,
232
+ "V_LA": 87.183 * mL,
233
+ "V_LV": 118.520 * mL,
234
+ "V_RA": 86.833 * mL,
235
+ "V_RV": 166.177 * mL,
236
+ "p_AR_SYS": 87.675 * mmHg,
237
+ "p_VEN_SYS": 35.898 * mmHg,
238
+ "p_AR_PUL": 19.545 * mmHg,
239
+ "p_VEN_PUL": 15.004 * mmHg,
240
+ "Q_AR_SYS": 71.104 * mL / s,
241
+ "Q_VEN_SYS": 94.039 * mL / s,
242
+ "Q_AR_PUL": 94.084 * mL / s,
243
+ "Q_VEN_PUL": 473.279 * mL / s,
244
244
  }
245
245
 
246
246
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: circulation
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Closed loop blood circulation model in FEniCS
5
5
  Author-email: Henrik Finsberg <henriknf@simula.no>
6
6
  License-Expression: MIT
@@ -16,4 +16,5 @@ src/circulation.egg-info/requires.txt
16
16
  src/circulation.egg-info/top_level.txt
17
17
  tests/test_bestel.py
18
18
  tests/test_initialization.py
19
- tests/test_models.py
19
+ tests/test_models.py
20
+ tests/test_regazzoni_steady_state.py
@@ -0,0 +1,15 @@
1
+ import numpy as np
2
+ from circulation import regazzoni2020
3
+
4
+
5
+ def test_regazzoni_steady_state():
6
+ """
7
+ Test that the default initial state is close to the limit cycle.
8
+ We run the model for ten beats and check that the state hasn't drifted much.
9
+ """
10
+ model = regazzoni2020.Regazzoni2020()
11
+ initial_state = model.state.copy()
12
+ model.solve(num_beats=10)
13
+ final_state = model.state
14
+
15
+ np.testing.assert_allclose(final_state, initial_state, rtol=1e-2, verbose=True)
File without changes
File without changes
File without changes