Skip to content

Commit 17a64b1

Browse files
authored
Merge pull request #273 from MiraGeoscience/GEOPY-2364
GEOPY-2364: Detect issues with waveform and throw a custom GeoappsError if found
2 parents e227cb9 + f925dbf commit 17a64b1

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

simpeg_drivers/components/factories/survey_factory.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,12 @@ def _dcip_arguments(self, data=None):
203203
def _tdem_arguments(self, data=None):
204204
receivers = data.entity
205205
transmitters = receivers.transmitters
206+
channels = np.array(receivers.channels) * self.params.unit_conversion
206207

207-
if receivers.channels[-1] > (
208-
receivers.waveform[:, 0].max() - receivers.timing_mark
209-
):
208+
if any(channels > (self.params.time_steps.sum() - self.params.timing_mark)):
210209
raise GeoAppsError(
211210
f"The latest time channel {receivers.channels[-1]} exceeds "
212-
f"the waveform discretization. Revise waveform."
211+
f"the waveform discretization. Check waveform sampling from start to end."
213212
)
214213

215214
if isinstance(transmitters, LargeLoopGroundTEMTransmitters):
@@ -239,6 +238,16 @@ def _tdem_arguments(self, data=None):
239238
receivers.waveform[:, 0] - receivers.timing_mark
240239
) * self.params.unit_conversion
241240

241+
# Check single channel per time gate
242+
_, count = np.unique(
243+
np.searchsorted(wave_times, channels, side="right"), return_counts=True
244+
)
245+
if np.any(count > 1):
246+
raise GeoAppsError(
247+
"Multiple channels found within single time step. "
248+
"Check waveform sampling on the off-times."
249+
)
250+
242251
if "1d" in self.factory_type:
243252
on_times = wave_times <= 0.0
244253
waveform = tdem.sources.PiecewiseLinearWaveform(

tests/run_tests/driver_airborne_tem_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ def test_bad_waveform(tmp_path: Path):
7474
with raises(GeoAppsError, match="The latest time"):
7575
_ = fwr_driver.inversion_data.survey
7676

77+
with geoh5:
78+
params.data_object.channels[-1] = 0.7
79+
80+
with raises(GeoAppsError, match="Multiple channels found within single time step"):
81+
_ = fwr_driver.inversion_data.survey
82+
7783

7884
def test_airborne_tem_fwr_run(
7985
tmp_path: Path,

0 commit comments

Comments
 (0)