AOT-biomaps 2.9.376__tar.gz → 2.9.378__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.
Files changed (53) hide show
  1. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/StructuredWave.py +2 -1
  2. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/_mainAcoustic.py +42 -24
  3. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/__init__.py +3 -1
  4. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/PKG-INFO +1 -1
  5. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/PKG-INFO +1 -1
  6. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/setup.py +3 -1
  7. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/AcousticEnums.py +0 -0
  8. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/AcousticTools.py +0 -0
  9. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/FocusedWave.py +0 -0
  10. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/IrregularWave.py +0 -0
  11. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/PlaneWave.py +0 -0
  12. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/__init__.py +0 -0
  13. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/ExperimentTools.py +0 -0
  14. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/Focus.py +0 -0
  15. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/Tomography.py +0 -0
  16. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/__init__.py +0 -0
  17. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/_mainExperiment.py +0 -0
  18. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/Absorber.py +0 -0
  19. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/Laser.py +0 -0
  20. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/OpticEnums.py +0 -0
  21. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/__init__.py +0 -0
  22. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/_mainOptic.py +0 -0
  23. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/DEPIERRO.py +0 -0
  24. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/LS.py +0 -0
  25. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/MAPEM.py +0 -0
  26. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/MLEM.py +0 -0
  27. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/PDHG.py +0 -0
  28. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/__init__.py +0 -0
  29. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Huber.py +0 -0
  30. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Quadratic.py +0 -0
  31. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/RelativeDifferences.py +0 -0
  32. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/__init__.py +0 -0
  33. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/SparseSMatrix_CSR.py +0 -0
  34. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/SparseSMatrix_SELL.py +0 -0
  35. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/__init__.py +0 -0
  36. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_biomaps_kernels.cubin +0 -0
  37. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AlgebraicRecon.py +0 -0
  38. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AnalyticRecon.py +0 -0
  39. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/BayesianRecon.py +0 -0
  40. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/DeepLearningRecon.py +0 -0
  41. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/PrimalDualRecon.py +0 -0
  42. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/ReconEnums.py +0 -0
  43. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/ReconTools.py +0 -0
  44. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/__init__.py +0 -0
  45. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/_mainRecon.py +0 -0
  46. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/Config.py +0 -0
  47. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps/Settings.py +0 -0
  48. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/SOURCES.txt +0 -0
  49. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/dependency_links.txt +0 -0
  50. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/requires.txt +0 -0
  51. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/top_level.txt +0 -0
  52. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/README.md +0 -0
  53. {aot_biomaps-2.9.376 → aot_biomaps-2.9.378}/setup.cfg +0 -0
@@ -109,7 +109,8 @@ class StructuredWave(AcousticField):
109
109
  try:
110
110
  super().__init__(**kwargs)
111
111
  self.waveType = WaveType.StructuredWave
112
- self.kgrid.setTime(int(self.kgrid.Nt*1.5),self.kgrid.dt) # Extend the time grid to allow for delays
112
+ if self.params['Nt'] is None:
113
+ self.kgrid.setTime(int(self.kgrid.Nt*1.5),self.kgrid.dt) # Extend the time grid to allow for delays
113
114
  if space_0 is not None and space_1 is not None and move_head_0_2tail is not None and move_tail_1_2head is not None and angle_deg is not None:
114
115
  self.pattern = self.PatternParams(space_0, space_1, move_head_0_2tail, move_tail_1_2head, self.params['num_elements'] // 4)
115
116
  self.angle = angle_deg
@@ -123,7 +123,6 @@ class AcousticField(ABC):
123
123
  else:
124
124
  Nt = self.params['Nt']
125
125
  self.kgrid.setTime(Nt,1/float(params.acoustic['f_AQ']))
126
- print(f" NT kgrid : {self.kgrid.Nt} ")
127
126
  self.params['f_AQ'] = int(float(params.acoustic['f_AQ']))
128
127
 
129
128
  self._generate_burst_signal()
@@ -146,7 +145,7 @@ class AcousticField(ABC):
146
145
  self.medium = None
147
146
 
148
147
  self.waveType = None
149
- self.field = None
148
+ self.field = None
150
149
 
151
150
  def __str__(self):
152
151
  """
@@ -514,7 +513,7 @@ class AcousticField(ABC):
514
513
  dx = self.params['dx']
515
514
  air_margin = 20
516
515
  if dx >= self.params['element_width']:
517
- dx = self.params['element_width'] / 2
516
+ dx = self.params['element_width']/2
518
517
  if self.params['width_phantom'] is not None:
519
518
  pva_nx = int(np.round((self.params['width_phantom'])/dx))
520
519
  Nx = pva_nx + 2 * air_margin
@@ -531,29 +530,46 @@ class AcousticField(ABC):
531
530
  else:
532
531
  Nx = int(round((self.params['Xrange'][1] - self.params['Xrange'][0]) / self.params['dx']))
533
532
  if self.params['height_phantom'] is not None:
534
- Nz = int(np.round((self.params['height_phantom'])/self.params['dz']))
533
+ Nz = int(np.round((self.params['height_phantom'])/self.params['dx']))
535
534
  else:
536
- Nz = int(round((self.params['Zrange'][1] - self.params['Zrange'][0]) / self.params['dz']))
537
-
535
+ Nz = int(round((self.params['Zrange'][1] - self.params['Zrange'][0]) / self.params['dx']))
536
+
537
+ Nx_final = int(round((self.params['Xrange'][1] - self.params['Xrange'][0]) / self.params['dx']))
538
+ Nz_final = int(round((self.params['Zrange'][1] - self.params['Zrange'][0]) / self.params['dx']))
538
539
  # --- 2. Time and space factors ---
539
540
  factorT = int(np.ceil(self.params['f_AQ'] / self.params['f_saving']))
540
- factorX = int(np.ceil(Nx / self.params['Nx']))
541
- factorZ = int(np.ceil(Nz / self.params['Nz']))
541
+ factorX = int(np.ceil(self.params['dx'] / dx))
542
+ factorZ = factorX
542
543
 
543
544
  # --- 3. Grid and source initialization ---
544
545
  kgrid = kWaveGrid([Nx, Nz], [dx, dx])
545
- kgrid.setTime(self.kgrid.Nt, 1 / self.params['f_AQ'])
546
-
547
- medium = kWaveMedium()
548
- medium.sound_speed = np.full((Nx, Nz), 343.0)
549
- medium.density = np.full((Nx, Nz), 1.2)
550
- x_start, x_end = air_margin, air_margin + pva_nx
551
- medium.sound_speed[x_start:x_end, :] = self.params['c0'] # 1540 m/s
552
- medium.density[x_start:x_end, :] = self.params.get('density', 1000.0)
546
+
547
+ # --- CORRECTIF : Définition du Medium avec hétérogénéité ---
548
+ # Initialisation en float32 (essentiel pour GPU)
549
+ c_map = np.full((Nx, Nz), 343.0, dtype=np.float32) # Air par défaut
550
+ rho_map = np.full((Nx, Nz), 1.2, dtype=np.float32)
551
+
552
+ # Insertion du bloc de PVA
553
+ x_start = air_margin
554
+ x_end = air_margin + pva_nx
555
+ c_map[x_start:x_end, :] = self.params['c0']
556
+ rho_map[x_start:x_end, :] = self.params.get('density', 1000.0)
557
+
558
+ medium = kWaveMedium(sound_speed=c_map, density=rho_map)
559
+
560
+ # --- CORRECTIF : Recalcul du pas de temps (CFL) ---
561
+ # k-Wave a besoin d'un dt basé sur la vitesse MAXIMALE (1540 m/s)
562
+ c_mean = np.mean(c_map[:, 0]) # mean speed at z=0
563
+ c_max = np.max(c_map)
564
+ cfl = 0.3 # Valeur de sécurité
565
+ dt = cfl * dx / c_max
566
+ kgrid.setTime(self.kgrid.Nt, dt)
553
567
 
554
568
 
555
569
  source = kSource()
556
570
  source.p_mask = np.zeros((Nx, Nz))
571
+ # Appel à la méthode spécialisée
572
+ self._SetUpSource(self,source, Nx, dt, dx, c_mean,factorT) # factorT=1 pour simplifier
557
573
 
558
574
  # --- 4. Sensor setup ---
559
575
  sensor = kSensor()
@@ -565,11 +581,14 @@ class AcousticField(ABC):
565
581
  # --- 7. Simulation options ---
566
582
  simulation_options = SimulationOptions(
567
583
  pml_inside=False, # PML ajoutée autour de la grille Air+PVA
568
- pml_size=[pml_size, pml_size],
584
+ pml_size=[1, pml_size],
569
585
  use_sg=False,
570
586
  save_to_disk=True,
571
587
  input_filename=os.path.join(gettempdir(), "KwaveIN.h5"),
572
- output_filename=os.path.join(gettempdir(), "KwaveOUT.h5")
588
+ output_filename=os.path.join(gettempdir(), "KwaveOUT.h5"),
589
+ smooth_c0 = True,
590
+ smooth_rho0 = True,
591
+ smooth_p0 = True
573
592
  )
574
593
 
575
594
  execution_options = SimulationExecutionOptions(
@@ -578,9 +597,6 @@ class AcousticField(ABC):
578
597
  show_sim_log=show_log
579
598
  )
580
599
 
581
- # --- 7. Call specialized function to set up source.p_mask and source.p ---
582
- self._SetUpSource(source, Nx, dx, factorT)
583
-
584
600
  # --- 8. Run simulation ---
585
601
  sensor_data = kspaceFirstOrder2D(
586
602
  kgrid=kgrid,
@@ -593,16 +609,18 @@ class AcousticField(ABC):
593
609
 
594
610
  # --- 9. Post-process results ---
595
611
  data = sensor_data['p'].reshape(kgrid.Nt, Nz, Nx)
596
-
597
612
  if factorT != 1 or factorX != 1 or factorZ != 1:
598
- return reshape_field(data, [factorT, factorX, factorZ])
613
+ data = reshape_field(data, [factorT, factorX, factorZ])
614
+ xStart = (Nx//2)//factorX - (Nx_final//2)
615
+ return data[:, :Nz_final, xStart:xStart+Nx_final]
599
616
  else:
600
- return data
617
+ return data[:, :Nz_final, xStart:xStart+Nx_final]
601
618
 
602
619
  except Exception as e:
603
620
  print(f"Error generating 2D acoustic field: {e}")
604
621
  return None
605
622
 
623
+
606
624
  def _generate_acoustic_field_KWAVE_3D(self, isGPU=True, show_log=True):
607
625
  """
608
626
  Generate a 3D acoustic field using k-Wave.
@@ -85,7 +85,7 @@ from .AOT_Recon.AOT_PotentialFunctions.RelativeDifferences import *
85
85
  from .Config import config
86
86
  from .Settings import *
87
87
 
88
- __version__ = '2.9.376'
88
+ __version__ = '2.9.378'
89
89
  __process__ = config.get_process()
90
90
 
91
91
  def initialize(process=None):
@@ -237,6 +237,8 @@ def initialize(process=None):
237
237
 
238
238
 
239
239
 
240
+
241
+
240
242
 
241
243
 
242
244
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AOT_biomaps
3
- Version: 2.9.376
3
+ Version: 2.9.378
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
  Metadata-Version: 2.4
2
2
  Name: AOT_biomaps
3
- Version: 2.9.376
3
+ Version: 2.9.378
4
4
  Summary: Acousto-Optic Tomography
5
5
  Home-page: https://github.com/LucasDuclos/AcoustoOpticTomography
6
6
  Author: Lucas Duclos
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='AOT_biomaps',
5
- version='2.9.376',
5
+ version='2.9.378',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
 
@@ -395,6 +395,8 @@ setup(
395
395
 
396
396
 
397
397
 
398
+
399
+
398
400
 
399
401
 
400
402
 
File without changes
File without changes