fullwave25 1.2.6.dev2__tar.gz → 1.2.6.dev3__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.
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/.bumpversion.toml +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/.pre-commit-config.yaml +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/PKG-INFO +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/__init__.py +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/beamformer/beamformer.py +2 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium.py +8 -4
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/sensor.py +3 -2
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/cuda_utils.py +10 -5
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/pml_builder.py +4 -4
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/solver.py +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/utils.py +16 -8
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/source.py +1 -1
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/transducer.py +12 -11
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/check_functions.py +6 -3
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/coordinates.py +8 -4
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/memory_tempfile.py +7 -7
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/plot_utils.py +3 -3
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/signal_filter.py +2 -2
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/pyproject.toml +1 -1
- fullwave25-1.2.6.dev3/ruff.log +1177 -0
- fullwave25-1.2.6.dev3/ruff.toml +139 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/uv.lock +1 -1
- fullwave25-1.2.6.dev2/ruff.toml +0 -114
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/.gitignore +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/.python-version +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/20260120_0844.log +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/CITATION.cff +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/CLAUDE.md +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/CONTRIBUTING.md +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/LICENSE +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/Makefile +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/README.md +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/beamformer.m +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/debug_solver_bin/fullwave2_2d_exponential_attenuation_multi_gpu_cuda124 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/debug_solver_bin/fullwave2_3d_exponential_attenuation_multi_gpu_cuda124 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/experiments/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/experiments/exp_scatterer_diameter.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/beamformer/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/constants/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/constants/material_properties.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/grid.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/domain.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/medium_builder.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/data/.keep +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/domain_abdominal_wall.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/domain_background.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/domain_scatterer.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/domain_simple.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/medium_builder/presets/domain_water_gel.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/binary_manager.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_cuda118 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_cuda124 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_cuda129 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_cuda130 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_cuda118 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_cuda124 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_cuda129 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/_gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_cuda130 +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/bins/database/relaxation_params_database_num_relax=2_20260113_0957.mat +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/input_file_writer.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/solver/launcher.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/__init__.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/numerical.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/pulse.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/relaxation_parameters.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/scatterer.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/fullwave/utils/signal_process.py +0 -0
- {fullwave25-1.2.6.dev2 → fullwave25-1.2.6.dev3}/signal_filter_example.png +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fullwave25
|
|
3
|
-
Version: 1.2.6.
|
|
3
|
+
Version: 1.2.6.dev3
|
|
4
4
|
Summary: Fullwave 2.5: Ultrasound wave propagation simulation with heterogeneous power law attenuation modelling capabilities
|
|
5
5
|
Author: Masashi Sode, Gianmarco Pinton
|
|
6
6
|
Maintainer: Masashi Sode
|
|
@@ -60,7 +60,7 @@ try:
|
|
|
60
60
|
__version__ = version("fullwave")
|
|
61
61
|
except PackageNotFoundError:
|
|
62
62
|
# Update via bump-my-version, not manually
|
|
63
|
-
__version__ = "1.2.6-
|
|
63
|
+
__version__ = "1.2.6-dev3"
|
|
64
64
|
|
|
65
65
|
VERSION = __version__ # for convenience
|
|
66
66
|
logger.info("Fullwave version: %s", __version__)
|
|
@@ -14,7 +14,8 @@ class Beamformer:
|
|
|
14
14
|
For faster implementations, consider using libraries such as
|
|
15
15
|
mach beamformer: https://github.com/Forest-Neurotech/mach
|
|
16
16
|
|
|
17
|
-
References
|
|
17
|
+
References
|
|
18
|
+
----------
|
|
18
19
|
- Fullwave2 BMME890 implementation
|
|
19
20
|
- https://github.com/gfpinton/fullwave_bmme890/blob/master/fullwave2_launcher_imaging_planewave.m
|
|
20
21
|
|
|
@@ -231,7 +231,8 @@ class MediumRelaxationMaps:
|
|
|
231
231
|
) -> None:
|
|
232
232
|
"""Check if the relaxation parameter updates have valid keys and matching shapes.
|
|
233
233
|
|
|
234
|
-
Raises
|
|
234
|
+
Raises
|
|
235
|
+
------
|
|
235
236
|
ValueError: If the keys do not match the desired keys or
|
|
236
237
|
if the shapes of the values do not match the domain shape.
|
|
237
238
|
|
|
@@ -1147,11 +1148,13 @@ class Medium:
|
|
|
1147
1148
|
it uses the relaxation parameters look up table
|
|
1148
1149
|
to generate the relaxation parameters.
|
|
1149
1150
|
|
|
1150
|
-
Returns
|
|
1151
|
+
Returns
|
|
1152
|
+
-------
|
|
1151
1153
|
MediumRelaxationMaps: An instance of MediumRelaxationMaps
|
|
1152
1154
|
built from the retrieved relaxation parameters.
|
|
1153
1155
|
|
|
1154
|
-
Raises
|
|
1156
|
+
Raises
|
|
1157
|
+
------
|
|
1155
1158
|
ValueError: If an unknown attenuation_builder is specified.
|
|
1156
1159
|
|
|
1157
1160
|
"""
|
|
@@ -1216,7 +1219,8 @@ class Medium:
|
|
|
1216
1219
|
def build_exponential(self) -> MediumExponentialAttenuation:
|
|
1217
1220
|
"""Build MediumExponentialAttenuation from alpha and power maps.
|
|
1218
1221
|
|
|
1219
|
-
Returns
|
|
1222
|
+
Returns
|
|
1223
|
+
-------
|
|
1220
1224
|
MediumExponentialAttenuation: An instance of MediumExponentialAttenuation
|
|
1221
1225
|
built from the alpha and power maps.
|
|
1222
1226
|
|
|
@@ -21,7 +21,7 @@ class Sensor:
|
|
|
21
21
|
outcoords: NDArray[np.int64]
|
|
22
22
|
sampling_modulus_time: int = 1
|
|
23
23
|
|
|
24
|
-
def __init__(
|
|
24
|
+
def __init__(
|
|
25
25
|
self,
|
|
26
26
|
mask: NDArray[np.bool] | None = None,
|
|
27
27
|
sampling_modulus_time: int = 1,
|
|
@@ -189,7 +189,8 @@ class Sensor:
|
|
|
189
189
|
) -> None:
|
|
190
190
|
"""Plot the transducer mask, optionally exporting and displaying the figure.
|
|
191
191
|
|
|
192
|
-
Raises
|
|
192
|
+
Raises
|
|
193
|
+
------
|
|
193
194
|
ValueError: If the sensor is 3D because plotting is not supported.
|
|
194
195
|
|
|
195
196
|
"""
|
|
@@ -113,7 +113,8 @@ def cuda_api_call(func: Callable) -> Callable:
|
|
|
113
113
|
Decorator for CUDA API calls
|
|
114
114
|
Raises RuntimeError if the CUDA call does not return CUDA_SUCCESS.
|
|
115
115
|
|
|
116
|
-
Returns
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
117
118
|
Callable: The wrapped function that checks CUDA API call results.
|
|
118
119
|
|
|
119
120
|
"""
|
|
@@ -138,7 +139,8 @@ def cuda_api_call_warn(func: Callable) -> Callable:
|
|
|
138
139
|
|
|
139
140
|
Prints a warning message if the CUDA call does not return CUDA_SUCCESS.
|
|
140
141
|
|
|
141
|
-
Returns
|
|
142
|
+
Returns
|
|
143
|
+
-------
|
|
142
144
|
Callable: The wrapped function that checks CUDA API call results.
|
|
143
145
|
|
|
144
146
|
"""
|
|
@@ -230,7 +232,8 @@ def get_cuda_device_specs() -> list[dict[str, Any]]:
|
|
|
230
232
|
'cuda_cores': int
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
Returns
|
|
235
|
+
Returns
|
|
236
|
+
-------
|
|
234
237
|
A list of dictionaries containing specifications for each CUDA device.
|
|
235
238
|
|
|
236
239
|
"""
|
|
@@ -325,7 +328,8 @@ def get_cuda_architecture() -> list[dict[str, Any]]:
|
|
|
325
328
|
'architecture': str,
|
|
326
329
|
}
|
|
327
330
|
|
|
328
|
-
Returns
|
|
331
|
+
Returns
|
|
332
|
+
-------
|
|
329
333
|
A list of dictionaries containing architecture information for each CUDA device.
|
|
330
334
|
|
|
331
335
|
"""
|
|
@@ -363,7 +367,8 @@ def get_cuda_architecture() -> list[dict[str, Any]]:
|
|
|
363
367
|
def retrieve_cuda_version() -> float:
|
|
364
368
|
"""Retrieve the CUDA driver version.
|
|
365
369
|
|
|
366
|
-
Returns
|
|
370
|
+
Returns
|
|
371
|
+
-------
|
|
367
372
|
str: CUDA version in the format "major.minor" or "unknown" if retrieval fails.
|
|
368
373
|
|
|
369
374
|
"""
|
|
@@ -115,7 +115,7 @@ class PMLBuilder:
|
|
|
115
115
|
pml_mask_x: NDArray[np.float64] = field(init=False)
|
|
116
116
|
pml_mask_y: NDArray[np.float64] = field(init=False)
|
|
117
117
|
|
|
118
|
-
def __init__(
|
|
118
|
+
def __init__(
|
|
119
119
|
self,
|
|
120
120
|
grid: fullwave.Grid,
|
|
121
121
|
medium: fullwave.Medium,
|
|
@@ -898,7 +898,7 @@ class PMLBuilder:
|
|
|
898
898
|
|
|
899
899
|
return extended_medium
|
|
900
900
|
|
|
901
|
-
def _apply_pml_3d(
|
|
901
|
+
def _apply_pml_3d(
|
|
902
902
|
self,
|
|
903
903
|
extended_medium: fullwave.MediumRelaxationMaps,
|
|
904
904
|
theoritical_reflection_coefficient: float,
|
|
@@ -1184,7 +1184,7 @@ class PMLBuilder:
|
|
|
1184
1184
|
|
|
1185
1185
|
return extended_medium
|
|
1186
1186
|
|
|
1187
|
-
def _apply_transition_and_pml( # noqa:
|
|
1187
|
+
def _apply_transition_and_pml( # noqa: PLR0912
|
|
1188
1188
|
self,
|
|
1189
1189
|
input_array: NDArray[np.float64],
|
|
1190
1190
|
value_target: float,
|
|
@@ -1465,7 +1465,7 @@ class PMLBuilder:
|
|
|
1465
1465
|
class PMLBuilderExponentialAttenuation(PMLBuilder):
|
|
1466
1466
|
"""A class to set up PML for exponential attenuation media."""
|
|
1467
1467
|
|
|
1468
|
-
def __init__(
|
|
1468
|
+
def __init__(
|
|
1469
1469
|
self,
|
|
1470
1470
|
grid: fullwave.Grid,
|
|
1471
1471
|
medium: fullwave.Medium,
|
|
@@ -17,10 +17,12 @@ def load_dat_data(dat_file_path: Path, dtype: DTypeLike = np.float32) -> NDArray
|
|
|
17
17
|
dat_file_path (Path): Path to the .dat file.
|
|
18
18
|
dtype: Data type to use when reading the file.
|
|
19
19
|
|
|
20
|
-
Raises
|
|
20
|
+
Raises
|
|
21
|
+
------
|
|
21
22
|
ValueError: if dat_file_path does not exist.
|
|
22
23
|
|
|
23
|
-
Returns
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
24
26
|
NDArray[np.float64]: Array of data read from the file.
|
|
25
27
|
|
|
26
28
|
"""
|
|
@@ -58,7 +60,8 @@ def load_dat_and_reshape(
|
|
|
58
60
|
n_sensors: Number of sensors
|
|
59
61
|
dtype: Data type to use when reading the file.
|
|
60
62
|
|
|
61
|
-
Returns
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
62
65
|
NDArray[np.float64]: Array of data read from the file.
|
|
63
66
|
|
|
64
67
|
"""
|
|
@@ -88,7 +91,8 @@ def initialize_relaxation_param_dict(
|
|
|
88
91
|
) -> dict[str, NDArray[np.float64]]:
|
|
89
92
|
"""Initialize a dictionary with relaxation parameters.
|
|
90
93
|
|
|
91
|
-
Returns
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
92
96
|
dict[str, NDArray[np.float64]]: Dictionary of relaxation parameters.
|
|
93
97
|
|
|
94
98
|
"""
|
|
@@ -125,10 +129,12 @@ def load_data_with_time_step(
|
|
|
125
129
|
dtype: Data type to use when reading the file.
|
|
126
130
|
time_step: Time step index to load.
|
|
127
131
|
|
|
128
|
-
Returns
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
129
134
|
NDArray[np.float64]: Array of data read from the file.
|
|
130
135
|
|
|
131
|
-
Raises
|
|
136
|
+
Raises
|
|
137
|
+
------
|
|
132
138
|
ValueError: if file_path does not exist.
|
|
133
139
|
|
|
134
140
|
"""
|
|
@@ -159,10 +165,12 @@ def load_data_with_sensor_index(
|
|
|
159
165
|
sensor_index: Sensor index to load.
|
|
160
166
|
dtype: Data type to use when reading the file.
|
|
161
167
|
|
|
162
|
-
Returns
|
|
168
|
+
Returns
|
|
169
|
+
-------
|
|
163
170
|
NDArray[np.float64]: Array of data read from the file.
|
|
164
171
|
|
|
165
|
-
Raises
|
|
172
|
+
Raises
|
|
173
|
+
------
|
|
166
174
|
ValueError: if file_path does not exist.
|
|
167
175
|
|
|
168
176
|
"""
|
|
@@ -30,7 +30,7 @@ class Source:
|
|
|
30
30
|
w0: NDArray[np.float64] | None = None
|
|
31
31
|
incoords_w: NDArray[np.int64] | None = None
|
|
32
32
|
|
|
33
|
-
def __init__( # noqa:
|
|
33
|
+
def __init__( # noqa: PLR0912
|
|
34
34
|
self,
|
|
35
35
|
p0: NDArray[np.float64] | None = None,
|
|
36
36
|
mask: NDArray[np.bool] | None = None,
|
|
@@ -22,7 +22,8 @@ logger = logging.getLogger("__main__." + __name__)
|
|
|
22
22
|
def _make_pos_int(val: float | tuple[float] | tuple[int]) -> NDArray[np.int64]:
|
|
23
23
|
"""Force value to be a positive integer.
|
|
24
24
|
|
|
25
|
-
Returns
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
26
27
|
NDArray[np.int64]: Array with positive integers.
|
|
27
28
|
|
|
28
29
|
"""
|
|
@@ -202,7 +203,7 @@ class TransducerGeometry:
|
|
|
202
203
|
) = self._create_element_coords()
|
|
203
204
|
logger.debug("TransducerGeometry instance created.")
|
|
204
205
|
|
|
205
|
-
def _init_dimensions( # noqa:
|
|
206
|
+
def _init_dimensions( # noqa: PLR0912
|
|
206
207
|
self,
|
|
207
208
|
grid: Grid,
|
|
208
209
|
element_width_px: int | None,
|
|
@@ -313,7 +314,7 @@ class TransducerGeometry:
|
|
|
313
314
|
assert len(position_m) == 3, "position_m must have 3 elements for 3D transducer"
|
|
314
315
|
return position_px, position_m
|
|
315
316
|
|
|
316
|
-
def _create_element_coords( # noqa: PLR0912
|
|
317
|
+
def _create_element_coords( # noqa: PLR0912
|
|
317
318
|
self,
|
|
318
319
|
) -> tuple[NDArray[np.int64], NDArray[np.int64], NDArray[np.int64], NDArray[np.int64]]:
|
|
319
320
|
"""Build flat coordinate arrays for source and sensor pixels.
|
|
@@ -813,15 +814,15 @@ class Transducer:
|
|
|
813
814
|
def source_coords(self) -> NDArray[np.int64]:
|
|
814
815
|
"""Coordinates of active source pixels; shape [N_src, ndim]."""
|
|
815
816
|
active_ids = np.where(self.active_source_elements)[0] + 1
|
|
816
|
-
mask = np.isin(self.transducer_geometry._source_ids, active_ids)
|
|
817
|
-
return self.transducer_geometry._source_coords[mask]
|
|
817
|
+
mask = np.isin(self.transducer_geometry._source_ids, active_ids)
|
|
818
|
+
return self.transducer_geometry._source_coords[mask]
|
|
818
819
|
|
|
819
820
|
@property
|
|
820
821
|
def sensor_coords(self) -> NDArray[np.int64]:
|
|
821
822
|
"""Coordinates of active sensor pixels; shape [N_snsr, ndim]."""
|
|
822
823
|
active_ids = np.where(self.active_sensor_elements)[0] + 1
|
|
823
|
-
mask = np.isin(self.transducer_geometry._sensor_ids, active_ids)
|
|
824
|
-
return self.transducer_geometry._sensor_coords[mask]
|
|
824
|
+
mask = np.isin(self.transducer_geometry._sensor_ids, active_ids)
|
|
825
|
+
return self.transducer_geometry._sensor_coords[mask]
|
|
825
826
|
|
|
826
827
|
@property
|
|
827
828
|
def element_id_to_element_surface(self) -> dict[int, NDArray[np.int64]]:
|
|
@@ -986,8 +987,8 @@ class Transducer:
|
|
|
986
987
|
@property
|
|
987
988
|
def element_id_to_element_center(self) -> dict[int, NDArray[np.int64]]:
|
|
988
989
|
"""Return the dictionary mapping element IDs to their center coordinates."""
|
|
989
|
-
coords = self.transducer_geometry._source_coords
|
|
990
|
-
ids = self.transducer_geometry._source_ids
|
|
990
|
+
coords = self.transducer_geometry._source_coords
|
|
991
|
+
ids = self.transducer_geometry._source_ids
|
|
991
992
|
n = self.transducer_geometry.number_elements
|
|
992
993
|
ndim = coords.shape[1] if len(coords) else (3 if self.is_3d else 2)
|
|
993
994
|
out: dict[int, NDArray[np.int64]] = {}
|
|
@@ -1049,7 +1050,7 @@ class Transducer:
|
|
|
1049
1050
|
|
|
1050
1051
|
it plots whole transducer geometry including the inactive/active source and sensor elements.
|
|
1051
1052
|
"""
|
|
1052
|
-
import matplotlib.pyplot as plt
|
|
1053
|
+
import matplotlib.pyplot as plt # noqa: PLC0415
|
|
1053
1054
|
|
|
1054
1055
|
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
|
|
1055
1056
|
plot_mask = np.zeros(self.transducer_geometry.stored_grid_size)
|
|
@@ -1089,7 +1090,7 @@ class Transducer:
|
|
|
1089
1090
|
|
|
1090
1091
|
it plots whole transducer geometry including the inactive/active source and sensor elements.
|
|
1091
1092
|
"""
|
|
1092
|
-
import matplotlib.pyplot as plt
|
|
1093
|
+
import matplotlib.pyplot as plt # noqa: PLC0415
|
|
1093
1094
|
|
|
1094
1095
|
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
|
|
1095
1096
|
plot_mask = np.zeros(self.transducer_geometry.stored_grid_size)
|
|
@@ -7,7 +7,8 @@ from typing import Any
|
|
|
7
7
|
def check_instance(target_var: Any, instances: list[Any] | Any) -> None: # noqa: ANN401
|
|
8
8
|
"""Check whether target_var is an instance of the specified type.
|
|
9
9
|
|
|
10
|
-
Raises
|
|
10
|
+
Raises
|
|
11
|
+
------
|
|
11
12
|
TypeError: If target_var is not an instance of instance.
|
|
12
13
|
|
|
13
14
|
"""
|
|
@@ -21,7 +22,8 @@ def check_instance(target_var: Any, instances: list[Any] | Any) -> None: # noqa
|
|
|
21
22
|
def check_path_exists(target_path: Path) -> None:
|
|
22
23
|
"""Check whether the provided target_path exists.
|
|
23
24
|
|
|
24
|
-
Raises
|
|
25
|
+
Raises
|
|
26
|
+
------
|
|
25
27
|
ValueError: If target_path does not exist.
|
|
26
28
|
|
|
27
29
|
"""
|
|
@@ -37,7 +39,8 @@ def check_compatible_value(
|
|
|
37
39
|
) -> None:
|
|
38
40
|
"""Check whether the provided value is in the list of compatible values.
|
|
39
41
|
|
|
40
|
-
Raises
|
|
42
|
+
Raises
|
|
43
|
+
------
|
|
41
44
|
ValueError: If value is not in compatible_values.
|
|
42
45
|
|
|
43
46
|
"""
|
|
@@ -16,7 +16,8 @@ def make_circle_idx(
|
|
|
16
16
|
cen: The center of the circle.
|
|
17
17
|
rad: The radius of the circle.
|
|
18
18
|
|
|
19
|
-
Returns
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
20
21
|
mask: The mask of the circle.
|
|
21
22
|
|
|
22
23
|
"""
|
|
@@ -32,7 +33,8 @@ def map_to_coords(
|
|
|
32
33
|
) -> NDArray[np.int64]:
|
|
33
34
|
"""Map the mask map to coordinates.
|
|
34
35
|
|
|
35
|
-
Returns
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
36
38
|
NDArray[np.int64]: An array of coordinates corresponding to non-zero elements in the mask.
|
|
37
39
|
|
|
38
40
|
"""
|
|
@@ -103,7 +105,8 @@ def map_to_coords_with_sort(map_data: NDArray[np.int64]) -> NDArray[np.int64]:
|
|
|
103
105
|
Args:
|
|
104
106
|
map_data: The mask map.
|
|
105
107
|
|
|
106
|
-
Returns
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
107
110
|
NDArray[np.int64]: An array of coordinates corresponding to non-zero elements in the mask.
|
|
108
111
|
|
|
109
112
|
"""
|
|
@@ -124,7 +127,8 @@ def map_to_coordinates(
|
|
|
124
127
|
is_3d: Whether the grid is 3D or not.
|
|
125
128
|
sort: Whether to sort the coordinates by the first dimension.
|
|
126
129
|
|
|
127
|
-
Returns
|
|
130
|
+
Returns
|
|
131
|
+
-------
|
|
128
132
|
NDArray[np.int64]: An array of coordinates corresponding to non-zero elements in the mask.
|
|
129
133
|
|
|
130
134
|
"""
|
|
@@ -31,7 +31,7 @@ class MemoryTempfile:
|
|
|
31
31
|
and create temporary files and directories.
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
|
-
def __init__( # noqa:
|
|
34
|
+
def __init__( # noqa: PLR0912
|
|
35
35
|
self,
|
|
36
36
|
*,
|
|
37
37
|
preferred_paths: list | None = None,
|
|
@@ -182,7 +182,7 @@ class MemoryTempfile:
|
|
|
182
182
|
self,
|
|
183
183
|
suffix: str | None = None,
|
|
184
184
|
prefix: str | None = None,
|
|
185
|
-
dir: str | None = None,
|
|
185
|
+
dir: str | None = None,
|
|
186
186
|
) -> str:
|
|
187
187
|
"""Create a temporary directory.
|
|
188
188
|
|
|
@@ -207,7 +207,7 @@ class MemoryTempfile:
|
|
|
207
207
|
self,
|
|
208
208
|
suffix: str | None = None,
|
|
209
209
|
prefix: str | None = None,
|
|
210
|
-
dir: str | None = None,
|
|
210
|
+
dir: str | None = None,
|
|
211
211
|
*,
|
|
212
212
|
text: bool = False,
|
|
213
213
|
) -> tuple[int, str]:
|
|
@@ -241,7 +241,7 @@ class MemoryTempfile:
|
|
|
241
241
|
self,
|
|
242
242
|
suffix: str | None = None,
|
|
243
243
|
prefix: str | None = None,
|
|
244
|
-
dir: str | None = None,
|
|
244
|
+
dir: str | None = None,
|
|
245
245
|
) -> tempfile.TemporaryDirectory[str]:
|
|
246
246
|
"""Create a temporary directory and return a TemporaryDirectory object.
|
|
247
247
|
|
|
@@ -275,7 +275,7 @@ class MemoryTempfile:
|
|
|
275
275
|
newline: str | None = None,
|
|
276
276
|
suffix: str | None = None,
|
|
277
277
|
prefix: str | None = None,
|
|
278
|
-
dir: str | None = None,
|
|
278
|
+
dir: str | None = None,
|
|
279
279
|
) -> tempfile.SpooledTemporaryFile:
|
|
280
280
|
"""Create a spooled temporary file.
|
|
281
281
|
|
|
@@ -329,7 +329,7 @@ class MemoryTempfile:
|
|
|
329
329
|
newline: str | None = None,
|
|
330
330
|
suffix: str | None = None,
|
|
331
331
|
prefix: str | None = None,
|
|
332
|
-
dir: str | None = None,
|
|
332
|
+
dir: str | None = None,
|
|
333
333
|
*,
|
|
334
334
|
delete: bool = True,
|
|
335
335
|
) -> tempfile.NamedTemporaryFile:
|
|
@@ -379,7 +379,7 @@ class MemoryTempfile:
|
|
|
379
379
|
newline: str | None = None,
|
|
380
380
|
suffix: str | None = None,
|
|
381
381
|
prefix: str | None = None,
|
|
382
|
-
dir: str | None = None,
|
|
382
|
+
dir: str | None = None,
|
|
383
383
|
) -> tempfile.TemporaryFile:
|
|
384
384
|
"""Create and return a temporary file.
|
|
385
385
|
|
|
@@ -13,7 +13,7 @@ from numpy.typing import NDArray
|
|
|
13
13
|
from tqdm import tqdm
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def plot_array( # noqa:
|
|
16
|
+
def plot_array( # noqa: PLR0912
|
|
17
17
|
x: NDArray[np.float64 | np.int64 | np.bool],
|
|
18
18
|
aspect: float | None = None,
|
|
19
19
|
vmin: float | None = None,
|
|
@@ -553,7 +553,7 @@ def plot_wave_propagation_animation(
|
|
|
553
553
|
animation_data.save(export_name, writer="ffmpeg", dpi=dpi)
|
|
554
554
|
|
|
555
555
|
|
|
556
|
-
def plot_wave_propagation_with_map(
|
|
556
|
+
def plot_wave_propagation_with_map(
|
|
557
557
|
propagation_map: NDArray[np.float64],
|
|
558
558
|
c_map: NDArray[np.float64],
|
|
559
559
|
rho_map: NDArray[np.float64],
|
|
@@ -868,7 +868,7 @@ def plot_wave_propagation_with_map( # noqa: PLR0915, C901
|
|
|
868
868
|
plt.close("all")
|
|
869
869
|
|
|
870
870
|
|
|
871
|
-
def plot_wave_propagation_snapshot(
|
|
871
|
+
def plot_wave_propagation_snapshot(
|
|
872
872
|
propagation_map: NDArray[np.float64],
|
|
873
873
|
c_map: NDArray[np.float64],
|
|
874
874
|
rho_map: NDArray[np.float64],
|
|
@@ -25,7 +25,7 @@ def _check_cupy() -> bool:
|
|
|
25
25
|
global _CUPY_AVAILABLE # noqa: PLW0603
|
|
26
26
|
if _CUPY_AVAILABLE is None:
|
|
27
27
|
try:
|
|
28
|
-
import cupy # noqa: F401
|
|
28
|
+
import cupy # noqa: F401, PLC0415
|
|
29
29
|
|
|
30
30
|
_CUPY_AVAILABLE = True
|
|
31
31
|
except ImportError:
|
|
@@ -145,7 +145,7 @@ def apply_filter(
|
|
|
145
145
|
)
|
|
146
146
|
|
|
147
147
|
if use_gpu and _check_cupy():
|
|
148
|
-
import cupy as cp
|
|
148
|
+
import cupy as cp # noqa: PLC0415
|
|
149
149
|
|
|
150
150
|
logger.debug("apply_filter: using CuPy GPU backend")
|
|
151
151
|
data_gpu = cp.asarray(data, dtype=cp.float64)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fullwave25"
|
|
3
|
-
version = "1.2.6-
|
|
3
|
+
version = "1.2.6-dev3" # Update via bump-my-version, not manually
|
|
4
4
|
description = "Fullwave 2.5: Ultrasound wave propagation simulation with heterogeneous power law attenuation modelling capabilities"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|