From 0e32c91589f81bf1eeb85859466a99688a1f0587 Mon Sep 17 00:00:00 2001 From: TomWinder Date: Mon, 12 Jan 2026 08:50:51 +0000 Subject: [PATCH] :bug: Fix scalar conversion in synthetic example Explicitly read the first index in the array returned from reading the traveltime / adding random noise when simulating the synthetic waveform, so that conversion to an integer does not fail. See QuakeMigrate/QuakeMigrate#228 Mirrors the commit at https://github.com/QuakeMigrate/QuakeMigrate/pull/229/commits/790ca4e89ba398c8f0966544ca0e4e7b0977d273 --- figures/synthetic/generate_synthetic_results/simulate/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/figures/synthetic/generate_synthetic_results/simulate/core.py b/figures/synthetic/generate_synthetic_results/simulate/core.py index a5dae7e..1db1713 100755 --- a/figures/synthetic/generate_synthetic_results/simulate/core.py +++ b/figures/synthetic/generate_synthetic_results/simulate/core.py @@ -133,7 +133,7 @@ def simulate_waveforms( P = Trace() P_ttime = lut.traveltime_to("P", earthquake_ijk, station=station) P_ttime += np.random.normal(scale=noise["traveltime"]["P"], size=1) - roll_by = int(wavelet.sps * P_ttime) + roll_by = int(wavelet.sps * P_ttime[0]) P_amp_noise = np.random.normal( scale=noise["amplitude"]["P"], size=len(wavelet.data) ) @@ -143,7 +143,7 @@ def simulate_waveforms( S1, S2 = Trace(), Trace() S_ttime = lut.traveltime_to("S", earthquake_ijk, station=station) S_ttime += np.random.normal(scale=noise["traveltime"]["S"], size=1) - roll_by = int(wavelet.sps * S_ttime) + roll_by = int(wavelet.sps * S_ttime[0]) S_amp_noise = np.random.normal( scale=noise["amplitude"]["S"], size=len(wavelet.data) )