cardiac-geometriesx 0.2.0__tar.gz → 0.3.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.
Potentially problematic release.
This version of cardiac-geometriesx might be problematic. Click here for more details.
- {cardiac_geometriesx-0.2.0/src/cardiac_geometriesx.egg-info → cardiac_geometriesx-0.3.0}/PKG-INFO +1 -1
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/pyproject.toml +2 -2
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/lv_ellipsoid.py +86 -8
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0/src/cardiac_geometriesx.egg-info}/PKG-INFO +1 -1
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/LICENSE +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/README.md +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/setup.cfg +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/__init__.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/cli.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/__init__.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/slab.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/utils.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/geometry.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/gui.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/mesh.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/utils.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/SOURCES.txt +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/dependency_links.txt +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/entry_points.txt +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/not-zip-safe +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/requires.txt +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/top_level.txt +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/tests/test_cli.py +0 -0
- {cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/tests/test_save_load.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cardiac-geometriesx"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "A python library for cardiac geometries"
|
|
9
9
|
authors = [{name = "Henrik Finsberg", email = "henriknf@simula.no"}]
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -173,7 +173,7 @@ tag = true
|
|
|
173
173
|
sign_tags = false
|
|
174
174
|
tag_name = "v{new_version}"
|
|
175
175
|
tag_message = "Bump version: {current_version} → {new_version}"
|
|
176
|
-
current_version = "0.
|
|
176
|
+
current_version = "0.3.0"
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
[[tool.bumpversion.files]]
|
|
@@ -7,6 +7,58 @@ from ..utils import space_from_string
|
|
|
7
7
|
from . import utils
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
def mu_theta(
|
|
11
|
+
x: np.ndarray, y: np.ndarray, z: np.ndarray, long_axis: int = 0
|
|
12
|
+
) -> tuple[np.ndarray, np.ndarray, list[int]]:
|
|
13
|
+
"""Get the angles mu and theta from the coordinates x, y, z
|
|
14
|
+
given the long axis.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
x : np.ndarray
|
|
19
|
+
The x-coordinates
|
|
20
|
+
y : np.ndarray
|
|
21
|
+
The y-coordinates
|
|
22
|
+
z : np.ndarray
|
|
23
|
+
The z-coordinates
|
|
24
|
+
long_axis : int, optional
|
|
25
|
+
The long axis, by default 0 (x-axis)
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
tuple[np.ndarray, np.ndarray, list[int]]
|
|
30
|
+
The angles mu and theta and the permutation of the axes
|
|
31
|
+
|
|
32
|
+
Raises
|
|
33
|
+
------
|
|
34
|
+
ValueError
|
|
35
|
+
If the long axis is not 0, 1 or 2
|
|
36
|
+
"""
|
|
37
|
+
if long_axis == 0:
|
|
38
|
+
a = np.sqrt(y**2 + z**2)
|
|
39
|
+
b = x
|
|
40
|
+
theta = np.pi - np.arctan2(z, -y)
|
|
41
|
+
perm = [0, 1, 2]
|
|
42
|
+
elif long_axis == 1:
|
|
43
|
+
a = np.sqrt(x**2 + z**2)
|
|
44
|
+
b = y
|
|
45
|
+
theta = np.pi - np.arctan2(z, -x)
|
|
46
|
+
perm = [1, 0, 2]
|
|
47
|
+
elif long_axis == 2:
|
|
48
|
+
a = np.sqrt(x**2 + y**2)
|
|
49
|
+
b = z
|
|
50
|
+
theta = np.pi - np.arctan2(x, -y)
|
|
51
|
+
perm = [2, 1, 0]
|
|
52
|
+
else:
|
|
53
|
+
raise ValueError("Invalid long_axis")
|
|
54
|
+
|
|
55
|
+
mu = np.arctan2(a, b)
|
|
56
|
+
|
|
57
|
+
theta[mu < 1e-7] = 0.0
|
|
58
|
+
|
|
59
|
+
return mu, theta, perm
|
|
60
|
+
|
|
61
|
+
|
|
10
62
|
def compute_system(
|
|
11
63
|
t_func: dolfinx.fem.Function,
|
|
12
64
|
r_short_endo=0.025,
|
|
@@ -15,8 +67,36 @@ def compute_system(
|
|
|
15
67
|
r_long_epi=0.097,
|
|
16
68
|
alpha_endo: float = -60,
|
|
17
69
|
alpha_epi: float = 60,
|
|
70
|
+
long_axis: int = 0,
|
|
18
71
|
**kwargs,
|
|
19
72
|
) -> utils.Microstructure:
|
|
73
|
+
"""Compute the microstructure for the given time function.
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
t_func : dolfinx.fem.Function
|
|
78
|
+
Solution of the Laplace equation
|
|
79
|
+
r_short_endo : float, optional
|
|
80
|
+
Short radius at the endocardium, by default 0.025
|
|
81
|
+
r_short_epi : float, optional
|
|
82
|
+
Short radius at the epicardium, by default 0.035
|
|
83
|
+
r_long_endo : float, optional
|
|
84
|
+
Long radius at the endocardium, by default 0.09
|
|
85
|
+
r_long_epi : float, optional
|
|
86
|
+
Long radius at the epicardium, by default 0.097
|
|
87
|
+
alpha_endo : float, optional
|
|
88
|
+
Angle at the endocardium, by default -60
|
|
89
|
+
alpha_epi : float, optional
|
|
90
|
+
Angle at the epicardium, by default 60
|
|
91
|
+
long_axis : int, optional
|
|
92
|
+
Long axis, by default 0 (x-axis)
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
utils.Microstructure
|
|
97
|
+
The microstructure
|
|
98
|
+
"""
|
|
99
|
+
|
|
20
100
|
V = t_func.function_space
|
|
21
101
|
element = V.ufl_element()
|
|
22
102
|
mesh = V.mesh
|
|
@@ -40,11 +120,7 @@ def compute_system(
|
|
|
40
120
|
y = dof_coordinates[:, 1]
|
|
41
121
|
z = dof_coordinates[:, 2]
|
|
42
122
|
|
|
43
|
-
|
|
44
|
-
b = x / rl
|
|
45
|
-
mu = np.arctan2(a, b)
|
|
46
|
-
theta = np.pi - np.arctan2(z, -y)
|
|
47
|
-
theta[mu < 1e-7] = 0.0
|
|
123
|
+
mu, theta, perm = mu_theta(x, y, z, long_axis=long_axis)
|
|
48
124
|
|
|
49
125
|
e_t = np.array(
|
|
50
126
|
[
|
|
@@ -52,7 +128,7 @@ def compute_system(
|
|
|
52
128
|
drs_dt * np.sin(mu) * np.cos(theta),
|
|
53
129
|
drs_dt * np.sin(mu) * np.sin(theta),
|
|
54
130
|
],
|
|
55
|
-
)
|
|
131
|
+
)[perm]
|
|
56
132
|
e_t = utils.normalize(e_t)
|
|
57
133
|
|
|
58
134
|
e_mu = np.array(
|
|
@@ -61,7 +137,7 @@ def compute_system(
|
|
|
61
137
|
rs * np.cos(mu) * np.cos(theta),
|
|
62
138
|
rs * np.cos(mu) * np.sin(theta),
|
|
63
139
|
],
|
|
64
|
-
)
|
|
140
|
+
)[perm]
|
|
65
141
|
e_mu = utils.normalize(e_mu)
|
|
66
142
|
|
|
67
143
|
e_theta = np.array(
|
|
@@ -70,7 +146,7 @@ def compute_system(
|
|
|
70
146
|
-rs * np.sin(mu) * np.sin(theta),
|
|
71
147
|
rs * np.sin(mu) * np.cos(theta),
|
|
72
148
|
],
|
|
73
|
-
)
|
|
149
|
+
)[perm]
|
|
74
150
|
e_theta = utils.normalize(e_theta)
|
|
75
151
|
|
|
76
152
|
f0 = np.sin(al) * e_mu + np.cos(al) * e_theta
|
|
@@ -113,6 +189,7 @@ def create_microstructure(
|
|
|
113
189
|
r_long_epi=0.097,
|
|
114
190
|
alpha_endo: float = -60,
|
|
115
191
|
alpha_epi: float = 60,
|
|
192
|
+
long_axis: int = 0,
|
|
116
193
|
outdir: str | Path | None = None,
|
|
117
194
|
):
|
|
118
195
|
endo_marker = markers["ENDO"][0]
|
|
@@ -143,6 +220,7 @@ def create_microstructure(
|
|
|
143
220
|
r_long_epi=r_long_epi,
|
|
144
221
|
alpha_endo=alpha_endo,
|
|
145
222
|
alpha_epi=alpha_epi,
|
|
223
|
+
long_axis=long_axis,
|
|
146
224
|
)
|
|
147
225
|
if outdir is not None:
|
|
148
226
|
utils.save_microstructure(mesh, system, outdir)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/__init__.py
RENAMED
|
File without changes
|
{cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/slab.py
RENAMED
|
File without changes
|
{cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometries/fibers/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardiac_geometriesx-0.2.0 → cardiac_geometriesx-0.3.0}/src/cardiac_geometriesx.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|