AOT-biomaps 2.1.3__py3-none-any.whl → 2.9.233__py3-none-any.whl
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 AOT-biomaps might be problematic. Click here for more details.
- AOT_biomaps/AOT_Acoustic/AcousticEnums.py +64 -0
- AOT_biomaps/AOT_Acoustic/AcousticTools.py +221 -0
- AOT_biomaps/AOT_Acoustic/FocusedWave.py +244 -0
- AOT_biomaps/AOT_Acoustic/IrregularWave.py +66 -0
- AOT_biomaps/AOT_Acoustic/PlaneWave.py +43 -0
- AOT_biomaps/AOT_Acoustic/StructuredWave.py +392 -0
- AOT_biomaps/AOT_Acoustic/__init__.py +15 -0
- AOT_biomaps/AOT_Acoustic/_mainAcoustic.py +978 -0
- AOT_biomaps/AOT_Experiment/Focus.py +55 -0
- AOT_biomaps/AOT_Experiment/Tomography.py +505 -0
- AOT_biomaps/AOT_Experiment/__init__.py +9 -0
- AOT_biomaps/AOT_Experiment/_mainExperiment.py +532 -0
- AOT_biomaps/AOT_Optic/Absorber.py +24 -0
- AOT_biomaps/AOT_Optic/Laser.py +70 -0
- AOT_biomaps/AOT_Optic/OpticEnums.py +17 -0
- AOT_biomaps/AOT_Optic/__init__.py +10 -0
- AOT_biomaps/AOT_Optic/_mainOptic.py +204 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/DEPIERRO.py +191 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/LS.py +106 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/MAPEM.py +456 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/MLEM.py +333 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/PDHG.py +221 -0
- AOT_biomaps/AOT_Recon/AOT_Optimizers/__init__.py +5 -0
- AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Huber.py +90 -0
- AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Quadratic.py +86 -0
- AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/RelativeDifferences.py +59 -0
- AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/__init__.py +3 -0
- AOT_biomaps/AOT_Recon/AlgebraicRecon.py +1023 -0
- AOT_biomaps/AOT_Recon/AnalyticRecon.py +154 -0
- AOT_biomaps/AOT_Recon/BayesianRecon.py +230 -0
- AOT_biomaps/AOT_Recon/DeepLearningRecon.py +35 -0
- AOT_biomaps/AOT_Recon/PrimalDualRecon.py +210 -0
- AOT_biomaps/AOT_Recon/ReconEnums.py +375 -0
- AOT_biomaps/AOT_Recon/ReconTools.py +273 -0
- AOT_biomaps/AOT_Recon/__init__.py +11 -0
- AOT_biomaps/AOT_Recon/_mainRecon.py +288 -0
- AOT_biomaps/Config.py +95 -0
- AOT_biomaps/Settings.py +45 -13
- AOT_biomaps/__init__.py +271 -18
- aot_biomaps-2.9.233.dist-info/METADATA +22 -0
- aot_biomaps-2.9.233.dist-info/RECORD +43 -0
- {AOT_biomaps-2.1.3.dist-info → aot_biomaps-2.9.233.dist-info}/WHEEL +1 -1
- AOT_biomaps/AOT_Acoustic.py +0 -1881
- AOT_biomaps/AOT_Experiment.py +0 -541
- AOT_biomaps/AOT_Optic.py +0 -219
- AOT_biomaps/AOT_Reconstruction.py +0 -1416
- AOT_biomaps/config.py +0 -54
- AOT_biomaps-2.1.3.dist-info/METADATA +0 -20
- AOT_biomaps-2.1.3.dist-info/RECORD +0 -11
- {AOT_biomaps-2.1.3.dist-info → aot_biomaps-2.9.233.dist-info}/top_level.txt +0 -0
AOT_biomaps/AOT_Optic.py
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from enum import Enum
|
|
3
|
-
from .config import config
|
|
4
|
-
import AOT_biomaps.Settings
|
|
5
|
-
import matplotlib.pyplot as plt
|
|
6
|
-
|
|
7
|
-
class OpticFieldType(Enum):
|
|
8
|
-
"""
|
|
9
|
-
Enumeration of available optic field types.
|
|
10
|
-
|
|
11
|
-
Selection of optic field types:
|
|
12
|
-
- GAUSSIAN: A Gaussian optic field type.
|
|
13
|
-
- UNIFORM: A uniform optic field type.
|
|
14
|
-
- SPHERICAL: A spherical optic field type.
|
|
15
|
-
"""
|
|
16
|
-
GAUSSIAN = "Gaussian"
|
|
17
|
-
"""A Gaussian optic field type."""
|
|
18
|
-
UNIFORM = "Uniform"
|
|
19
|
-
"""A uniform optic field type."""
|
|
20
|
-
SPHERICAL = "Spherical"
|
|
21
|
-
"""A spherical optic field type."""
|
|
22
|
-
|
|
23
|
-
class Phantom:
|
|
24
|
-
"""
|
|
25
|
-
Class to apply absorbers to a laser field in the XZ plane.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
class Laser:
|
|
29
|
-
def __init__(self, params):
|
|
30
|
-
"""
|
|
31
|
-
Initializes the laser with the given parameters.
|
|
32
|
-
|
|
33
|
-
:param params: Configuration parameters for the laser.
|
|
34
|
-
"""
|
|
35
|
-
try:
|
|
36
|
-
self.x = np.arange(params.general['Xrange'][0], params.general['Xrange'][1], params.general['dx']) * 1000
|
|
37
|
-
self.z = np.arange(params.general['Zrange'][0], params.general['Zrange'][1], params.general['dz']) * 1000
|
|
38
|
-
self.shape = OpticFieldType(params.optic['laser']['shape'].capitalize())
|
|
39
|
-
self.center = params.optic['laser']['center']
|
|
40
|
-
self.w0 = params.optic['laser']['w0'] * 1000
|
|
41
|
-
self._set_intensity()
|
|
42
|
-
|
|
43
|
-
if type(params) != AOT_biomaps.Settings.Params:
|
|
44
|
-
raise TypeError("params must be an instance of the Params class")
|
|
45
|
-
|
|
46
|
-
except KeyError as e:
|
|
47
|
-
raise ValueError(f"Missing parameter: {e}")
|
|
48
|
-
except ValueError as e:
|
|
49
|
-
raise ValueError(f"Invalid laser shape: {e}")
|
|
50
|
-
|
|
51
|
-
def _set_intensity(self):
|
|
52
|
-
"""
|
|
53
|
-
Sets the intensity of the beam based on its shape.
|
|
54
|
-
"""
|
|
55
|
-
try:
|
|
56
|
-
if self.shape == OpticFieldType.GAUSSIAN:
|
|
57
|
-
self.intensity = self._gaussian_beam()
|
|
58
|
-
elif self.shape == OpticFieldType.UNIFORM:
|
|
59
|
-
raise NotImplementedError("Uniform beam not implemented yet.")
|
|
60
|
-
elif self.shape == OpticFieldType.SPHERICAL:
|
|
61
|
-
raise NotImplementedError("Spherical beam not implemented yet.")
|
|
62
|
-
else:
|
|
63
|
-
raise ValueError("Unknown beam shape.")
|
|
64
|
-
except Exception as e:
|
|
65
|
-
raise RuntimeError(f"Error setting intensity: {e}")
|
|
66
|
-
|
|
67
|
-
def _gaussian_beam(self):
|
|
68
|
-
"""
|
|
69
|
-
Generates a Gaussian laser beam in the XZ plane.
|
|
70
|
-
|
|
71
|
-
:return: Intensity matrix of the Gaussian beam.
|
|
72
|
-
"""
|
|
73
|
-
try:
|
|
74
|
-
if self.center == 'center':
|
|
75
|
-
x0 = (self.x[0] + self.x[-1]) / 2
|
|
76
|
-
z0 = (self.z[0] + self.z[-1]) / 2
|
|
77
|
-
else:
|
|
78
|
-
x0, z0 = self.center * 1000
|
|
79
|
-
X, Z = np.meshgrid(self.x, self.z, indexing='ij')
|
|
80
|
-
return np.exp(-2 * ((X - x0)**2 + (Z - z0)**2) / self.w0**2)
|
|
81
|
-
except Exception as e:
|
|
82
|
-
raise RuntimeError(f"Error generating Gaussian beam: {e}")
|
|
83
|
-
|
|
84
|
-
def show_laser(self):
|
|
85
|
-
"""
|
|
86
|
-
Displays the laser intensity distribution.
|
|
87
|
-
"""
|
|
88
|
-
try:
|
|
89
|
-
plt.imshow(self.laser.intensity, extent=(self.laser.x[0], self.laser.x[-1] + 1, self.laser.z[-1], self.laser.z[0]), aspect='auto', cmap='hot')
|
|
90
|
-
plt.colorbar(label='Intensity')
|
|
91
|
-
plt.xlabel('X (mm)', fontsize=20)
|
|
92
|
-
plt.ylabel('Z (mm)', fontsize=20)
|
|
93
|
-
plt.tick_params(axis='both', which='major', labelsize=20)
|
|
94
|
-
plt.title('Laser Intensity Distribution')
|
|
95
|
-
plt.show()
|
|
96
|
-
except Exception as e:
|
|
97
|
-
raise RuntimeError(f"Error plotting laser intensity: {e}")
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class Absorber:
|
|
101
|
-
|
|
102
|
-
def __init__(self, name, type, center, radius, amplitude):
|
|
103
|
-
"""
|
|
104
|
-
Initializes an absorber with the given parameters.
|
|
105
|
-
|
|
106
|
-
:param name: Name of the absorber.
|
|
107
|
-
:param type: Type of the absorber.
|
|
108
|
-
:param center: Center of the absorber.
|
|
109
|
-
:param radius: Radius of the absorber.
|
|
110
|
-
:param amplitude: Amplitude of the absorber.
|
|
111
|
-
"""
|
|
112
|
-
self.name = name
|
|
113
|
-
self.type = type
|
|
114
|
-
self.center = center
|
|
115
|
-
self.radius = radius
|
|
116
|
-
self.amplitude = amplitude
|
|
117
|
-
|
|
118
|
-
def __repr__(self):
|
|
119
|
-
"""
|
|
120
|
-
String representation of the absorber.
|
|
121
|
-
|
|
122
|
-
:return: String representing the absorber.
|
|
123
|
-
"""
|
|
124
|
-
return (f"Absorber(name={self.name}, type={self.type}, "
|
|
125
|
-
f"center={self.center}, radius={self.radius}, amplitude={self.amplitude})")
|
|
126
|
-
|
|
127
|
-
def __init__(self, params):
|
|
128
|
-
"""
|
|
129
|
-
Initializes the phantom with the given parameters.
|
|
130
|
-
|
|
131
|
-
:param params: Configuration parameters for the phantom.
|
|
132
|
-
"""
|
|
133
|
-
try:
|
|
134
|
-
absorber_params = params.optic['absorbers']
|
|
135
|
-
self.absorbers = [self.Absorber(**a) for a in absorber_params]
|
|
136
|
-
self.laser = self.Laser(params)
|
|
137
|
-
self.phantom = self._apply_absorbers()
|
|
138
|
-
self.phantom = np.transpose(self.phantom)
|
|
139
|
-
except KeyError as e:
|
|
140
|
-
raise ValueError(f"Missing parameter: {e}")
|
|
141
|
-
except Exception as e:
|
|
142
|
-
raise RuntimeError(f"Error initializing Phantom: {e}")
|
|
143
|
-
|
|
144
|
-
def _apply_absorbers(self):
|
|
145
|
-
"""
|
|
146
|
-
Applies the absorbers to the laser field.
|
|
147
|
-
|
|
148
|
-
:return: Intensity matrix of the phantom with applied absorbers.
|
|
149
|
-
"""
|
|
150
|
-
try:
|
|
151
|
-
X, Z = np.meshgrid(self.laser.x, self.laser.z, indexing='ij')
|
|
152
|
-
intensity = np.copy(self.laser.intensity)
|
|
153
|
-
|
|
154
|
-
for absorber in self.absorbers:
|
|
155
|
-
r2 = (X - absorber.center[0] * 1000)**2 + (Z - absorber.center[1] * 1000)**2
|
|
156
|
-
absorption = -absorber.amplitude * np.exp(-r2 / (absorber.radius * 1000)**2)
|
|
157
|
-
intensity += absorption
|
|
158
|
-
|
|
159
|
-
return np.clip(intensity, 0, None)
|
|
160
|
-
except Exception as e:
|
|
161
|
-
raise RuntimeError(f"Error applying absorbers: {e}")
|
|
162
|
-
|
|
163
|
-
def __str__(self):
|
|
164
|
-
"""
|
|
165
|
-
Returns a string representation of the Phantom object,
|
|
166
|
-
including its laser and absorber parameters.
|
|
167
|
-
|
|
168
|
-
:return: String representing the Phantom object.
|
|
169
|
-
"""
|
|
170
|
-
try:
|
|
171
|
-
# Laser attributes
|
|
172
|
-
laser_attrs = {
|
|
173
|
-
'shape': self.laser.shape.name.capitalize(),
|
|
174
|
-
'center': self.laser.center,
|
|
175
|
-
'w0': self.laser.w0,
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
laser_attr_lines = [f" {k}: {v}" for k, v in laser_attrs.items()]
|
|
179
|
-
|
|
180
|
-
# Absorber attributes
|
|
181
|
-
absorber_lines = []
|
|
182
|
-
for absorber in self.absorbers:
|
|
183
|
-
absorber_lines.append(f" - name: \"{absorber.name}\"")
|
|
184
|
-
absorber_lines.append(f" type: \"{absorber.type}\"")
|
|
185
|
-
absorber_lines.append(f" center: {absorber.center}")
|
|
186
|
-
absorber_lines.append(f" radius: {absorber.radius}")
|
|
187
|
-
absorber_lines.append(f" amplitude: {absorber.amplitude}")
|
|
188
|
-
|
|
189
|
-
# Define borders and titles
|
|
190
|
-
border = "+" + "-" * 40 + "+"
|
|
191
|
-
title = f"| Type : {self.__class__.__name__} |"
|
|
192
|
-
laser_title = "| Laser Parameters |"
|
|
193
|
-
absorber_title = "| Absorbers |"
|
|
194
|
-
|
|
195
|
-
# Assemble the final result
|
|
196
|
-
result = f"{border}\n{title}\n{border}\n{laser_title}\n{border}\n"
|
|
197
|
-
result += "\n".join(laser_attr_lines)
|
|
198
|
-
result += f"\n{border}\n{absorber_title}\n{border}\n"
|
|
199
|
-
result += "\n".join(absorber_lines)
|
|
200
|
-
result += f"\n{border}"
|
|
201
|
-
|
|
202
|
-
return result
|
|
203
|
-
except Exception as e:
|
|
204
|
-
raise RuntimeError(f"Error generating string representation: {e}")
|
|
205
|
-
|
|
206
|
-
def show_phantom(self):
|
|
207
|
-
"""
|
|
208
|
-
Displays the optical phantom with absorbers.
|
|
209
|
-
"""
|
|
210
|
-
try:
|
|
211
|
-
plt.imshow(self.phantom, extent=(self.laser.x[0], self.laser.x[-1] + 1, self.laser.z[-1], self.laser.z[0]), aspect='equal', cmap='hot')
|
|
212
|
-
plt.colorbar(label='Intensity')
|
|
213
|
-
plt.xlabel('X (mm)', fontsize=20)
|
|
214
|
-
plt.ylabel('Z (mm)', fontsize=20)
|
|
215
|
-
plt.tick_params(axis='both', which='major', labelsize=20)
|
|
216
|
-
plt.title('Optical Phantom with Absorbers')
|
|
217
|
-
plt.show()
|
|
218
|
-
except Exception as e:
|
|
219
|
-
raise RuntimeError(f"Error plotting phantom: {e}")
|