Skip to content

Commit 59a3eb4

Browse files
authored
Fix walrus bug
1 parent ecfc3ee commit 59a3eb4

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

kwave/kWaveSimulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ def _is_binary_sensor_mask(self, kgrid_dim: int) -> bool:
15201520
return True
15211521

15221522
# If the sensor mask is larger by PML size in each dimension, it's still a binary mask
1523-
if pml_size := self.options.pml_size is None:
1523+
if (pml_size := self.options.pml_size) is None:
15241524
return False
15251525

15261526
if len(pml_size) == 1:

tests/test_kspaceFirstOrder3D_state.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ def make_simulation_parameters(directory: Path):
3939
# define a binary planar sensor
4040
sensor = kSensor()
4141
sensor_mask_array = np.zeros(N)
42-
sensor_mask_array[0, :, :] = 1 # Corrected to be a plane for 3D
42+
sensor_mask_array[0, :, :] = 1 # Corrected to be a plane for 3D
4343
sensor.mask = sensor_mask_array
4444

4545
input_filename = directory / "kwave_input.h5"
4646
output_filename = directory / "kwave_output.h5"
4747
checkpoint_filename = directory / "kwave_checkpoint.h5"
4848

4949
simulation_options = SimulationOptions(
50-
save_to_disk=True, # Must be true for kspaceFirstOrder3D
50+
save_to_disk=True, # Must be true for kspaceFirstOrder3D
5151
pml_size=PML_size,
5252
pml_inside=False,
53-
smooth_p0=False, # p0 is already smoothed
53+
smooth_p0=False, # p0 is already smoothed
5454
data_cast="single",
5555
input_filename=input_filename,
5656
output_filename=output_filename,
@@ -75,6 +75,7 @@ def test_kspaceFirstOrder3D_input_state_preservation():
7575
# Store original states of critical attributes for comparison
7676
original_source_p0 = deepcopy(source.p0)
7777
original_sensor_mask = deepcopy(sensor.mask)
78+
7879

7980
# If source.p or source.u were time-varying, store their initial states too.
8081
# For this test, p0 is the main source attribute.
@@ -122,3 +123,4 @@ def test_kspaceFirstOrder3D_input_state_preservation():
122123
# Final check that attributes are still the same as the initial state
123124
assert np.array_equal(source.p0, original_source_p0), "source.p0 was modified after second run"
124125
assert np.array_equal(sensor.mask, original_sensor_mask), "sensor.mask was modified after second run"
126+

0 commit comments

Comments
 (0)