@@ -149,16 +149,22 @@ def main() -> None: # noqa: PLR0915
149149 )
150150
151151 # define scatterer
152- scatterer = presets .ScattererDomain (
152+
153+ rng = np .random .default_rng (seed = 42 )
154+
155+ csr = 0.05
156+ ratio_scatterer_to_total_grid = 0.38
157+
158+ scatterer , _ = fullwave .utils .generate_scatterer (
153159 grid = grid ,
154- num_scatterer = 18 ,
155- ncycles = 2 ,
160+ # ratio_scatterer_to_total_grid=0.38,
161+ ratio_scatterer_to_total_grid = ratio_scatterer_to_total_grid ,
162+ scatter_value_std = csr / 2 ,
163+ rng = rng ,
156164 )
157165
158- # scatterer will be applied to density directly, instead of registering as a domain
159- csr = 0.035
160- background .density -= scatterer .density * csr
161- abdominal_wall .density -= scatterer .density * csr
166+ background .density *= scatterer
167+ abdominal_wall .density *= scatterer
162168
163169 # register the domains to MediumBuilder
164170 mb = MediumBuilder (
@@ -170,7 +176,7 @@ def main() -> None: # noqa: PLR0915
170176 # mb.register_domain(simple_domain_2)
171177
172178 # we can plot to see the current registered domains
173- mb .plot_current_map (export_path = work_dir / "medium.png " )
179+ mb .plot_current_map (export_path = work_dir / "medium.svg " )
174180
175181 # generate medium for simulation
176182 medium = mb .run ()
@@ -200,17 +206,18 @@ def main() -> None: # noqa: PLR0915
200206 )
201207 propagation_map = np .nan_to_num (propagation_map , 0 , posinf = p_max , neginf = - p_max )
202208
203- p_max_plot = np .abs (propagation_map ).max ().item () / 2
209+ p_max_plot = np .abs (propagation_map ).max ().item () / 8
204210
205- time_step = propagation_map .shape [0 ] // 3 * 2
211+ time_step = propagation_map .shape [0 ] // 50 * 37
206212 plot_utils .plot_wave_propagation_snapshot (
207213 propagation_map = propagation_map [time_step ],
208214 c_map = medium .sound_speed ,
209215 rho_map = medium .density ,
210- export_name = work_dir / "wave_propagation_snapshot_1.png " ,
216+ export_name = work_dir / "wave_propagation_snapshot_1.svg " ,
211217 vmin = - p_max_plot ,
212218 vmax = p_max_plot ,
213219 turn_off_axes = True ,
220+ figsize = (6 , 6 ),
214221 )
215222
216223 plot_utils .plot_wave_propagation_with_map (
0 commit comments