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,1122 @@
1
+ """plot utils."""
2
+
3
+ from pathlib import Path
4
+
5
+ import cv2
6
+ import numpy as np
7
+ from matplotlib import animation
8
+ from matplotlib import pyplot as plt
9
+ from matplotlib.axes import Axes
10
+ from matplotlib.figure import Figure
11
+ from numpy.typing import NDArray
12
+ from tqdm import tqdm
13
+
14
+
15
+ def plot_array( # noqa: C901, D417, PLR0912
16
+ x: NDArray[np.float64 | np.int64 | np.bool],
17
+ aspect: float | None = None,
18
+ vmin: float | None = None,
19
+ vmax: float | None = None,
20
+ interpolation: str = "none",
21
+ export_path: str | None | Path = None,
22
+ xlim: tuple[float, ...] | None = None,
23
+ ylim: tuple[float, ...] | None = None,
24
+ xlabel: str = "",
25
+ ylabel: str = "",
26
+ *,
27
+ reverse_y_axis: bool = False,
28
+ clear_all: bool = True,
29
+ save: bool = True,
30
+ fig: Figure | None = None,
31
+ colorbar: bool = False,
32
+ plot_grid: bool = False,
33
+ grid_steps: int = 1,
34
+ labelsize: int = 2,
35
+ dpi: int = 300,
36
+ cmap: str = "turbo",
37
+ alpha_array: NDArray[np.float64] | None = None,
38
+ extent: tuple[float, float, float, float] | None = None,
39
+ show: bool = False,
40
+ ) -> Figure:
41
+ """Plot a 2D array using matplotlib.
42
+
43
+ Parameters
44
+ ----------
45
+ x : NDArray[np.float64 | np.int64 | np.bool]
46
+ The input array.
47
+ aspect : float, optional
48
+ The aspect ratio (default is 1 if None).
49
+ vmin : float, optional
50
+ The minimum data value that corresponds to the colormap's lower limit.
51
+ vmax : float, optional
52
+ The maximum data value that corresponds to the colormap's upper limit.
53
+ interpolation : str, optional
54
+ The interpolation method used in imshow (default "none").
55
+ export_path : str or Path, optional
56
+ The file path to export the generated plot.
57
+ xlim : tuple, optional
58
+ The x-axis limits.
59
+ ylim : tuple, optional
60
+ The y-axis limits.
61
+ reverse_y_axis: bool
62
+ if true, it reverses the y-axis to match the image orientation
63
+ clear_all: bool
64
+ if true, it closes all open plots before plotting
65
+ save: bool
66
+ if true, the generated figure will be saved to ecport_path
67
+ fig: Figure
68
+ The figure to plot on. If None, a new figure will be created.
69
+ colorbar: bool
70
+ if true, a colorbar will be added to the plot
71
+ dpi: int
72
+ The resolution in dots per inch (default is 300).
73
+ show: bool
74
+ if true, it displays the plot after creation
75
+
76
+ Returns
77
+ -------
78
+ Figure
79
+ The figure object containing the plot.
80
+
81
+ """
82
+ if clear_all:
83
+ plt.close("all")
84
+
85
+ if fig is None:
86
+ fig = plt.figure()
87
+ else:
88
+ plt.figure(fig.number)
89
+
90
+ plt.imshow(
91
+ x,
92
+ vmin=vmin,
93
+ vmax=vmax,
94
+ cmap=cmap,
95
+ interpolation=interpolation,
96
+ alpha=alpha_array,
97
+ extent=extent,
98
+ )
99
+ if xlim is not None:
100
+ plt.xlim(*xlim)
101
+ if ylim is not None:
102
+ plt.ylim(*ylim)
103
+ if xlabel:
104
+ plt.xlabel(xlabel)
105
+ if ylabel:
106
+ plt.ylabel(ylabel)
107
+ if reverse_y_axis:
108
+ # reverse the y-axis to match the image orientation
109
+ plt.gca().invert_yaxis()
110
+
111
+ aspect = 1 if aspect is None else aspect
112
+
113
+ if colorbar:
114
+ plt.colorbar()
115
+ plt.gca().set_aspect(aspect)
116
+ if plot_grid:
117
+ # adjust the axes steps
118
+ plt.xticks(np.arange(0, x.shape[1], grid_steps))
119
+ plt.yticks(np.arange(0, x.shape[0], grid_steps))
120
+ # font size
121
+ plt.tick_params(axis="both", which="major", labelsize=labelsize)
122
+ # plt.xlim(0, x.shape[0] - 1)
123
+ # plt.ylim(x.shape[1] - 1, 0)
124
+
125
+ plt.grid(
126
+ visible=True,
127
+ # color="gray",
128
+ # linestyle="--",
129
+ # linewidth=linewidth,
130
+ which="both",
131
+ alpha=0.5,
132
+ )
133
+ if save:
134
+ if export_path is None:
135
+ export_path = Path("./temp/temp.png")
136
+ export_path.parent.mkdir(exist_ok=True, parents=True)
137
+ plt.savefig(export_path, dpi=dpi)
138
+ else:
139
+ plt.savefig(export_path, dpi=dpi)
140
+ if show:
141
+ plt.show()
142
+
143
+ if clear_all:
144
+ plt.close("all")
145
+
146
+ return plt.gcf()
147
+
148
+
149
+ def plot_array_on_ax(
150
+ ax: Axes,
151
+ x: NDArray[np.float64 | np.int64 | np.bool],
152
+ aspect: float | None = None,
153
+ vmin: float | None = None,
154
+ vmax: float | None = None,
155
+ interpolation: str = "none",
156
+ xlim: tuple[float, ...] | None = None,
157
+ ylim: tuple[float, ...] | None = None,
158
+ title: str = "",
159
+ *,
160
+ reverse_y_axis: bool = False,
161
+ cmap: str = "vanimo",
162
+ ) -> Axes:
163
+ """Plot a 2D array using matplotlib.
164
+
165
+ Parameters
166
+ ----------
167
+ ax: Axes
168
+ The axes to plot on.
169
+ x : NDArray[np.float64 | np.int64 | np.bool]
170
+ The input array.
171
+ aspect : float, optional
172
+ The aspect ratio (default is 1 if None).
173
+ vmin : float, optional
174
+ The minimum data value that corresponds to the colormap's lower limit.
175
+ vmax : float, optional
176
+ The maximum data value that corresponds to the colormap's upper limit.
177
+ interpolation : str, optional
178
+ The interpolation method used in imshow (default "none").
179
+ xlim : tuple, optional
180
+ The x-axis limits.
181
+ ylim : tuple, optional
182
+ The y-axis limits.
183
+ reverse_y_axis: bool
184
+ if true, it reverses the y-axis to match the image orientation
185
+ title: str
186
+ The title of the plot
187
+ cmap: str
188
+ The colormap to use for the plot.
189
+ plot_array_on_ax: bool
190
+ if true, the generated figure will be saved to ecport_path
191
+
192
+ Returns
193
+ -------
194
+ Axes
195
+ The axes object containing the plot.
196
+
197
+ """
198
+ ax.imshow(
199
+ x,
200
+ vmin=vmin,
201
+ vmax=vmax,
202
+ cmap=cmap,
203
+ interpolation=interpolation,
204
+ )
205
+ if xlim is not None:
206
+ ax.set_xlim(*xlim)
207
+ if ylim is not None:
208
+ ax.set_ylim(*ylim)
209
+ if reverse_y_axis:
210
+ # reverse the y-axis to match the image orientation
211
+ ax.invert_yaxis()
212
+
213
+ aspect = 1 if aspect is None else aspect
214
+ ax.set_title(title)
215
+
216
+ ax.set_aspect(aspect)
217
+ # set color bar for this ax
218
+ ax.figure.colorbar(ax.get_images()[0], ax=ax, shrink=0.75)
219
+
220
+ return ax
221
+
222
+
223
+ def plot_1d_array(
224
+ x: NDArray[np.float64 | np.int64 | np.bool],
225
+ vmin: float | None = None,
226
+ vmax: float | None = None,
227
+ export_path: str | Path | None = None,
228
+ title: str = "",
229
+ linewidth: float = 0.5,
230
+ title_font_size: int = 8,
231
+ marker: str | None = None,
232
+ markersize: int = 1,
233
+ *,
234
+ xlim: tuple[float, ...] | None = None,
235
+ ylim: tuple[float, ...] | None = None,
236
+ show: bool = False,
237
+ ) -> None:
238
+ """Plot a 1D array using matplotlib.
239
+
240
+ Parameters
241
+ ----------
242
+ x : NDArray[np.float64 | np.int64 | np.bool]
243
+ The input array.
244
+ vmin : float, optional
245
+ The minimum y-value limit.
246
+ vmax : float, optional
247
+ The maximum y-value limit.
248
+ export_path : str or Path, optional
249
+ The file path to export the generated plot.
250
+ title: str
251
+ The title of the plot
252
+ linewidth: float
253
+ The width of the line
254
+ title_font_size: int
255
+ The font size of the title
256
+ marker: str | None
257
+ The marker style for the plot (default is None).
258
+ markersize: int
259
+ The size of the markers (default is 1).
260
+ show: bool
261
+ if true, it displays the plot after creation
262
+ xlim : tuple, optional
263
+ The x-axis limits.
264
+ ylim : tuple, optional
265
+ The y-axis limits.
266
+
267
+ """
268
+ plt.close("all")
269
+ plt.plot(x, linewidth=linewidth, marker=marker, markersize=markersize)
270
+ plt.ylim(*(ylim if ylim is not None else (vmin, vmax)))
271
+ plt.xlim(*(xlim if xlim is not None else (0, len(x) - 1)))
272
+ plt.title(title, fontsize=title_font_size)
273
+
274
+ if export_path is None:
275
+ export_path = Path("./temp/temp.png")
276
+ export_path.parent.mkdir(exist_ok=True, parents=True)
277
+ plt.savefig(export_path, dpi=300)
278
+ else:
279
+ plt.savefig(export_path, dpi=300)
280
+ if show:
281
+ plt.show()
282
+
283
+
284
+ def plot_wave_propagation_animation(
285
+ propagation_map: NDArray[np.float64],
286
+ dpi: int = 300,
287
+ num_plot_image: int = 50,
288
+ export_name: str | Path = "anim.mp4",
289
+ vmin: float | None = None,
290
+ vmax: float | None = None,
291
+ resize_factor: int = 1,
292
+ figsize: tuple = (12, 6),
293
+ cmap: str = "vanimo",
294
+ *,
295
+ plot_pml_boundary: bool = False,
296
+ pml_thickness_px: int = 40,
297
+ n_transition_layer: int = 20,
298
+ m_spatial_order: int = 8,
299
+ linewidth: float = 0.1,
300
+ # plot_grid: bool = False,
301
+ # grid_steps: int = 2,
302
+ ) -> None:
303
+ """Plot wave propagation with a map overlay using the specified parameters.
304
+
305
+ Parameters
306
+ ----------
307
+ propagation_map : NDArray[np.float64]
308
+ The wave propagation data.
309
+ shape = (nt, nx, ny)
310
+ c_map : NDArray[np.float64]
311
+ The speed of sound map.
312
+ rho_map : NDArray[np.float64]
313
+ The density map.
314
+ dpi : int, optional
315
+ Resolution in dots per inch.
316
+ num_plot_image : int, optional
317
+ Number of images to include in the animation.
318
+ export_name : str or Path, optional
319
+ The filename for the output animation.
320
+ vmin : float, optional
321
+ The minimum data value for the plot.
322
+ vmax : float, optional
323
+ The maximum data value for the plot.
324
+ resize_factor : int, optional
325
+ Factor to resize each frame.
326
+ plot_pml_boundary : bool, optional
327
+ If True, plot the PML boundary.
328
+ pml_thickness_px : int, optional
329
+ Thickness of the PML in pixels.
330
+ m_spatial_order : int, optional
331
+ Spatial order for the PML.
332
+ linewidth : float, optional
333
+ Width of the lines in the PML area.
334
+ figsize : tuple, optional
335
+ Size of the figure (width, height).
336
+ n_transition_layer : int, optional
337
+ Thickness of the PML transition layer in pixels.
338
+ grid_steps : int, optional
339
+ Steps for the grid lines.
340
+ plot_grid : bool, optional
341
+ If True, plot the grid lines.
342
+ cmap : str, optional
343
+ The colormap to use for the plot.
344
+
345
+ """
346
+ nt = propagation_map.shape[0]
347
+ skip_every_n_frame = int(nt / num_plot_image)
348
+ plt.close()
349
+ plt.cla()
350
+ plt.clf()
351
+ fig, axes = plt.subplots(1, 1, figsize=figsize)
352
+
353
+ start = 0
354
+ end = None
355
+ # z_map = c_map * rho_map
356
+ # z_map = (z_map - np.min(z_map)) / (np.max(z_map) - np.min(z_map) + 1e-9)
357
+ # if vmax is None:
358
+ # vmax = np.max(propagation_map)
359
+ # if vmin is None:
360
+ # vmin = np.min(propagation_map)
361
+
362
+ # z_map_offset = vmax * 0.8
363
+
364
+ animation_list = []
365
+ # propagation_map = propagation_map.transpose(2, 0, 1)
366
+ for i, p_map_i in tqdm(
367
+ enumerate(propagation_map[::skip_every_n_frame, start:end, start:end]),
368
+ total=len(propagation_map[::skip_every_n_frame, start:end, start:end]),
369
+ desc="plotting animation",
370
+ ):
371
+ # processed_p_map = p_map_i + z_map_offset * (z_map)
372
+ processed_p_map = p_map_i
373
+ if resize_factor != 1:
374
+ new_width = int(processed_p_map.shape[1] * resize_factor)
375
+ new_height = int(processed_p_map.shape[0] * resize_factor)
376
+ processed_p_map = cv2.resize(processed_p_map, (new_width, new_height))
377
+ image2 = axes.imshow(
378
+ processed_p_map,
379
+ vmin=vmin,
380
+ vmax=vmax,
381
+ interpolation="nearest",
382
+ cmap=cmap,
383
+ )
384
+ text = axes.text(
385
+ 0.5,
386
+ 1.05,
387
+ f"t = {i * skip_every_n_frame} / {propagation_map.shape[0]}",
388
+ fontsize=4,
389
+ ha="center",
390
+ animated=True,
391
+ transform=axes.transAxes,
392
+ )
393
+ if plot_pml_boundary:
394
+ edge_pml_1 = [
395
+ pml_thickness_px + n_transition_layer + m_spatial_order,
396
+ pml_thickness_px + n_transition_layer + m_spatial_order,
397
+ ]
398
+ edge_pml_2 = [
399
+ pml_thickness_px + n_transition_layer + m_spatial_order,
400
+ processed_p_map.shape[1]
401
+ - pml_thickness_px
402
+ - n_transition_layer
403
+ - m_spatial_order
404
+ - 1,
405
+ ]
406
+ edge_pml_3 = [
407
+ processed_p_map.shape[0]
408
+ - pml_thickness_px
409
+ - n_transition_layer
410
+ - m_spatial_order
411
+ - 1,
412
+ processed_p_map.shape[1]
413
+ - pml_thickness_px
414
+ - n_transition_layer
415
+ - m_spatial_order
416
+ - 1,
417
+ ]
418
+ edge_pml_4 = [
419
+ processed_p_map.shape[0]
420
+ - pml_thickness_px
421
+ - n_transition_layer
422
+ - m_spatial_order
423
+ - 1,
424
+ pml_thickness_px + n_transition_layer + m_spatial_order,
425
+ ]
426
+ # put lines in the pml area
427
+ axes.plot(
428
+ [edge_pml_1[1], edge_pml_2[1]],
429
+ [edge_pml_1[0], edge_pml_2[0]],
430
+ color="red",
431
+ linestyle="--",
432
+ linewidth=linewidth,
433
+ )
434
+ axes.plot(
435
+ [edge_pml_2[1], edge_pml_3[1]],
436
+ [edge_pml_2[0], edge_pml_3[0]],
437
+ color="red",
438
+ linestyle="--",
439
+ linewidth=linewidth,
440
+ )
441
+ axes.plot(
442
+ [edge_pml_3[1], edge_pml_4[1]],
443
+ [edge_pml_3[0], edge_pml_4[0]],
444
+ color="red",
445
+ linestyle="--",
446
+ linewidth=linewidth,
447
+ )
448
+ axes.plot(
449
+ [edge_pml_4[1], edge_pml_1[1]],
450
+ [edge_pml_4[0], edge_pml_1[0]],
451
+ color="red",
452
+ linestyle="--",
453
+ linewidth=linewidth,
454
+ )
455
+
456
+ edge_ghost_grid_1 = [
457
+ m_spatial_order,
458
+ m_spatial_order,
459
+ ]
460
+ edge_ghost_grid_2 = [
461
+ m_spatial_order,
462
+ processed_p_map.shape[1] - m_spatial_order - 1,
463
+ ]
464
+ edge_ghost_grid_3 = [
465
+ processed_p_map.shape[0] - m_spatial_order - 1,
466
+ processed_p_map.shape[1] - m_spatial_order - 1,
467
+ ]
468
+ edge_ghost_grid_4 = [
469
+ processed_p_map.shape[0] - m_spatial_order - 1,
470
+ m_spatial_order,
471
+ ]
472
+ # put lines in the ghost grid area
473
+ axes.plot(
474
+ [edge_ghost_grid_1[1], edge_ghost_grid_2[1]],
475
+ [edge_ghost_grid_1[0], edge_ghost_grid_2[0]],
476
+ color="blue",
477
+ linestyle="--",
478
+ linewidth=linewidth,
479
+ )
480
+ axes.plot(
481
+ [edge_ghost_grid_2[1], edge_ghost_grid_3[1]],
482
+ [edge_ghost_grid_2[0], edge_ghost_grid_3[0]],
483
+ color="blue",
484
+ linestyle="--",
485
+ linewidth=linewidth,
486
+ )
487
+ axes.plot(
488
+ [edge_ghost_grid_3[1], edge_ghost_grid_4[1]],
489
+ [edge_ghost_grid_3[0], edge_ghost_grid_4[0]],
490
+ color="blue",
491
+ linestyle="--",
492
+ linewidth=linewidth,
493
+ )
494
+ axes.plot(
495
+ [edge_ghost_grid_4[1], edge_ghost_grid_1[1]],
496
+ [edge_ghost_grid_4[0], edge_ghost_grid_1[0]],
497
+ color="blue",
498
+ linestyle="--",
499
+ linewidth=linewidth,
500
+ )
501
+
502
+ if n_transition_layer > 0:
503
+ edge_transition_1 = [
504
+ pml_thickness_px + m_spatial_order + 1,
505
+ pml_thickness_px + m_spatial_order + 1,
506
+ ]
507
+ edge_transition_2 = [
508
+ pml_thickness_px + m_spatial_order + 1,
509
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
510
+ ]
511
+ edge_transition_3 = [
512
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
513
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
514
+ ]
515
+ edge_transition_4 = [
516
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
517
+ pml_thickness_px + m_spatial_order + 1,
518
+ ]
519
+ # put lines in the transition area
520
+ axes.plot(
521
+ [edge_transition_1[1], edge_transition_2[1]],
522
+ [edge_transition_1[0], edge_transition_2[0]],
523
+ color="black",
524
+ linestyle="--",
525
+ linewidth=linewidth,
526
+ )
527
+ axes.plot(
528
+ [edge_transition_2[1], edge_transition_3[1]],
529
+ [edge_transition_2[0], edge_transition_3[0]],
530
+ color="black",
531
+ linestyle="--",
532
+ linewidth=linewidth,
533
+ )
534
+ axes.plot(
535
+ [edge_transition_3[1], edge_transition_4[1]],
536
+ [edge_transition_3[0], edge_transition_4[0]],
537
+ color="black",
538
+ linestyle="--",
539
+ linewidth=linewidth,
540
+ )
541
+ axes.plot(
542
+ [edge_transition_4[1], edge_transition_1[1]],
543
+ [edge_transition_4[0], edge_transition_1[0]],
544
+ color="black",
545
+ linestyle="--",
546
+ linewidth=linewidth,
547
+ )
548
+ animation_list.append([image2, text])
549
+ animation_data = animation.ArtistAnimation(
550
+ fig,
551
+ animation_list,
552
+ interval=150,
553
+ blit=True,
554
+ repeat_delay=500,
555
+ )
556
+ animation_data.save(export_name, writer="ffmpeg", dpi=dpi)
557
+
558
+
559
+ def plot_wave_propagation_with_map( # noqa: PLR0915, C901
560
+ propagation_map: NDArray[np.float64],
561
+ c_map: NDArray[np.float64],
562
+ rho_map: NDArray[np.float64],
563
+ dpi: int = 300,
564
+ num_plot_image: int = 50,
565
+ export_name: str | Path = "anim.mp4",
566
+ vmin: float | None = None,
567
+ vmax: float | None = None,
568
+ resize_factor: int = 1,
569
+ figsize: tuple = (12, 6),
570
+ xlim: tuple[float, ...] | None = None,
571
+ ylim: tuple[float, ...] | None = None,
572
+ xlabel: str = "",
573
+ ylabel: str = "",
574
+ *,
575
+ plot_pml_boundary: bool = False,
576
+ pml_thickness_px: int = 40,
577
+ n_transition_layer: int = 20,
578
+ m_spatial_order: int = 8,
579
+ linewidth: float = 0.1,
580
+ plot_grid: bool = False,
581
+ grid_steps: int = 2,
582
+ extent: tuple[float, float, float, float] | None = None,
583
+ ) -> None:
584
+ """Plot wave propagation with a map overlay using the specified parameters.
585
+
586
+ Parameters
587
+ ----------
588
+ propagation_map : NDArray[np.float64]
589
+ The wave propagation data.
590
+ shape = (nt, nx, ny)
591
+ c_map : NDArray[np.float64]
592
+ The speed of sound map.
593
+ rho_map : NDArray[np.float64]
594
+ The density map.
595
+ dpi : int, optional
596
+ Resolution in dots per inch.
597
+ num_plot_image : int, optional
598
+ Number of images to include in the animation.
599
+ export_name : str or Path, optional
600
+ The filename for the output animation.
601
+ vmin : float, optional
602
+ The minimum data value for the plot.
603
+ vmax : float, optional
604
+ The maximum data value for the plot.
605
+ resize_factor : int, optional
606
+ Factor to resize each frame.
607
+ plot_pml_boundary : bool, optional
608
+ If True, plot the PML boundary.
609
+ pml_thickness_px : int, optional
610
+ Thickness of the PML in pixels.
611
+ m_spatial_order : int, optional
612
+ Spatial order for the PML.
613
+ linewidth : float, optional
614
+ Width of the lines in the PML area.
615
+ figsize : tuple, optional
616
+ Size of the figure (width, height).
617
+ n_transition_layer : int, optional
618
+ Thickness of the PML transition layer in pixels.
619
+ grid_steps : int, optional
620
+ Steps for the grid lines.
621
+ plot_grid : bool, optional
622
+ If True, plot the grid lines.
623
+ extent : tuple, optional
624
+ The extent of the axes (left, right, bottom, top).
625
+ xlabel : str, optional
626
+ Label for the x-axis.
627
+ ylabel : str, optional
628
+ Label for the y-axis.
629
+ xlim : tuple, optional
630
+ The x-axis limits.
631
+ ylim : tuple, optional
632
+ The y-axis limits.
633
+
634
+ """
635
+ nt = propagation_map.shape[0]
636
+ skip_every_n_frame = int(nt / num_plot_image)
637
+ plt.close()
638
+ plt.cla()
639
+ plt.clf()
640
+ fig, axes = plt.subplots(1, 1, figsize=figsize)
641
+
642
+ start = 0
643
+ end = None
644
+ z_map = c_map * rho_map
645
+ z_map = (z_map - np.min(z_map)) / (np.max(z_map) - np.min(z_map) + 1e-9)
646
+ if vmax is None:
647
+ vmax = np.max(propagation_map)
648
+ if vmin is None:
649
+ vmin = np.min(propagation_map)
650
+
651
+ z_map_offset = vmax * 0.8
652
+
653
+ animation_list = []
654
+ # propagation_map = propagation_map.transpose(2, 0, 1)
655
+ for i, p_map_i in tqdm(
656
+ enumerate(propagation_map[::skip_every_n_frame, start:end, start:end]),
657
+ total=len(propagation_map[::skip_every_n_frame, start:end, start:end]),
658
+ desc="plotting animation",
659
+ ):
660
+ processed_p_map = p_map_i + z_map_offset * (z_map)
661
+ if resize_factor != 1:
662
+ new_width = int(processed_p_map.shape[1] * resize_factor)
663
+ new_height = int(processed_p_map.shape[0] * resize_factor)
664
+ processed_p_map = cv2.resize(processed_p_map, (new_width, new_height))
665
+ image2 = axes.imshow(
666
+ processed_p_map,
667
+ vmin=vmin,
668
+ vmax=vmax,
669
+ interpolation="nearest",
670
+ extent=extent,
671
+ )
672
+ if xlim is not None:
673
+ plt.xlim(*xlim)
674
+ if ylim is not None:
675
+ plt.ylim(*ylim)
676
+ if xlabel:
677
+ plt.xlabel(xlabel)
678
+ if ylabel:
679
+ plt.ylabel(ylabel)
680
+ # set text to show the current time step
681
+ text = axes.text(
682
+ 0.5,
683
+ 1.05,
684
+ f"t = {i * skip_every_n_frame} / {propagation_map.shape[0]}",
685
+ fontsize=4,
686
+ ha="center",
687
+ animated=True,
688
+ transform=axes.transAxes,
689
+ )
690
+ if plot_pml_boundary:
691
+ edge_pml_1 = [
692
+ pml_thickness_px + n_transition_layer + m_spatial_order,
693
+ pml_thickness_px + n_transition_layer + m_spatial_order,
694
+ ]
695
+ edge_pml_2 = [
696
+ pml_thickness_px + n_transition_layer + m_spatial_order,
697
+ processed_p_map.shape[1]
698
+ - pml_thickness_px
699
+ - n_transition_layer
700
+ - m_spatial_order
701
+ - 1,
702
+ ]
703
+ edge_pml_3 = [
704
+ processed_p_map.shape[0]
705
+ - pml_thickness_px
706
+ - n_transition_layer
707
+ - m_spatial_order
708
+ - 1,
709
+ processed_p_map.shape[1]
710
+ - pml_thickness_px
711
+ - n_transition_layer
712
+ - m_spatial_order
713
+ - 1,
714
+ ]
715
+ edge_pml_4 = [
716
+ processed_p_map.shape[0]
717
+ - pml_thickness_px
718
+ - n_transition_layer
719
+ - m_spatial_order
720
+ - 1,
721
+ pml_thickness_px + n_transition_layer + m_spatial_order,
722
+ ]
723
+ # put lines in the pml area
724
+ axes.plot(
725
+ [edge_pml_1[1], edge_pml_2[1]],
726
+ [edge_pml_1[0], edge_pml_2[0]],
727
+ color="red",
728
+ linestyle="--",
729
+ linewidth=linewidth,
730
+ )
731
+ axes.plot(
732
+ [edge_pml_2[1], edge_pml_3[1]],
733
+ [edge_pml_2[0], edge_pml_3[0]],
734
+ color="red",
735
+ linestyle="--",
736
+ linewidth=linewidth,
737
+ )
738
+ axes.plot(
739
+ [edge_pml_3[1], edge_pml_4[1]],
740
+ [edge_pml_3[0], edge_pml_4[0]],
741
+ color="red",
742
+ linestyle="--",
743
+ linewidth=linewidth,
744
+ )
745
+ axes.plot(
746
+ [edge_pml_4[1], edge_pml_1[1]],
747
+ [edge_pml_4[0], edge_pml_1[0]],
748
+ color="red",
749
+ linestyle="--",
750
+ linewidth=linewidth,
751
+ )
752
+
753
+ edge_ghost_grid_1 = [
754
+ m_spatial_order,
755
+ m_spatial_order,
756
+ ]
757
+ edge_ghost_grid_2 = [
758
+ m_spatial_order,
759
+ processed_p_map.shape[1] - m_spatial_order - 1,
760
+ ]
761
+ edge_ghost_grid_3 = [
762
+ processed_p_map.shape[0] - m_spatial_order - 1,
763
+ processed_p_map.shape[1] - m_spatial_order - 1,
764
+ ]
765
+ edge_ghost_grid_4 = [
766
+ processed_p_map.shape[0] - m_spatial_order - 1,
767
+ m_spatial_order,
768
+ ]
769
+ # put lines in the ghost grid area
770
+ axes.plot(
771
+ [edge_ghost_grid_1[1], edge_ghost_grid_2[1]],
772
+ [edge_ghost_grid_1[0], edge_ghost_grid_2[0]],
773
+ color="blue",
774
+ linestyle="--",
775
+ linewidth=linewidth,
776
+ )
777
+ axes.plot(
778
+ [edge_ghost_grid_2[1], edge_ghost_grid_3[1]],
779
+ [edge_ghost_grid_2[0], edge_ghost_grid_3[0]],
780
+ color="blue",
781
+ linestyle="--",
782
+ linewidth=linewidth,
783
+ )
784
+ axes.plot(
785
+ [edge_ghost_grid_3[1], edge_ghost_grid_4[1]],
786
+ [edge_ghost_grid_3[0], edge_ghost_grid_4[0]],
787
+ color="blue",
788
+ linestyle="--",
789
+ linewidth=linewidth,
790
+ )
791
+ axes.plot(
792
+ [edge_ghost_grid_4[1], edge_ghost_grid_1[1]],
793
+ [edge_ghost_grid_4[0], edge_ghost_grid_1[0]],
794
+ color="blue",
795
+ linestyle="--",
796
+ linewidth=linewidth,
797
+ )
798
+
799
+ if n_transition_layer > 0:
800
+ edge_transition_1 = [
801
+ pml_thickness_px + m_spatial_order + 1,
802
+ pml_thickness_px + m_spatial_order + 1,
803
+ ]
804
+ edge_transition_2 = [
805
+ pml_thickness_px + m_spatial_order + 1,
806
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
807
+ ]
808
+ edge_transition_3 = [
809
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
810
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
811
+ ]
812
+ edge_transition_4 = [
813
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
814
+ pml_thickness_px + m_spatial_order + 1,
815
+ ]
816
+ # put lines in the transition area
817
+ axes.plot(
818
+ [edge_transition_1[1], edge_transition_2[1]],
819
+ [edge_transition_1[0], edge_transition_2[0]],
820
+ color="black",
821
+ linestyle="--",
822
+ linewidth=linewidth,
823
+ )
824
+ axes.plot(
825
+ [edge_transition_2[1], edge_transition_3[1]],
826
+ [edge_transition_2[0], edge_transition_3[0]],
827
+ color="black",
828
+ linestyle="--",
829
+ linewidth=linewidth,
830
+ )
831
+ axes.plot(
832
+ [edge_transition_3[1], edge_transition_4[1]],
833
+ [edge_transition_3[0], edge_transition_4[0]],
834
+ color="black",
835
+ linestyle="--",
836
+ linewidth=linewidth,
837
+ )
838
+ axes.plot(
839
+ [edge_transition_4[1], edge_transition_1[1]],
840
+ [edge_transition_4[0], edge_transition_1[0]],
841
+ color="black",
842
+ linestyle="--",
843
+ linewidth=linewidth,
844
+ )
845
+ if plot_grid:
846
+ # adjust the axes steps
847
+ axes.set_xticks(np.arange(0, processed_p_map.shape[1], grid_steps))
848
+ axes.set_yticks(np.arange(0, processed_p_map.shape[0], grid_steps))
849
+ # font size
850
+ axes.tick_params(axis="both", which="major", labelsize=4)
851
+ axes.set_xlim(0, processed_p_map.shape[1] - 1)
852
+ axes.set_ylim(processed_p_map.shape[0] - 1, 0)
853
+
854
+ axes.grid(
855
+ visible=True,
856
+ # color="gray",
857
+ # linestyle="--",
858
+ # linewidth=linewidth,
859
+ which="both",
860
+ alpha=0.5,
861
+ )
862
+ animation_list.append([image2, text])
863
+ animation_data = animation.ArtistAnimation(
864
+ fig,
865
+ animation_list,
866
+ interval=150,
867
+ blit=True,
868
+ repeat_delay=500,
869
+ )
870
+ animation_data.save(export_name, writer="ffmpeg", dpi=dpi)
871
+
872
+
873
+ def plot_wave_propagation_snapshot( # noqa: PLR0915
874
+ propagation_map: NDArray[np.float64],
875
+ c_map: NDArray[np.float64],
876
+ rho_map: NDArray[np.float64],
877
+ dpi: int = 300,
878
+ export_name: str | Path = "./temp/temp.png",
879
+ vmin: float | None = None,
880
+ vmax: float | None = None,
881
+ resize_factor: int = 1,
882
+ figsize: tuple = (12, 6),
883
+ *,
884
+ plot_pml_boundary: bool = False,
885
+ pml_thickness_px: int = 40,
886
+ n_transition_layer: int = 20,
887
+ m_spatial_order: int = 8,
888
+ linewidth: float = 0.1,
889
+ plot_grid: bool = False,
890
+ grid_steps: int = 2,
891
+ turn_off_axes: bool = False,
892
+ ) -> None:
893
+ """Plot wave propagation with a map overlay using the specified parameters.
894
+
895
+ Parameters
896
+ ----------
897
+ propagation_map : NDArray[np.float64]
898
+ The wave propagation data.
899
+ shape = (nt, nx, ny)
900
+ c_map : NDArray[np.float64]
901
+ The speed of sound map.
902
+ rho_map : NDArray[np.float64]
903
+ The density map.
904
+ dpi : int, optional
905
+ Resolution in dots per inch.
906
+ export_name : str or Path, optional
907
+ The filename for the output animation.
908
+ vmin : float, optional
909
+ The minimum data value for the plot.
910
+ vmax : float, optional
911
+ The maximum data value for the plot.
912
+ resize_factor : int, optional
913
+ Factor to resize each frame.
914
+ plot_pml_boundary : bool, optional
915
+ If True, plot the PML boundary.
916
+ pml_thickness_px : int, optional
917
+ Thickness of the PML in pixels.
918
+ m_spatial_order : int, optional
919
+ Spatial order for the PML.
920
+ linewidth : float, optional
921
+ Width of the lines in the PML area.
922
+ figsize : tuple, optional
923
+ Size of the figure (width, height).
924
+ n_transition_layer : int, optional
925
+ Thickness of the PML transition layer in pixels.
926
+ grid_steps : int, optional
927
+ Steps for the grid lines.
928
+ plot_grid : bool, optional
929
+ If True, plot the grid lines.
930
+ turn_off_axes : bool, optional
931
+ If True, turn off the axes.
932
+
933
+ """
934
+ plt.close()
935
+ plt.cla()
936
+ plt.clf()
937
+ _, axes = plt.subplots(1, 1, figsize=figsize)
938
+
939
+ z_map = c_map * rho_map
940
+ z_map = (z_map - np.min(z_map)) / (np.max(z_map) - np.min(z_map) + 1e-9)
941
+ if vmax is None:
942
+ vmax = np.max(propagation_map)
943
+ if vmin is None:
944
+ vmin = np.min(propagation_map)
945
+
946
+ z_map_offset = vmax * 0.8
947
+
948
+ p_map_i = propagation_map
949
+ processed_p_map = p_map_i + z_map_offset * (z_map)
950
+ if resize_factor != 1:
951
+ new_width = int(processed_p_map.shape[1] * resize_factor)
952
+ new_height = int(processed_p_map.shape[0] * resize_factor)
953
+ processed_p_map = cv2.resize(processed_p_map, (new_width, new_height))
954
+ axes.imshow(
955
+ processed_p_map,
956
+ vmin=vmin,
957
+ vmax=vmax,
958
+ interpolation="nearest",
959
+ )
960
+ # set text to show the current time step
961
+
962
+ if plot_pml_boundary:
963
+ edge_pml_1 = [
964
+ pml_thickness_px + n_transition_layer + m_spatial_order,
965
+ pml_thickness_px + n_transition_layer + m_spatial_order,
966
+ ]
967
+ edge_pml_2 = [
968
+ pml_thickness_px + n_transition_layer + m_spatial_order,
969
+ processed_p_map.shape[1] - pml_thickness_px - n_transition_layer - m_spatial_order - 1,
970
+ ]
971
+ edge_pml_3 = [
972
+ processed_p_map.shape[0] - pml_thickness_px - n_transition_layer - m_spatial_order - 1,
973
+ processed_p_map.shape[1] - pml_thickness_px - n_transition_layer - m_spatial_order - 1,
974
+ ]
975
+ edge_pml_4 = [
976
+ processed_p_map.shape[0] - pml_thickness_px - n_transition_layer - m_spatial_order - 1,
977
+ pml_thickness_px + n_transition_layer + m_spatial_order,
978
+ ]
979
+ # put lines in the pml area
980
+ axes.plot(
981
+ [edge_pml_1[1], edge_pml_2[1]],
982
+ [edge_pml_1[0], edge_pml_2[0]],
983
+ color="red",
984
+ linestyle="--",
985
+ linewidth=linewidth,
986
+ )
987
+ axes.plot(
988
+ [edge_pml_2[1], edge_pml_3[1]],
989
+ [edge_pml_2[0], edge_pml_3[0]],
990
+ color="red",
991
+ linestyle="--",
992
+ linewidth=linewidth,
993
+ )
994
+ axes.plot(
995
+ [edge_pml_3[1], edge_pml_4[1]],
996
+ [edge_pml_3[0], edge_pml_4[0]],
997
+ color="red",
998
+ linestyle="--",
999
+ linewidth=linewidth,
1000
+ )
1001
+ axes.plot(
1002
+ [edge_pml_4[1], edge_pml_1[1]],
1003
+ [edge_pml_4[0], edge_pml_1[0]],
1004
+ color="red",
1005
+ linestyle="--",
1006
+ linewidth=linewidth,
1007
+ )
1008
+
1009
+ edge_ghost_grid_1 = [
1010
+ m_spatial_order,
1011
+ m_spatial_order,
1012
+ ]
1013
+ edge_ghost_grid_2 = [
1014
+ m_spatial_order,
1015
+ processed_p_map.shape[1] - m_spatial_order - 1,
1016
+ ]
1017
+ edge_ghost_grid_3 = [
1018
+ processed_p_map.shape[0] - m_spatial_order - 1,
1019
+ processed_p_map.shape[1] - m_spatial_order - 1,
1020
+ ]
1021
+ edge_ghost_grid_4 = [
1022
+ processed_p_map.shape[0] - m_spatial_order - 1,
1023
+ m_spatial_order,
1024
+ ]
1025
+ # put lines in the ghost grid area
1026
+ axes.plot(
1027
+ [edge_ghost_grid_1[1], edge_ghost_grid_2[1]],
1028
+ [edge_ghost_grid_1[0], edge_ghost_grid_2[0]],
1029
+ color="blue",
1030
+ linestyle="--",
1031
+ linewidth=linewidth,
1032
+ )
1033
+ axes.plot(
1034
+ [edge_ghost_grid_2[1], edge_ghost_grid_3[1]],
1035
+ [edge_ghost_grid_2[0], edge_ghost_grid_3[0]],
1036
+ color="blue",
1037
+ linestyle="--",
1038
+ linewidth=linewidth,
1039
+ )
1040
+ axes.plot(
1041
+ [edge_ghost_grid_3[1], edge_ghost_grid_4[1]],
1042
+ [edge_ghost_grid_3[0], edge_ghost_grid_4[0]],
1043
+ color="blue",
1044
+ linestyle="--",
1045
+ linewidth=linewidth,
1046
+ )
1047
+ axes.plot(
1048
+ [edge_ghost_grid_4[1], edge_ghost_grid_1[1]],
1049
+ [edge_ghost_grid_4[0], edge_ghost_grid_1[0]],
1050
+ color="blue",
1051
+ linestyle="--",
1052
+ linewidth=linewidth,
1053
+ )
1054
+
1055
+ if n_transition_layer > 0:
1056
+ edge_transition_1 = [
1057
+ pml_thickness_px + m_spatial_order + 1,
1058
+ pml_thickness_px + m_spatial_order + 1,
1059
+ ]
1060
+ edge_transition_2 = [
1061
+ pml_thickness_px + m_spatial_order + 1,
1062
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
1063
+ ]
1064
+ edge_transition_3 = [
1065
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
1066
+ processed_p_map.shape[1] - pml_thickness_px - m_spatial_order - 1,
1067
+ ]
1068
+ edge_transition_4 = [
1069
+ processed_p_map.shape[0] - pml_thickness_px - m_spatial_order - 1,
1070
+ pml_thickness_px + m_spatial_order + 1,
1071
+ ]
1072
+ # put lines in the transition area
1073
+ axes.plot(
1074
+ [edge_transition_1[1], edge_transition_2[1]],
1075
+ [edge_transition_1[0], edge_transition_2[0]],
1076
+ color="black",
1077
+ linestyle="--",
1078
+ linewidth=linewidth,
1079
+ )
1080
+ axes.plot(
1081
+ [edge_transition_2[1], edge_transition_3[1]],
1082
+ [edge_transition_2[0], edge_transition_3[0]],
1083
+ color="black",
1084
+ linestyle="--",
1085
+ linewidth=linewidth,
1086
+ )
1087
+ axes.plot(
1088
+ [edge_transition_3[1], edge_transition_4[1]],
1089
+ [edge_transition_3[0], edge_transition_4[0]],
1090
+ color="black",
1091
+ linestyle="--",
1092
+ linewidth=linewidth,
1093
+ )
1094
+ axes.plot(
1095
+ [edge_transition_4[1], edge_transition_1[1]],
1096
+ [edge_transition_4[0], edge_transition_1[0]],
1097
+ color="black",
1098
+ linestyle="--",
1099
+ linewidth=linewidth,
1100
+ )
1101
+ if plot_grid:
1102
+ # adjust the axes steps
1103
+ axes.set_xticks(np.arange(0, processed_p_map.shape[1], grid_steps))
1104
+ axes.set_yticks(np.arange(0, processed_p_map.shape[0], grid_steps))
1105
+ # font size
1106
+ axes.tick_params(axis="both", which="major", labelsize=4)
1107
+ axes.set_xlim(0, processed_p_map.shape[1] - 1)
1108
+ axes.set_ylim(processed_p_map.shape[0] - 1, 0)
1109
+
1110
+ axes.grid(
1111
+ visible=True,
1112
+ which="both",
1113
+ alpha=0.5,
1114
+ )
1115
+ if turn_off_axes:
1116
+ axes.set_xticks([])
1117
+ axes.set_yticks([])
1118
+ axes.set_xlabel("")
1119
+ axes.set_ylabel("")
1120
+ axes.set_title("")
1121
+ plt.tight_layout()
1122
+ plt.savefig(export_name, dpi=dpi)