AOT-biomaps 2.9.377__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.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/_mainAcoustic.py +41 -22
  2. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/__init__.py +2 -1
  3. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/PKG-INFO +1 -1
  4. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/PKG-INFO +1 -1
  5. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/setup.py +2 -1
  6. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/AcousticEnums.py +0 -0
  7. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/AcousticTools.py +0 -0
  8. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/FocusedWave.py +0 -0
  9. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/IrregularWave.py +0 -0
  10. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/PlaneWave.py +0 -0
  11. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/StructuredWave.py +0 -0
  12. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Acoustic/__init__.py +0 -0
  13. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/ExperimentTools.py +0 -0
  14. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/Focus.py +0 -0
  15. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/Tomography.py +0 -0
  16. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/__init__.py +0 -0
  17. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Experiment/_mainExperiment.py +0 -0
  18. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/Absorber.py +0 -0
  19. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/Laser.py +0 -0
  20. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/OpticEnums.py +0 -0
  21. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/__init__.py +0 -0
  22. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Optic/_mainOptic.py +0 -0
  23. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/DEPIERRO.py +0 -0
  24. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/LS.py +0 -0
  25. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/MAPEM.py +0 -0
  26. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/MLEM.py +0 -0
  27. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/PDHG.py +0 -0
  28. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_Optimizers/__init__.py +0 -0
  29. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Huber.py +0 -0
  30. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/Quadratic.py +0 -0
  31. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/RelativeDifferences.py +0 -0
  32. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_PotentialFunctions/__init__.py +0 -0
  33. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/SparseSMatrix_CSR.py +0 -0
  34. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/SparseSMatrix_SELL.py +0 -0
  35. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_SparseSMatrix/__init__.py +0 -0
  36. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AOT_biomaps_kernels.cubin +0 -0
  37. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AlgebraicRecon.py +0 -0
  38. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/AnalyticRecon.py +0 -0
  39. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/BayesianRecon.py +0 -0
  40. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/DeepLearningRecon.py +0 -0
  41. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/PrimalDualRecon.py +0 -0
  42. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/ReconEnums.py +0 -0
  43. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/ReconTools.py +0 -0
  44. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/__init__.py +0 -0
  45. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/AOT_Recon/_mainRecon.py +0 -0
  46. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/Config.py +0 -0
  47. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps/Settings.py +0 -0
  48. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/SOURCES.txt +0 -0
  49. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/dependency_links.txt +0 -0
  50. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/requires.txt +0 -0
  51. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/AOT_biomaps.egg-info/top_level.txt +0 -0
  52. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/README.md +0 -0
  53. {aot_biomaps-2.9.377 → aot_biomaps-2.9.378}/setup.cfg +0 -0
@@ -513,7 +513,7 @@ class AcousticField(ABC):
513
513
  dx = self.params['dx']
514
514
  air_margin = 20
515
515
  if dx >= self.params['element_width']:
516
- dx = self.params['element_width'] / 2
516
+ dx = self.params['element_width']/2
517
517
  if self.params['width_phantom'] is not None:
518
518
  pva_nx = int(np.round((self.params['width_phantom'])/dx))
519
519
  Nx = pva_nx + 2 * air_margin
@@ -530,29 +530,46 @@ class AcousticField(ABC):
530
530
  else:
531
531
  Nx = int(round((self.params['Xrange'][1] - self.params['Xrange'][0]) / self.params['dx']))
532
532
  if self.params['height_phantom'] is not None:
533
- Nz = int(np.round((self.params['height_phantom'])/self.params['dz']))
533
+ Nz = int(np.round((self.params['height_phantom'])/self.params['dx']))
534
534
  else:
535
- Nz = int(round((self.params['Zrange'][1] - self.params['Zrange'][0]) / self.params['dz']))
536
-
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']))
537
539
  # --- 2. Time and space factors ---
538
540
  factorT = int(np.ceil(self.params['f_AQ'] / self.params['f_saving']))
539
- factorX = int(np.ceil(Nx / self.params['Nx']))
540
- factorZ = int(np.ceil(Nz / self.params['Nz']))
541
+ factorX = int(np.ceil(self.params['dx'] / dx))
542
+ factorZ = factorX
541
543
 
542
544
  # --- 3. Grid and source initialization ---
543
545
  kgrid = kWaveGrid([Nx, Nz], [dx, dx])
544
- kgrid.setTime(self.kgrid.Nt, 1 / self.params['f_AQ'])
545
-
546
- medium = kWaveMedium()
547
- medium.sound_speed = np.full((Nx, Nz), 343.0)
548
- medium.density = np.full((Nx, Nz), 1.2)
549
- x_start, x_end = air_margin, air_margin + pva_nx
550
- medium.sound_speed[x_start:x_end, :] = self.params['c0'] # 1540 m/s
551
- 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)
552
567
 
553
568
 
554
569
  source = kSource()
555
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
556
573
 
557
574
  # --- 4. Sensor setup ---
558
575
  sensor = kSensor()
@@ -564,11 +581,14 @@ class AcousticField(ABC):
564
581
  # --- 7. Simulation options ---
565
582
  simulation_options = SimulationOptions(
566
583
  pml_inside=False, # PML ajoutée autour de la grille Air+PVA
567
- pml_size=[pml_size, pml_size],
584
+ pml_size=[1, pml_size],
568
585
  use_sg=False,
569
586
  save_to_disk=True,
570
587
  input_filename=os.path.join(gettempdir(), "KwaveIN.h5"),
571
- 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
572
592
  )
573
593
 
574
594
  execution_options = SimulationExecutionOptions(
@@ -577,9 +597,6 @@ class AcousticField(ABC):
577
597
  show_sim_log=show_log
578
598
  )
579
599
 
580
- # --- 7. Call specialized function to set up source.p_mask and source.p ---
581
- self._SetUpSource(source, Nx, dx, factorT)
582
-
583
600
  # --- 8. Run simulation ---
584
601
  sensor_data = kspaceFirstOrder2D(
585
602
  kgrid=kgrid,
@@ -592,16 +609,18 @@ class AcousticField(ABC):
592
609
 
593
610
  # --- 9. Post-process results ---
594
611
  data = sensor_data['p'].reshape(kgrid.Nt, Nz, Nx)
595
-
596
612
  if factorT != 1 or factorX != 1 or factorZ != 1:
597
- 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]
598
616
  else:
599
- return data
617
+ return data[:, :Nz_final, xStart:xStart+Nx_final]
600
618
 
601
619
  except Exception as e:
602
620
  print(f"Error generating 2D acoustic field: {e}")
603
621
  return None
604
622
 
623
+
605
624
  def _generate_acoustic_field_KWAVE_3D(self, isGPU=True, show_log=True):
606
625
  """
607
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.377'
88
+ __version__ = '2.9.378'
89
89
  __process__ = config.get_process()
90
90
 
91
91
  def initialize(process=None):
@@ -239,5 +239,6 @@ def initialize(process=None):
239
239
 
240
240
 
241
241
 
242
+
242
243
 
243
244
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AOT_biomaps
3
- Version: 2.9.377
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.377
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.377',
5
+ version='2.9.378',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
 
@@ -397,5 +397,6 @@ setup(
397
397
 
398
398
 
399
399
 
400
+
400
401
 
401
402
 
File without changes
File without changes