Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kwave/kWaveSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ def _is_binary_sensor_mask(self, kgrid_dim: int) -> bool:
return True

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

if len(pml_size) == 1:
Expand Down
8 changes: 5 additions & 3 deletions tests/test_kspaceFirstOrder3D_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ def make_simulation_parameters(directory: Path):
# define a binary planar sensor
sensor = kSensor()
sensor_mask_array = np.zeros(N)
sensor_mask_array[0, :, :] = 1 # Corrected to be a plane for 3D
sensor_mask_array[0, :, :] = 1 # Corrected to be a plane for 3D
sensor.mask = sensor_mask_array

input_filename = directory / "kwave_input.h5"
output_filename = directory / "kwave_output.h5"
checkpoint_filename = directory / "kwave_checkpoint.h5"

simulation_options = SimulationOptions(
save_to_disk=True, # Must be true for kspaceFirstOrder3D
save_to_disk=True, # Must be true for kspaceFirstOrder3D
pml_size=PML_size,
pml_inside=False,
smooth_p0=False, # p0 is already smoothed
smooth_p0=False, # p0 is already smoothed
data_cast="single",
input_filename=input_filename,
output_filename=output_filename,
Expand All @@ -75,6 +75,7 @@ def test_kspaceFirstOrder3D_input_state_preservation():
# Store original states of critical attributes for comparison
original_source_p0 = deepcopy(source.p0)
original_sensor_mask = deepcopy(sensor.mask)


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

Loading