fullwave25 1.0.7__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 fullwave25 might be problematic. Click here for more details.

Files changed (225) hide show
  1. fullwave/__init__.py +28 -0
  2. fullwave/constants/__init__.py +5 -0
  3. fullwave/constants/material_properties.py +112 -0
  4. fullwave/grid.py +222 -0
  5. fullwave/medium.py +1042 -0
  6. fullwave/medium_builder/__init__.py +12 -0
  7. fullwave/medium_builder/domain.py +151 -0
  8. fullwave/medium_builder/medium_builder.py +198 -0
  9. fullwave/medium_builder/presets/__init__.py +8 -0
  10. fullwave/medium_builder/presets/data/.keep +0 -0
  11. fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat +0 -0
  12. fullwave/medium_builder/presets/domain_abdominal_wall.py +293 -0
  13. fullwave/medium_builder/presets/domain_background.py +140 -0
  14. fullwave/medium_builder/presets/domain_scatterer.py +179 -0
  15. fullwave/medium_builder/presets/domain_simple.py +92 -0
  16. fullwave/medium_builder/presets/domain_water_gel.py +1 -0
  17. fullwave/sensor.py +161 -0
  18. fullwave/solver/__init__.py +1 -0
  19. fullwave/solver/bins/database/relaxation_params_database_num_relax=2_20251027_1437.mat +0 -0
  20. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenu +0 -0
  21. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_100_cuda129 +0 -0
  22. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_101_cuda129 +0 -0
  23. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_120_cuda129 +0 -0
  24. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda118 +0 -0
  25. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda124 +0 -0
  26. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda126 +0 -0
  27. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda129 +0 -0
  28. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda118 +0 -0
  29. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda124 +0 -0
  30. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda126 +0 -0
  31. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda129 +0 -0
  32. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda118 +0 -0
  33. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda124 +0 -0
  34. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda126 +0 -0
  35. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda129 +0 -0
  36. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda118 +0 -0
  37. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda124 +0 -0
  38. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda126 +0 -0
  39. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda129 +0 -0
  40. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda118 +0 -0
  41. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda124 +0 -0
  42. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda126 +0 -0
  43. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda129 +0 -0
  44. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda118 +0 -0
  45. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda126 +0 -0
  46. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda129 +0 -0
  47. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda118 +0 -0
  48. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda124 +0 -0
  49. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda126 +0 -0
  50. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda129 +0 -0
  51. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_100_cuda129 +0 -0
  52. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_101_cuda129 +0 -0
  53. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_120_cuda129 +0 -0
  54. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda118 +0 -0
  55. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda124 +0 -0
  56. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda126 +0 -0
  57. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda129 +0 -0
  58. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda118 +0 -0
  59. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda124 +0 -0
  60. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda126 +0 -0
  61. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda129 +0 -0
  62. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda118 +0 -0
  63. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda124 +0 -0
  64. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda126 +0 -0
  65. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda129 +0 -0
  66. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda118 +0 -0
  67. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda124 +0 -0
  68. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda126 +0 -0
  69. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda129 +0 -0
  70. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda118 +0 -0
  71. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda124 +0 -0
  72. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda126 +0 -0
  73. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda129 +0 -0
  74. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda118 +0 -0
  75. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda124 +0 -0
  76. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda126 +0 -0
  77. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda129 +0 -0
  78. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda118 +0 -0
  79. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda124 +0 -0
  80. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda126 +0 -0
  81. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda129 +0 -0
  82. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_100_cuda129 +0 -0
  83. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_101_cuda129 +0 -0
  84. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_120_cuda129 +0 -0
  85. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda118 +0 -0
  86. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda124 +0 -0
  87. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda126 +0 -0
  88. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda129 +0 -0
  89. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda118 +0 -0
  90. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda124 +0 -0
  91. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda126 +0 -0
  92. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda129 +0 -0
  93. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda118 +0 -0
  94. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda124 +0 -0
  95. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda126 +0 -0
  96. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda129 +0 -0
  97. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda118 +0 -0
  98. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda124 +0 -0
  99. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda126 +0 -0
  100. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda129 +0 -0
  101. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda118 +0 -0
  102. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda124 +0 -0
  103. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda126 +0 -0
  104. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda129 +0 -0
  105. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda118 +0 -0
  106. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda124 +0 -0
  107. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda126 +0 -0
  108. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda129 +0 -0
  109. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda118 +0 -0
  110. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda124 +0 -0
  111. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda126 +0 -0
  112. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda129 +0 -0
  113. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_100_cuda129 +0 -0
  114. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_101_cuda129 +0 -0
  115. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_120_cuda129 +0 -0
  116. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda118 +0 -0
  117. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda124 +0 -0
  118. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda126 +0 -0
  119. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda129 +0 -0
  120. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda118 +0 -0
  121. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda124 +0 -0
  122. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda126 +0 -0
  123. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda129 +0 -0
  124. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda118 +0 -0
  125. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda124 +0 -0
  126. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda126 +0 -0
  127. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda129 +0 -0
  128. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda118 +0 -0
  129. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda124 +0 -0
  130. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda126 +0 -0
  131. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda129 +0 -0
  132. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda118 +0 -0
  133. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda124 +0 -0
  134. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda126 +0 -0
  135. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda129 +0 -0
  136. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda118 +0 -0
  137. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda124 +0 -0
  138. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda126 +0 -0
  139. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda129 +0 -0
  140. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda118 +0 -0
  141. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda124 +0 -0
  142. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda126 +0 -0
  143. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda129 +0 -0
  144. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_100_cuda129 +0 -0
  145. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_101_cuda129 +0 -0
  146. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_120_cuda129 +0 -0
  147. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda118 +0 -0
  148. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda124 +0 -0
  149. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda126 +0 -0
  150. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda129 +0 -0
  151. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda118 +0 -0
  152. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda124 +0 -0
  153. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda126 +0 -0
  154. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda129 +0 -0
  155. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda118 +0 -0
  156. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda124 +0 -0
  157. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda126 +0 -0
  158. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda129 +0 -0
  159. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda118 +0 -0
  160. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda124 +0 -0
  161. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda126 +0 -0
  162. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda129 +0 -0
  163. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda118 +0 -0
  164. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda124 +0 -0
  165. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda126 +0 -0
  166. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda129 +0 -0
  167. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda118 +0 -0
  168. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda124 +0 -0
  169. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda126 +0 -0
  170. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda129 +0 -0
  171. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda118 +0 -0
  172. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda124 +0 -0
  173. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda126 +0 -0
  174. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda129 +0 -0
  175. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_100_cuda129 +0 -0
  176. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_101_cuda129 +0 -0
  177. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_120_cuda129 +0 -0
  178. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda118 +0 -0
  179. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda124 +0 -0
  180. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda126 +0 -0
  181. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda129 +0 -0
  182. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda118 +0 -0
  183. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda124 +0 -0
  184. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda126 +0 -0
  185. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda129 +0 -0
  186. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda118 +0 -0
  187. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda124 +0 -0
  188. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda126 +0 -0
  189. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda129 +0 -0
  190. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda118 +0 -0
  191. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda124 +0 -0
  192. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda126 +0 -0
  193. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda129 +0 -0
  194. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda118 +0 -0
  195. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda124 +0 -0
  196. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda126 +0 -0
  197. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda129 +0 -0
  198. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda118 +0 -0
  199. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda124 +0 -0
  200. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda126 +0 -0
  201. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda129 +0 -0
  202. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda118 +0 -0
  203. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda124 +0 -0
  204. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda126 +0 -0
  205. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda129 +0 -0
  206. fullwave/solver/cuda_utils.py +392 -0
  207. fullwave/solver/input_file_writer.py +853 -0
  208. fullwave/solver/launcher.py +134 -0
  209. fullwave/solver/pml_builder.py +1923 -0
  210. fullwave/solver/solver.py +750 -0
  211. fullwave/solver/utils.py +83 -0
  212. fullwave/source.py +173 -0
  213. fullwave/transducer.py +1003 -0
  214. fullwave/utils/__init__.py +12 -0
  215. fullwave/utils/check_functions.py +48 -0
  216. fullwave/utils/coordinates.py +155 -0
  217. fullwave/utils/memory_tempfile.py +439 -0
  218. fullwave/utils/numerical.py +111 -0
  219. fullwave/utils/plot_utils.py +1122 -0
  220. fullwave/utils/pulse.py +72 -0
  221. fullwave/utils/relaxation_parameters.py +212 -0
  222. fullwave/utils/signal_process.py +197 -0
  223. fullwave25-1.0.7.dist-info/METADATA +292 -0
  224. fullwave25-1.0.7.dist-info/RECORD +225 -0
  225. fullwave25-1.0.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,12 @@
1
+ """domain builder module."""
2
+
3
+ from .domain import Domain
4
+ from .medium_builder import MediumBuilder
5
+
6
+ from . import presets # isort:skip
7
+
8
+ __all__ = [
9
+ "Domain",
10
+ "MediumBuilder",
11
+ "presets",
12
+ ]
@@ -0,0 +1,151 @@
1
+ """domain base module."""
2
+
3
+ from abc import ABC, abstractmethod
4
+ from dataclasses import dataclass, field
5
+ from pathlib import Path
6
+
7
+ import numpy as np
8
+ from numpy.typing import NDArray
9
+
10
+ from fullwave import Grid, Medium
11
+ from fullwave.utils import check_functions
12
+
13
+
14
+ @dataclass
15
+ class Domain(ABC):
16
+ """A base domain class defining abstract methods for domain parameter setup.
17
+
18
+ override abstract methods (_setup_*) to use in the derived classes.
19
+ """
20
+
21
+ name: str
22
+ grid: Grid
23
+ nx: int = field(init=False)
24
+ ny: int = field(init=False)
25
+ nz: int = field(init=False)
26
+ base_geometry: NDArray[np.float64] = field(init=False)
27
+ sound_speed: NDArray[np.float64] = field(init=False)
28
+ density: NDArray[np.float64] = field(init=False)
29
+ alpha_coeff: NDArray[np.float64] = field(init=False)
30
+ alpha_power: NDArray[np.float64] = field(init=False)
31
+ beta: NDArray[np.float64] = field(init=False)
32
+ air: NDArray[np.int64] = field(init=False)
33
+
34
+ def __init__(
35
+ self,
36
+ name: str,
37
+ grid: Grid,
38
+ *,
39
+ path_relaxation_parameters_database: Path = Path(__file__).parent.parent
40
+ / "solver"
41
+ / "bins"
42
+ / "database"
43
+ / "relaxation_params_database_num_relax=2_20251027_1437.mat",
44
+ n_relaxation_mechanisms: int = 2,
45
+ ) -> None:
46
+ """Initialize the Domain class.
47
+
48
+ Parameters
49
+ ----------
50
+ name: (str)
51
+ The name of the domain.
52
+ grid: (Grid)
53
+ The grid associated with the domain.
54
+ path_relaxation_parameters_database: (Path, optional)
55
+ The path to the relaxation parameters database.
56
+ n_relaxation_mechanisms: (int, optional)
57
+ The number of relaxation mechanisms.
58
+
59
+ """
60
+ self.name = name
61
+ self.grid = grid
62
+ self.is_3d = self.grid.is_3d
63
+ self.path_relaxation_parameters_database = path_relaxation_parameters_database
64
+ self.n_relaxation_mechanisms = n_relaxation_mechanisms
65
+ self.__post_init__()
66
+
67
+ def __post_init__(self) -> None:
68
+ """Post-initialization processing for Domain.
69
+
70
+ will be called after __init__.
71
+ """
72
+ check_functions.check_instance(self.grid, Grid)
73
+
74
+ self.nx = self.grid.nx
75
+ self.ny = self.grid.ny
76
+ if self.is_3d:
77
+ self.nz = self.grid.nz
78
+
79
+ self.base_geometry = self._setup_base_geometry()
80
+
81
+ self.sound_speed = self._setup_sound_speed()
82
+ self.density = self._setup_density()
83
+ self.alpha_coeff = self._setup_alpha_coeff()
84
+ self.alpha_power = self._setup_alpha_power()
85
+ self.beta = self._setup_beta()
86
+ self.air = self._setup_air()
87
+
88
+ @abstractmethod
89
+ def _setup_base_geometry(self) -> NDArray[np.float64]:
90
+ if self.is_3d:
91
+ return np.zeros((self.nx, self.ny, self.nz))
92
+ return np.zeros((self.nx, self.ny))
93
+
94
+ @abstractmethod
95
+ def _setup_sound_speed(self) -> NDArray[np.float64]:
96
+ if self.is_3d:
97
+ return np.zeros((self.nx, self.ny, self.nz))
98
+ return np.zeros((self.nx, self.ny))
99
+
100
+ @abstractmethod
101
+ def _setup_density(self) -> NDArray[np.float64]:
102
+ if self.is_3d:
103
+ return np.zeros((self.nx, self.ny, self.nz))
104
+ return np.zeros((self.nx, self.ny))
105
+
106
+ @abstractmethod
107
+ def _setup_alpha_coeff(self) -> NDArray[np.float64]:
108
+ if self.is_3d:
109
+ return np.zeros((self.nx, self.ny, self.nz))
110
+ return np.zeros((self.nx, self.ny))
111
+
112
+ @abstractmethod
113
+ def _setup_alpha_power(self) -> NDArray[np.float64]:
114
+ if self.is_3d:
115
+ return np.zeros((self.nx, self.ny, self.nz))
116
+ return np.zeros((self.nx, self.ny))
117
+
118
+ @abstractmethod
119
+ def _setup_beta(self) -> NDArray[np.float64]:
120
+ if self.is_3d:
121
+ return np.zeros((self.nx, self.ny, self.nz))
122
+ return np.zeros((self.nx, self.ny))
123
+
124
+ def _setup_air(self) -> NDArray[np.int64]:
125
+ if self.is_3d:
126
+ return np.zeros((self.nx, self.ny, self.nz), dtype=bool)
127
+ return np.zeros((self.nx, self.ny), dtype=bool)
128
+
129
+ @property
130
+ def medium(self) -> Medium:
131
+ """Returns the medium instance with its configured properties."""
132
+ return Medium(
133
+ grid=self.grid,
134
+ sound_speed=self.sound_speed,
135
+ density=self.density,
136
+ alpha_coeff=self.alpha_coeff,
137
+ alpha_power=self.alpha_power,
138
+ beta=self.beta,
139
+ air_map=self.air,
140
+ path_relaxation_parameters_database=self.path_relaxation_parameters_database,
141
+ n_relaxation_mechanisms=self.n_relaxation_mechanisms,
142
+ )
143
+
144
+ def plot(
145
+ self,
146
+ export_path: Path | str | None = Path("./temp/temp.png"),
147
+ *,
148
+ show: bool = False,
149
+ ) -> None:
150
+ """Plot the fields using matplotlib."""
151
+ self.medium.plot(export_path=export_path, show=show)
@@ -0,0 +1,198 @@
1
+ """medium builder module."""
2
+
3
+ from collections import OrderedDict
4
+ from pathlib import Path
5
+
6
+ import numpy as np
7
+
8
+ from fullwave import Medium
9
+ from fullwave.constants import MaterialProperties
10
+ from fullwave.grid import Grid
11
+ from fullwave.medium_builder.domain import Domain
12
+ from fullwave.utils import check_functions
13
+
14
+
15
+ class MediumBuilder:
16
+ """organize the domain properties and export Medium instances.
17
+
18
+ registered domains will be combined to construct the final domain properties.
19
+ """
20
+
21
+ def __init__(
22
+ self,
23
+ grid: Grid,
24
+ background_domain_properties: str = "water",
25
+ *,
26
+ ignore_non_linearity: bool = False,
27
+ material_properties: MaterialProperties | None = None,
28
+ path_relaxation_parameters_database: Path = Path(__file__).parent.parent
29
+ / "solver"
30
+ / "bins"
31
+ / "database"
32
+ / "relaxation_params_database_num_relax=2_20251027_1437.mat",
33
+ n_relaxation_mechanisms: int = 2,
34
+ attenuation_builder: str = "lookup",
35
+ ) -> None:
36
+ """Initialize a DomainOrganizer.
37
+
38
+ with background domain properties, non-linearity flag, and material properties.
39
+
40
+ Parameters
41
+ ----------
42
+ grid: Grid
43
+ grid instance.
44
+ background_domain_properties: str
45
+ The background domain properties.
46
+ Defaults to "water".
47
+ ignore_non_linearity: bool
48
+ Ignore non-linearity.
49
+ Defaults to False.
50
+ material_properties: MaterialProperties, optional
51
+ Material properties.
52
+ Defaults to None.
53
+ path_relaxation_parameters_database : Path, optional
54
+ Path to the relaxation parameters database.
55
+ n_relaxation_mechanisms : int, optional
56
+ Number of relaxation mechanisms, by default 2
57
+ attenuation_builder : str, optional
58
+ Attenuation builder type, by default "lookup".
59
+ Currently supports "lookup" only.
60
+ If "lookup", it uses the lookup table for attenuation.
61
+
62
+ """
63
+ check_functions.check_instance(grid, Grid)
64
+ self.grid = grid
65
+ self.registered_domain_dict: OrderedDict = OrderedDict()
66
+ self.constructed_domain_dict: OrderedDict = OrderedDict()
67
+
68
+ if material_properties is None:
69
+ self.material_properties: MaterialProperties = MaterialProperties()
70
+ else:
71
+ self.material_properties = material_properties
72
+
73
+ self.background_domain_properties: str = background_domain_properties
74
+ self.ignore_non_linearity: bool = ignore_non_linearity
75
+ self.path_relaxation_parameters_database = path_relaxation_parameters_database
76
+ self.n_relaxation_mechanisms = n_relaxation_mechanisms
77
+ self.attenuation_builder = attenuation_builder
78
+
79
+ def register_domain(self, domain: Domain) -> None:
80
+ """Register a single Domain instances.
81
+
82
+ Parameters
83
+ ----------
84
+ domain: Domain
85
+ Domain instances to register.
86
+
87
+ """
88
+ check_functions.check_instance(domain, Domain)
89
+
90
+ domain_name = domain.name
91
+ c_map = domain.sound_speed
92
+ rho_map = domain.density
93
+ beta_map = domain.beta
94
+ alpha_coeff_map = domain.alpha_coeff
95
+ alpha_power_map = domain.alpha_power
96
+
97
+ base_geometry = domain.base_geometry
98
+
99
+ air_map = domain.air if hasattr(domain, "air") else np.zeros_like(base_geometry)
100
+
101
+ self.registered_domain_dict[domain_name] = {
102
+ "rho_map": rho_map,
103
+ "beta_map": beta_map,
104
+ "c_map": c_map,
105
+ "a_map": alpha_coeff_map,
106
+ "a_power_map": alpha_power_map,
107
+ "air_map": air_map,
108
+ "geometry": base_geometry,
109
+ }
110
+
111
+ def register_domain_list(self, domain_list: list[Domain]) -> None:
112
+ """Register a list of Domain instances.
113
+
114
+ Parameters
115
+ ----------
116
+ domain_list: List
117
+ List of Domain instances to register.
118
+
119
+ """
120
+ for domain in domain_list:
121
+ self.register_domain(domain)
122
+
123
+ def _check_registered_domain(self) -> None:
124
+ if "background" not in self.registered_domain_dict:
125
+ error_msg = "Background domain is not registered."
126
+ raise ValueError(error_msg)
127
+ if len(self.registered_domain_dict) == 0:
128
+ error_msg = "No domain is registered."
129
+ raise ValueError(error_msg)
130
+ if next(iter(self.registered_domain_dict.keys())) != "background":
131
+ error_msg = "The first domain must be background domain."
132
+ raise ValueError(error_msg)
133
+
134
+ def run(self) -> Medium:
135
+ """Construct maps from registered maps.
136
+
137
+ Combine the maps like an image stecker.
138
+ The first map must be background map.
139
+
140
+ Returns
141
+ -------
142
+ Medium
143
+ A Medium instance with the constructed domain properties.
144
+
145
+ """
146
+ self._check_registered_domain()
147
+
148
+ for map_name in ["c_map", "rho_map", "a_map", "a_power_map", "beta_map", "air_map"]:
149
+ base_map_data = self.registered_domain_dict["background"][map_name].copy()
150
+ for domain_name in self.registered_domain_dict:
151
+ if domain_name == "background":
152
+ continue
153
+
154
+ non_zero_index = np.where(
155
+ self.registered_domain_dict[domain_name]["geometry"] != 0,
156
+ )
157
+ base_map_data[non_zero_index] = self.registered_domain_dict[domain_name][map_name][
158
+ non_zero_index
159
+ ]
160
+ self.constructed_domain_dict[map_name] = base_map_data.copy()
161
+
162
+ if self.ignore_non_linearity:
163
+ self.constructed_domain_dict["beta_map"] = np.zeros_like(
164
+ self.constructed_domain_dict["beta_map"],
165
+ )
166
+
167
+ base_geometry_data = np.zeros_like(self.registered_domain_dict["background"]["geometry"])
168
+ for i, domain_name in enumerate(self.registered_domain_dict.keys()):
169
+ geometry_non_zero_index = np.where(
170
+ self.registered_domain_dict[domain_name]["geometry"] != 0,
171
+ )
172
+ base_geometry_data[geometry_non_zero_index] = i
173
+ self.constructed_domain_dict["geometry"] = base_geometry_data.copy()
174
+ return Medium(
175
+ grid=self.grid,
176
+ sound_speed=self.constructed_domain_dict["c_map"],
177
+ density=self.constructed_domain_dict["rho_map"],
178
+ alpha_coeff=self.constructed_domain_dict["a_map"],
179
+ alpha_power=self.constructed_domain_dict["a_power_map"],
180
+ beta=self.constructed_domain_dict["beta_map"],
181
+ air_map=self.constructed_domain_dict["air_map"],
182
+ path_relaxation_parameters_database=self.path_relaxation_parameters_database,
183
+ n_relaxation_mechanisms=self.n_relaxation_mechanisms,
184
+ attenuation_builder=self.attenuation_builder,
185
+ )
186
+
187
+ def plot_current_map(
188
+ self,
189
+ export_path: Path | str | None = Path("./temp/temp.png"),
190
+ *,
191
+ show: bool = False,
192
+ ) -> None:
193
+ """Plot the medium fields using matplotlib."""
194
+ medium = self.run()
195
+ medium.plot(
196
+ export_path=export_path,
197
+ show=show,
198
+ )
@@ -0,0 +1,8 @@
1
+ """domain presets."""
2
+
3
+ from .domain_abdominal_wall import AbdominalWallDomain
4
+ from .domain_background import BackgroundDomain
5
+ from .domain_scatterer import ScattererDomain
6
+ from .domain_simple import SimpleDomain
7
+
8
+ __all__ = ["AbdominalWallDomain", "BackgroundDomain", "ScattererDomain", "SimpleDomain"]
File without changes
@@ -0,0 +1,293 @@
1
+ """abdominal wall domain."""
2
+
3
+ from pathlib import Path
4
+
5
+ import numpy as np
6
+ from numpy.typing import NDArray
7
+ from scipy.io import loadmat
8
+
9
+ from fullwave import Grid
10
+ from fullwave.constants import MaterialProperties
11
+ from fullwave.medium_builder import Domain
12
+ from fullwave.utils import check_functions
13
+ from fullwave.utils.numerical import matlab_interp2easy
14
+
15
+
16
+ def _make_abdominal_property(
17
+ grid: Grid,
18
+ abdominal_wall_mat_path: Path = Path(
19
+ "fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat",
20
+ ),
21
+ crop_depth: float = 0.8e-2,
22
+ start_depth: float = 0,
23
+ background_domain_properties: str = "liver",
24
+ *,
25
+ apply_tissue_compression: bool = True,
26
+ compression_ratio: float = 0.655,
27
+ use_center_region: bool = True,
28
+ skip_background_definition: bool = True,
29
+ tranducer_surface: NDArray[np.float64] | None = None,
30
+ ) -> dict[str, np.ndarray]:
31
+ mat_data = loadmat(abdominal_wall_mat_path)
32
+ abdominal_wall_properties = mat_data["cut"].astype(float)
33
+
34
+ # this is the pixel size in interpd Visual Human slice.
35
+ dm = 0.33e-3 / 4
36
+
37
+ compression_ratio = compression_ratio if apply_tissue_compression else 1
38
+
39
+ interpolation_x = compression_ratio * dm / grid.dx
40
+ interpolation_y = dm / grid.dy
41
+
42
+ abdominal_wall_properties = matlab_interp2easy(
43
+ abdominal_wall_properties,
44
+ interpolation_x=interpolation_x,
45
+ interpolation_y=interpolation_y,
46
+ )
47
+
48
+ crop_depth_index = round(crop_depth / grid.dx) - 1
49
+ start_depth_index = round(start_depth / grid.dx)
50
+
51
+ # axis definition: [axial, lateral], x-> depth, y-> width
52
+ abdominal_wall_properties = abdominal_wall_properties[
53
+ crop_depth_index : crop_depth_index + grid.nx,
54
+ :,
55
+ ]
56
+
57
+ if use_center_region:
58
+ offset = grid.ny % 2
59
+ center_y = abdominal_wall_properties.shape[1] // 2
60
+ abdominal_wall_properties = abdominal_wall_properties[
61
+ : grid.nx,
62
+ center_y - grid.ny // 2 : center_y + grid.ny // 2 + offset,
63
+ ]
64
+ assert abdominal_wall_properties.shape[1] == grid.ny
65
+
66
+ base_map = np.zeros((grid.nx, grid.ny))
67
+
68
+ if abdominal_wall_properties.shape[0] + start_depth_index > grid.nx:
69
+ abdominal_wall_properties = abdominal_wall_properties[: grid.nx - start_depth_index, :]
70
+ if tranducer_surface is not None:
71
+ for i in range(abdominal_wall_properties.shape[1]):
72
+ abdominal_wall_properties[tranducer_surface[i] - 3 :, i] = abdominal_wall_properties[
73
+ 0 : -tranducer_surface[i] + 3,
74
+ i,
75
+ ]
76
+ abdominal_wall_properties[0 : tranducer_surface[i] - 3, i] = 0
77
+
78
+ base_map[
79
+ start_depth_index : start_depth_index + abdominal_wall_properties.shape[0],
80
+ : abdominal_wall_properties.shape[1],
81
+ ] = abdominal_wall_properties
82
+
83
+ material_properties = MaterialProperties()
84
+
85
+ density = np.ones_like(base_map) * -1
86
+ sound_speed = np.ones_like(base_map) * -1
87
+ alpha_coeff = np.ones_like(base_map) * -1
88
+ alpha_power = np.ones_like(base_map) * -1
89
+ beta = np.ones_like(base_map) * -1
90
+
91
+ for i, tissue_name in enumerate(
92
+ [
93
+ background_domain_properties,
94
+ "connective",
95
+ "muscle",
96
+ "fat",
97
+ "connective",
98
+ "connective",
99
+ ],
100
+ ):
101
+ if i == 0 and skip_background_definition:
102
+ continue
103
+ target_index = np.where(base_map == i)
104
+ density[target_index] = getattr(material_properties, tissue_name)["density"]
105
+ sound_speed[target_index] = getattr(material_properties, tissue_name)["sound_speed"]
106
+ alpha_coeff[target_index] = getattr(material_properties, tissue_name)["alpha_coeff"]
107
+ alpha_power[target_index] = getattr(material_properties, tissue_name)["alpha_power"]
108
+ beta[target_index] = getattr(material_properties, tissue_name)["beta"]
109
+
110
+ # if use_smoothing:
111
+ # # use gaussian smoothing to smooth the abdominal wall
112
+ # sigma = (5 / 10) ** 2 * grid.ppw / 2
113
+ # rho_map_blurred = matlab_gaussian_filter(density, sigma=sigma)
114
+ # c_map_blurred = matlab_gaussian_filter(sound_speed, sigma=sigma)
115
+ # a_coeff_map_blurred = matlab_gaussian_filter(alpha_coeff, sigma=sigma)
116
+ # a_power_map_blurred = matlab_gaussian_filter(alpha_power, sigma=sigma)
117
+
118
+ # density = rho_map_blurred
119
+ # sound_speed = c_map_blurred
120
+ # alpha_coeff = a_coeff_map_blurred
121
+ # alpha_power = a_power_map_blurred
122
+
123
+ air_map = np.zeros_like(base_map)
124
+ return {
125
+ "base_geometry": base_map > 0,
126
+ "sound_speed": sound_speed,
127
+ "density": density,
128
+ "alpha_coeff": alpha_coeff,
129
+ "alpha_power": alpha_power,
130
+ "beta": beta,
131
+ "air_map": air_map,
132
+ }
133
+
134
+
135
+ class AbdominalWallDomain(Domain):
136
+ """Represents the abdominal wall domain for simulation."""
137
+
138
+ def __init__(
139
+ self,
140
+ grid: Grid,
141
+ *,
142
+ abdominal_wall_mat_path: Path = Path(
143
+ "fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat",
144
+ ),
145
+ crop_depth: float = 0.8e-2,
146
+ start_depth: float = 0,
147
+ name: str = "abdominal_wall",
148
+ background_domain_properties: str = "water",
149
+ material_properties: MaterialProperties | None = None,
150
+ apply_tissue_compression: bool = True,
151
+ use_center_region: bool = True,
152
+ skip_background_definition: bool = True,
153
+ path_relaxation_parameters_database: Path = Path(__file__).parent.parent.parent
154
+ / "solver"
155
+ / "bins"
156
+ / "database"
157
+ / "relaxation_params_database_num_relax=2_20251027_1437.mat",
158
+ n_relaxation_mechanisms: int = 2,
159
+ tranducer_surface: NDArray[np.float64] | None = None,
160
+ ) -> None:
161
+ """Define AbdominalWallDomain instance.
162
+
163
+ test
164
+
165
+ Parameters
166
+ ----------
167
+ grid: Grid
168
+ The grid instance.
169
+ abdominal_wall_mat_path: Path, optional
170
+ The path to the abdominal wall mat file.
171
+ Defaults to
172
+ Path("fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat").
173
+ crop_depth: float, optional
174
+ how much you want to crop the abdominal wall from the top.
175
+ Defaults to 0.8e-2.
176
+ start_depth: float, optional
177
+ it defines the place where the abdominal wall starts in the domain.
178
+ The start depth.
179
+ Defaults to 0.
180
+ name: str, optional
181
+ The name of the domain.
182
+ Defaults to "abdominal_wall".
183
+ background_domain_properties: str, optional
184
+ The background domain properties.
185
+ this value will be used to define the background domain properties.
186
+ this is ignored if skip_background_definition is True.
187
+ Defaults to "water".
188
+ material_properties: MaterialProperties, optional
189
+ Material properties to be used.
190
+ Defaults to None.
191
+ apply_tissue_compression: bool, optional
192
+ if apply tissue compression emulation to the abdominal wall.
193
+ Defaults to True.
194
+ use_center_region: bool, optional
195
+ if use the center region of the abdominal wall.
196
+ Defaults to True.
197
+ skip_background_definition: bool, optional
198
+ if skip background definition.
199
+ Defaults to True.
200
+ path_relaxation_parameters_database: Path, optional
201
+ The path to the relaxation parameters database.
202
+ Defaults to
203
+ Path(__file__).parent.parent / "solver" / "bins"
204
+ / "database"
205
+ / "relaxation_params_database_num_relax=2_20251027_1437.mat",
206
+ n_relaxation_mechanisms: int, optional
207
+ The number of relaxation mechanisms.
208
+ Defaults to 4.
209
+ tranducer_surface: NDArray[np.float64] | None, optional
210
+ The transducer surface.
211
+ Defaults to None.
212
+ the shape of this array should be (ny,).
213
+ and each value contains the depth of the transducer surface at each lateral position.
214
+
215
+ """
216
+ self.material_properties = material_properties
217
+
218
+ self.background_domain_properties = background_domain_properties
219
+ self.crop_depth = crop_depth
220
+ self.start_depth = start_depth
221
+ self.abdominal_wall_mat_path = abdominal_wall_mat_path
222
+
223
+ self.apply_tissue_compression = apply_tissue_compression
224
+ self.skip_background_definition = skip_background_definition
225
+
226
+ self.use_center_region = use_center_region
227
+
228
+ check_functions.check_instance(grid, Grid)
229
+
230
+ self.name = name
231
+ self.grid = grid
232
+ self.is_3d = grid.is_3d
233
+ if self.is_3d:
234
+ error_msg = "3D abdominal wall domain is not supported yet."
235
+ raise NotImplementedError(error_msg)
236
+ self.path_relaxation_parameters_database = path_relaxation_parameters_database
237
+ self.n_relaxation_mechanisms = n_relaxation_mechanisms
238
+ self.tranducer_surface = tranducer_surface
239
+ (
240
+ self.base_geometry,
241
+ self.sound_speed,
242
+ self.density,
243
+ self.alpha_coeff,
244
+ self.alpha_power,
245
+ self.beta,
246
+ self.air,
247
+ ) = self._setup_maps()
248
+
249
+ def _setup_maps(
250
+ self,
251
+ ) -> tuple[np.ndarray, ...]:
252
+ maps = _make_abdominal_property(
253
+ grid=self.grid,
254
+ abdominal_wall_mat_path=self.abdominal_wall_mat_path,
255
+ crop_depth=self.crop_depth,
256
+ start_depth=self.start_depth,
257
+ background_domain_properties=self.background_domain_properties,
258
+ apply_tissue_compression=self.apply_tissue_compression,
259
+ use_center_region=self.use_center_region,
260
+ skip_background_definition=self.skip_background_definition,
261
+ tranducer_surface=self.tranducer_surface,
262
+ )
263
+
264
+ return (
265
+ maps["base_geometry"],
266
+ maps["sound_speed"],
267
+ maps["density"],
268
+ maps["alpha_coeff"],
269
+ maps["alpha_power"],
270
+ maps["beta"],
271
+ maps["air_map"],
272
+ )
273
+
274
+ def _setup_base_geometry(self) -> NDArray[np.float64]:
275
+ return self.base_geometry
276
+
277
+ def _setup_sound_speed(self) -> NDArray[np.float64]:
278
+ return self.sound_speed
279
+
280
+ def _setup_density(self) -> NDArray[np.float64]:
281
+ return self.density
282
+
283
+ def _setup_beta(self) -> NDArray[np.float64]:
284
+ return self.beta
285
+
286
+ def _setup_alpha_coeff(self) -> NDArray[np.float64]:
287
+ return self.alpha_coeff
288
+
289
+ def _setup_alpha_power(self) -> NDArray[np.float64]:
290
+ return self.alpha_power
291
+
292
+ def _setup_air(self) -> NDArray[np.int64]:
293
+ return self.air