cardiac-geometriesx 0.4.1__tar.gz → 0.4.3__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.4.1/src/cardiac_geometriesx.egg-info → cardiac_geometriesx-0.4.3}/PKG-INFO +1 -1
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/pyproject.toml +2 -2
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/lv_ellipsoid.py +17 -8
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/utils.py +3 -2
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/geometry.py +36 -27
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/mesh.py +0 -1
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/utils.py +2 -1
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3/src/cardiac_geometriesx.egg-info}/PKG-INFO +1 -1
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/LICENSE +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/README.md +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/setup.cfg +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/__init__.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/cli.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/__init__.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/slab.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/gui.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/SOURCES.txt +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/dependency_links.txt +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/entry_points.txt +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/not-zip-safe +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/requires.txt +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometriesx.egg-info/top_level.txt +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/tests/test_cli.py +0 -0
- {cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/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.4.
|
|
7
|
+
version = "0.4.3"
|
|
8
8
|
description = "A python library for cardiac geometries"
|
|
9
9
|
authors = [{name = "Henrik Finsberg", email = "henriknf@simula.no"}]
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -174,7 +174,7 @@ tag = true
|
|
|
174
174
|
sign_tags = false
|
|
175
175
|
tag_name = "v{new_version}"
|
|
176
176
|
tag_message = "Bump version: {current_version} → {new_version}"
|
|
177
|
-
current_version = "0.4.
|
|
177
|
+
current_version = "0.4.3"
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
[[tool.bumpversion.files]]
|
|
@@ -8,7 +8,12 @@ from . import utils
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def mu_theta(
|
|
11
|
-
x: np.ndarray,
|
|
11
|
+
x: np.ndarray,
|
|
12
|
+
y: np.ndarray,
|
|
13
|
+
z: np.ndarray,
|
|
14
|
+
rs: np.ndarray,
|
|
15
|
+
rl: np.ndarray,
|
|
16
|
+
long_axis: int = 0,
|
|
12
17
|
) -> tuple[np.ndarray, np.ndarray, list[int]]:
|
|
13
18
|
"""Get the angles mu and theta from the coordinates x, y, z
|
|
14
19
|
given the long axis.
|
|
@@ -21,6 +26,10 @@ def mu_theta(
|
|
|
21
26
|
The y-coordinates
|
|
22
27
|
z : np.ndarray
|
|
23
28
|
The z-coordinates
|
|
29
|
+
rs : np.ndarray
|
|
30
|
+
The short radius
|
|
31
|
+
rl : np.ndarray
|
|
32
|
+
The long radius
|
|
24
33
|
long_axis : int, optional
|
|
25
34
|
The long axis, by default 0 (x-axis)
|
|
26
35
|
|
|
@@ -35,18 +44,18 @@ def mu_theta(
|
|
|
35
44
|
If the long axis is not 0, 1 or 2
|
|
36
45
|
"""
|
|
37
46
|
if long_axis == 0:
|
|
38
|
-
a = np.sqrt(y**2 + z**2)
|
|
39
|
-
b = x
|
|
47
|
+
a = np.sqrt(y**2 + z**2) / rs
|
|
48
|
+
b = x / rl
|
|
40
49
|
theta = np.pi - np.arctan2(z, -y)
|
|
41
50
|
perm = [0, 1, 2]
|
|
42
51
|
elif long_axis == 1:
|
|
43
|
-
a = np.sqrt(x**2 + z**2)
|
|
44
|
-
b = y
|
|
52
|
+
a = np.sqrt(x**2 + z**2) / rs
|
|
53
|
+
b = y / rl
|
|
45
54
|
theta = np.pi - np.arctan2(z, -x)
|
|
46
55
|
perm = [1, 0, 2]
|
|
47
56
|
elif long_axis == 2:
|
|
48
|
-
a = np.sqrt(x**2 + y**2)
|
|
49
|
-
b = z
|
|
57
|
+
a = np.sqrt(x**2 + y**2) / rs
|
|
58
|
+
b = z / rl
|
|
50
59
|
theta = np.pi - np.arctan2(x, -y)
|
|
51
60
|
perm = [2, 1, 0]
|
|
52
61
|
else:
|
|
@@ -120,7 +129,7 @@ def compute_system(
|
|
|
120
129
|
y = dof_coordinates[:, 1]
|
|
121
130
|
z = dof_coordinates[:, 2]
|
|
122
131
|
|
|
123
|
-
mu, theta, perm = mu_theta(x, y, z, long_axis=long_axis)
|
|
132
|
+
mu, theta, perm = mu_theta(x, y, z, rs, rl, long_axis=long_axis)
|
|
124
133
|
|
|
125
134
|
e_t = np.array(
|
|
126
135
|
[
|
{cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/utils.py
RENAMED
|
@@ -25,6 +25,7 @@ def save_microstructure(
|
|
|
25
25
|
if len(functions) == 0:
|
|
26
26
|
return
|
|
27
27
|
# Save for paraview visualization
|
|
28
|
+
|
|
28
29
|
if functions[0].function_space.ufl_element().family_name == "quadrature":
|
|
29
30
|
from scifem.xdmf import create_pointcloud
|
|
30
31
|
|
|
@@ -35,8 +36,8 @@ def save_microstructure(
|
|
|
35
36
|
mesh.comm, Path(outdir) / "microstructure-viz.bp", functions, engine="BP4"
|
|
36
37
|
) as file:
|
|
37
38
|
file.write(0.0)
|
|
38
|
-
except RuntimeError:
|
|
39
|
-
|
|
39
|
+
except RuntimeError as ex:
|
|
40
|
+
print(f"Failed to write microstructure: {ex}")
|
|
40
41
|
|
|
41
42
|
# Save with proper function space
|
|
42
43
|
filename = Path(outdir) / "microstructure.bp"
|
|
@@ -5,9 +5,11 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
from mpi4py import MPI
|
|
7
7
|
|
|
8
|
+
import adios2
|
|
8
9
|
import adios4dolfinx
|
|
9
10
|
import dolfinx
|
|
10
11
|
import numpy as np
|
|
12
|
+
from packaging.version import Version
|
|
11
13
|
|
|
12
14
|
from . import utils
|
|
13
15
|
|
|
@@ -31,12 +33,16 @@ class Geometry:
|
|
|
31
33
|
self.mesh.comm.barrier()
|
|
32
34
|
adios4dolfinx.write_mesh(mesh=self.mesh, filename=path)
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if Version(np.__version__) <= Version("2.11") or Version(adios2.__version__) >= Version(
|
|
37
|
+
"2.10.2"
|
|
38
|
+
):
|
|
39
|
+
# This is broken in adios < 2.10.2 and numpy >= 2.11
|
|
40
|
+
adios4dolfinx.write_attributes(
|
|
41
|
+
comm=self.mesh.comm,
|
|
42
|
+
filename=path,
|
|
43
|
+
name="markers",
|
|
44
|
+
attributes={k: np.array(v, dtype=np.uint8) for k, v in self.markers.items()},
|
|
45
|
+
)
|
|
40
46
|
|
|
41
47
|
if self.cfun is not None:
|
|
42
48
|
adios4dolfinx.write_meshtags(
|
|
@@ -52,31 +58,34 @@ class Geometry:
|
|
|
52
58
|
filename=path,
|
|
53
59
|
meshtag_name="Facet tags",
|
|
54
60
|
)
|
|
55
|
-
if self.efun is not None:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if self.vfun is not None:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
# if self.efun is not None:
|
|
62
|
+
# adios4dolfinx.write_meshtags(
|
|
63
|
+
# meshtags=self.efun,
|
|
64
|
+
# mesh=self.mesh,
|
|
65
|
+
# filename=path,
|
|
66
|
+
# meshtag_name="Edge tags",
|
|
67
|
+
# )
|
|
68
|
+
# if self.vfun is not None:
|
|
69
|
+
# adios4dolfinx.write_meshtags(
|
|
70
|
+
# meshtags=self.vfun,
|
|
71
|
+
# mesh=self.mesh,
|
|
72
|
+
# filename=path,
|
|
73
|
+
# meshtag_name="Vertex tags",
|
|
74
|
+
# )
|
|
69
75
|
|
|
70
76
|
if self.f0 is not None:
|
|
71
77
|
el = self.f0.ufl_element()
|
|
72
78
|
arr = utils.element2array(el)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if Version(np.__version__) <= Version("2.11") or Version(adios2.__version__) >= Version(
|
|
80
|
+
"2.10.2"
|
|
81
|
+
):
|
|
82
|
+
# This is broken in adios for numpy >= 2.11
|
|
83
|
+
adios4dolfinx.write_attributes(
|
|
84
|
+
comm=self.mesh.comm,
|
|
85
|
+
filename=path,
|
|
86
|
+
name="function_space",
|
|
87
|
+
attributes={k: arr for k in ("f0", "s0", "n0")},
|
|
88
|
+
)
|
|
80
89
|
adios4dolfinx.write_function(u=self.f0, filename=path, name="f0")
|
|
81
90
|
if self.s0 is not None:
|
|
82
91
|
adios4dolfinx.write_function(u=self.s0, filename=path, name="s0")
|
|
@@ -10,6 +10,7 @@ from mpi4py import MPI
|
|
|
10
10
|
import basix
|
|
11
11
|
import dolfinx
|
|
12
12
|
import numpy as np
|
|
13
|
+
from packaging.version import Version
|
|
13
14
|
from structlog import get_logger
|
|
14
15
|
|
|
15
16
|
logger = get_logger()
|
|
@@ -32,7 +33,7 @@ def distribute_entity_data(
|
|
|
32
33
|
marked_entities: np.ndarray,
|
|
33
34
|
entity_values: np.ndarray,
|
|
34
35
|
) -> tuple[np.ndarray, np.ndarray]:
|
|
35
|
-
if dolfinx.__version__ >= "0.9.0":
|
|
36
|
+
if Version(dolfinx.__version__) >= Version("0.9.0"):
|
|
36
37
|
local_entities, local_values = dolfinx.io.utils.distribute_entity_data(
|
|
37
38
|
mesh, tdim, marked_entities, entity_values
|
|
38
39
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/__init__.py
RENAMED
|
File without changes
|
{cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/src/cardiac_geometries/fibers/slab.py
RENAMED
|
File without changes
|
|
File without changes
|
{cardiac_geometriesx-0.4.1 → cardiac_geometriesx-0.4.3}/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
|