AOT-biomaps 2.9.217__py3-none-any.whl → 2.9.219__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.

@@ -301,11 +301,6 @@ class Experiment(ABC):
301
301
  n_acquisitions_per_event = int([line.split(":")[1].strip() for line in cdh_content if "Number of acquisitions per event" in line][0])
302
302
  num_elements = int([line.split(":")[1].strip() for line in cdh_content if "Number of US transducers" in line][0])
303
303
 
304
- print(f"Nombre de scans : {n_scans}")
305
- print(f"Nombre d'acquisitions par événement : {n_acquisitions_per_event}")
306
- print(f"Nombre d'éléments US : {num_elements}")
307
-
308
-
309
304
  # Initialisation des structures
310
305
  AO_signal = np.zeros((n_acquisitions_per_event, n_scans), dtype=np.float32)
311
306
  active_lists = []
@@ -9,26 +9,24 @@ def _Omega_RELATIVE_DIFFERENCE_CPU(theta_flat, index, values, gamma):
9
9
  theta_k = theta_flat[k_idx]
10
10
  diff = theta_k - theta_j
11
11
  abs_diff = np.abs(diff)
12
-
13
12
  denom = theta_k + theta_j + gamma * abs_diff + 1e-8
14
13
  num = diff ** 2
15
-
14
+ psi_pair = num / denom
15
+ psi_pair = values * psi_pair
16
16
  # First derivative ∂U/∂θ_j
17
17
  dpsi = (2 * diff * denom - num * (1 + gamma * np.sign(diff))) / (denom ** 2)
18
18
  grad_pair = values * (-dpsi) # Note the negative sign: U contains ψ(θ_k, θ_j), seeking ∂/∂θ_j
19
-
20
19
  # Second derivative ∂²U/∂θ_j² (numerically stable, approximate treatment)
21
20
  d2psi = (2 * denom ** 2 - 4 * diff * denom * (1 + gamma * np.sign(diff))
22
21
  + 2 * num * (1 + gamma * np.sign(diff)) ** 2) / (denom ** 3 + 1e-8)
23
22
  hess_pair = values * d2psi
24
-
25
23
  grad_U = np.zeros_like(theta_flat)
26
24
  hess_U = np.zeros_like(theta_flat)
27
-
28
25
  np.add.at(grad_U, j_idx, grad_pair)
29
26
  np.add.at(hess_U, j_idx, hess_pair)
30
-
31
- return grad_U, hess_U
27
+ # Compute U_value
28
+ U_value = 0.5 * np.sum(psi_pair)
29
+ return grad_U, hess_U, U_value
32
30
 
33
31
  def _Omega_RELATIVE_DIFFERENCE_GPU(theta_flat, index, values, device, gamma):
34
32
  j_idx, k_idx = index
@@ -38,26 +36,24 @@ def _Omega_RELATIVE_DIFFERENCE_GPU(theta_flat, index, values, device, gamma):
38
36
  abs_diff = torch.abs(diff)
39
37
  denom = theta_k + theta_j + gamma * abs_diff + 1e-8
40
38
  num = diff ** 2
41
-
39
+ psi_pair = num / denom
40
+ psi_pair = values * psi_pair
42
41
  # Compute gradient contributions
43
42
  dpsi = (2 * diff * denom - num * (1 + gamma * torch.sign(diff))) / (denom ** 2)
44
43
  grad_pair = values * (-dpsi)
45
-
46
44
  # Compute Hessian contributions
47
45
  d2psi = (2 * denom ** 2 - 4 * diff * denom * (1 + gamma * torch.sign(diff))
48
46
  + 2 * num * (1 + gamma * torch.sign(diff)) ** 2) / (denom ** 3 + 1e-8)
49
47
  hess_pair = values * d2psi
50
-
51
48
  # Initialize gradient and Hessian on the correct device
52
49
  grad_U = torch.zeros_like(theta_flat, device=device)
53
50
  hess_U = torch.zeros_like(theta_flat, device=device)
54
-
55
51
  # Accumulate gradient contributions
56
52
  grad_U.index_add_(0, j_idx, grad_pair)
57
53
  grad_U.index_add_(0, k_idx, -grad_pair)
58
-
59
54
  # Accumulate Hessian contributions
60
55
  hess_U.index_add_(0, j_idx, hess_pair)
61
56
  hess_U.index_add_(0, k_idx, hess_pair)
62
-
63
- return grad_U, hess_U
57
+ # Compute U_value
58
+ U_value = 0.5 * psi_pair.sum()
59
+ return grad_U, hess_U, U_value
@@ -700,29 +700,46 @@ class AlgebraicRecon(Recon):
700
700
  if withTumor:
701
701
  if self.experiment.AOsignal_withTumor is None:
702
702
  raise ValueError("AO signal with tumor is not available. Please generate AO signal with tumor the experiment first in the experiment object.")
703
- else:
704
- y = self.experiment.AOsignal_withTumor
705
703
  else:
706
704
  if self.experiment.AOsignal_withoutTumor is None:
707
705
  raise ValueError("AO signal without tumor is not available. Please generate AO signal without tumor the experiment first in the experiment object.")
708
- else:
709
- y = self.experiment.AOsignal_withoutTumor
710
706
 
711
707
  if self.optimizer.value == OptimizerType.MLEM.value:
712
- self.reconPhantom, self.indices = MLEM(SMatrix=self.SMatrix,
713
- y=y,
714
- numIterations=self.numIterations,
715
- isSavingEachIteration=self.isSavingEachIteration,
716
- withTumor=withTumor,
717
- use_multi_gpu= self.isMultiGPU,
718
- use_numba= self.isMultiCPU,
719
- max_saves=self.maxSaves
720
- )
708
+ if withTumor:
709
+ self.reconPhantom, self.indices = MLEM(SMatrix=self.SMatrix,
710
+ y=self.experiment.AOsignal_withTumor,
711
+ numIterations=self.numIterations,
712
+ isSavingEachIteration=self.isSavingEachIteration,
713
+ withTumor=withTumor,
714
+ use_multi_gpu= self.isMultiGPU,
715
+ use_numba= self.isMultiCPU,
716
+ max_saves=self.maxSaves
717
+ )
718
+ else:
719
+ self.reconLaser, self.indices = MLEM(SMatrix=self.SMatrix,
720
+ y=self.experiment.AOsignal_withoutTumor,
721
+ numIterations=self.numIterations,
722
+ isSavingEachIteration=self.isSavingEachIteration,
723
+ withTumor=withTumor,
724
+ use_multi_gpu= self.isMultiGPU,
725
+ use_numba= self.isMultiCPU,
726
+ max_saves=self.maxSaves
727
+ )
721
728
  elif self.optimizer.value == OptimizerType.LS.value:
722
729
  if self.alpha is None:
723
730
  raise ValueError("Alpha (regularization parameter) must be set for LS reconstruction.")
724
- self.reconPhantom, self.indices = LS(SMatrix=self.SMatrix,
725
- y=y,
731
+ if withTumor:
732
+ self.reconPhantom, self.indices = LS(SMatrix=self.SMatrix,
733
+ y=self.experiment.AOsignal_withTumor,
734
+ numIterations=self.numIterations,
735
+ isSavingEachIteration=self.isSavingEachIteration,
736
+ withTumor=withTumor,
737
+ alpha=self.alpha,
738
+ max_saves=self.maxSaves,
739
+ )
740
+ else:
741
+ self.reconLaser, self.indices = LS(SMatrix=self.SMatrix,
742
+ y=self.experiment.AOsignal_withoutTumor,
726
743
  numIterations=self.numIterations,
727
744
  isSavingEachIteration=self.isSavingEachIteration,
728
745
  withTumor=withTumor,
@@ -148,12 +148,6 @@ class PrimalDualRecon(AlgebraicRecon):
148
148
 
149
149
 
150
150
  def _convexReconPython(self, withTumor):
151
- if withTumor:
152
- y=self.experiment.AOsignal_withTumor
153
-
154
- else:
155
- y=self.experiment.AOsignal_withoutTumor
156
-
157
151
  if self.optimizer == OptimizerType.CP_TV:
158
152
  if withTumor:
159
153
  self.reconPhantom, self.indices = CP_TV(
AOT_biomaps/__init__.py CHANGED
@@ -82,7 +82,7 @@ from .AOT_Recon.AOT_PotentialFunctions.RelativeDifferences import *
82
82
  from .Config import config
83
83
  from .Settings import *
84
84
 
85
- __version__ = '2.9.217'
85
+ __version__ = '2.9.219'
86
86
  __process__ = config.get_process()
87
87
 
88
88
  def initialize(process=None):
@@ -251,6 +251,8 @@ def initialize(process=None):
251
251
 
252
252
 
253
253
 
254
+
255
+
254
256
 
255
257
 
256
258
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AOT_biomaps
3
- Version: 2.9.217
3
+ Version: 2.9.219
4
4
  Summary: Acousto-Optic Tomography
5
5
  Home-page: https://github.com/LucasDuclos/AcoustoOpticTomography
6
6
  Author: Lucas Duclos
@@ -1,6 +1,6 @@
1
1
  AOT_biomaps/Config.py,sha256=ghEOP1n8aO1pR-su13wMeAZAxZRfry5hH67NbtZ8SqI,3614
2
2
  AOT_biomaps/Settings.py,sha256=v8fPhnvvcfBJP29m1RLOTEr3jndGLGwbUiORXmsj2Bo,2853
3
- AOT_biomaps/__init__.py,sha256=a5-mladvHgmA_M1WKbypLCFGpl5fYpD17MwJ4SLWkv4,4304
3
+ AOT_biomaps/__init__.py,sha256=38jdZ4Xsj9DQtz91An6hfnZq6apgWu5JkmlaeQ4el30,4308
4
4
  AOT_biomaps/AOT_Acoustic/AcousticEnums.py,sha256=s5kXa6jKzbS4btwbubrVcynLOr0yg5tth5vL_FGfbMk,1802
5
5
  AOT_biomaps/AOT_Acoustic/AcousticTools.py,sha256=al7xXKMY5e-qQQ7nrQVPVAmqYiB320OluNlY6ti8iKc,7539
6
6
  AOT_biomaps/AOT_Acoustic/FocusedWave.py,sha256=3kGKKDx_3Msy5COYqIwzROPORGWvNjw8UsDanBfkMXE,11037
@@ -12,17 +12,17 @@ AOT_biomaps/AOT_Acoustic/_mainAcoustic.py,sha256=RdmhRF1i0KAlpsP7_wnZ7F4J27br3eU
12
12
  AOT_biomaps/AOT_Experiment/Focus.py,sha256=B2nBawmv-NG2AWJx9zgQ8GlN6aFB9FwTSqX-M-phKXg,3193
13
13
  AOT_biomaps/AOT_Experiment/Tomography.py,sha256=LoQ304X9pUwpGn_BqNx1JijRFBFtI5Vz2R7bFIKyYKM,20954
14
14
  AOT_biomaps/AOT_Experiment/__init__.py,sha256=H9zMLeBLA6uhbaHohAa-2u5mDDxqJi8oE5c6tShdQp8,308
15
- AOT_biomaps/AOT_Experiment/_mainExperiment.py,sha256=Jv25qvTyh4FU1POC1PIyodvLCi-wfRCeiLoR3RfpklI,24886
15
+ AOT_biomaps/AOT_Experiment/_mainExperiment.py,sha256=1iB1gqWuPFE_jPUPQI9bb380qPmMP1FLE3SSLMlB5xw,24678
16
16
  AOT_biomaps/AOT_Optic/Absorber.py,sha256=jEodzRy7gkEH-wbazVasRQiri0dU16BfapmR-qnTSvM,867
17
17
  AOT_biomaps/AOT_Optic/Laser.py,sha256=uzQwxswjU0kZWix3CmZLoWmhsBa3VhN27STprNv-xB8,2986
18
18
  AOT_biomaps/AOT_Optic/OpticEnums.py,sha256=b349_JyjHqQohmjK4Wke-A_HLGaqb3_BKbyUqFC4jxY,499
19
19
  AOT_biomaps/AOT_Optic/__init__.py,sha256=HSUVhfz0NzwHHZZ9KP9Xyfu33IgP_rYJX86J-gEROlo,321
20
20
  AOT_biomaps/AOT_Optic/_mainOptic.py,sha256=Wk63CcgWbU-ygMfjNK80islaUbGGJpTXgZY3_C2KQNY,8179
21
- AOT_biomaps/AOT_Recon/AlgebraicRecon.py,sha256=kebjUSqbyMGIZ-X57GV3zgkUunh2r41RxIbHaKY71w8,41412
21
+ AOT_biomaps/AOT_Recon/AlgebraicRecon.py,sha256=g1JEwsi2BFljptPNzNhe0qKiua2DVYNYVUb6zMPrsWU,42833
22
22
  AOT_biomaps/AOT_Recon/AnalyticRecon.py,sha256=vjeTUnaZrtnLHnx6goseeJsd165KbSugQYwUXJFXapU,7596
23
23
  AOT_biomaps/AOT_Recon/BayesianRecon.py,sha256=WeE_512cBVOB__72132Ifvgb0E40gkjmQTXnwY_cZtk,16357
24
24
  AOT_biomaps/AOT_Recon/DeepLearningRecon.py,sha256=RfVcEsi4GeGqJn0_SPxwQPQx6IQjin79WKh2UarMRLI,1383
25
- AOT_biomaps/AOT_Recon/PrimalDualRecon.py,sha256=RM7yssmQkrNggU_RHZmgXp36ecu0nbLCTSh_G24ii8E,10090
25
+ AOT_biomaps/AOT_Recon/PrimalDualRecon.py,sha256=RiQBHZrZ3CICb4GxwBJVIdNrKfkZz7o9RJLNYnl-XlA,9945
26
26
  AOT_biomaps/AOT_Recon/ReconEnums.py,sha256=oyT9qIfEpE_ChPQihM8-6b0UOtNmuE4weUpO8lJCB38,18641
27
27
  AOT_biomaps/AOT_Recon/ReconTools.py,sha256=zPGwoDHX5H7v78onHAlFwZ8OdjZVsX6PAJFrTiikqEc,10608
28
28
  AOT_biomaps/AOT_Recon/__init__.py,sha256=LDbNpsjS8_TJrXMKzkpzSAj5trVuCW57AWQaJBrzd0I,244
@@ -35,9 +35,9 @@ AOT_biomaps/AOT_Recon/AOT_Optimizers/PDHG.py,sha256=5w4klYKAct9_gnlyocIiJfDrQUdz
35
35
  AOT_biomaps/AOT_Recon/AOT_Optimizers/__init__.py,sha256=tNGVulINaqQZzcs5cvCMAT5ypGdoFWRnxtl9y7ePECk,106
36
36
  AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Huber.py,sha256=dRd1t5OBag_gVmfji3L0QrA1GJ_702LcCkLH32Bot0M,3285
37
37
  AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Quadratic.py,sha256=wTbzcXxMdEl9ReEXrL43DOJQecokBwJYU_s2kQUASZY,2545
38
- AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/RelativeDifferences.py,sha256=dgB3Vt40S5D1VerHr-h-YnzB5xNCt6amE19-C0zyIpU,2253
38
+ AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/RelativeDifferences.py,sha256=ZlWaKsNPCMfy4fWxYFT2pSoKMbysQkJH4N1WbbWncq4,2493
39
39
  AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/__init__.py,sha256=RwrJdLOFbAFBFnRxo5xdlOyeZgtQRDaRWDN9-uCGUiY,84
40
- aot_biomaps-2.9.217.dist-info/METADATA,sha256=brSxYFUSU9Q3wZC2LleSVDbMvvYk5pjzdAdZQMptPzE,663
41
- aot_biomaps-2.9.217.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
- aot_biomaps-2.9.217.dist-info/top_level.txt,sha256=6STF-lT4kaAnBHJYCripmN5mZABoHjMuY689JdiDphk,12
43
- aot_biomaps-2.9.217.dist-info/RECORD,,
40
+ aot_biomaps-2.9.219.dist-info/METADATA,sha256=l0YeqS4U6dqjUzoYiOWl0r-gjEed92_LwnWGDajLEtA,663
41
+ aot_biomaps-2.9.219.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
+ aot_biomaps-2.9.219.dist-info/top_level.txt,sha256=6STF-lT4kaAnBHJYCripmN5mZABoHjMuY689JdiDphk,12
43
+ aot_biomaps-2.9.219.dist-info/RECORD,,