Repository navigation
Use the receiver half-step fallback for legacy files in the Marimo reader - #887
Merged
agianno merged 1 commit intoOct 11, 2026
Merged
Conversation
…ader The Marimo h5_reader defaulted a missing TimeSampleOffset attribute to 0.0 for every receiver component. Current gprMax files and the Plotting and Utilities toolboxes place H and I samples at -dt/2 for the same legacy files (trace_time.receiver_time_offset), so the dashboards plotted legacy magnetic field and current traces half a step late, and background subtraction between a current target and a legacy background raised "target and background sample times differ" for identical H/I recordings. Reuse receiver_time_offset when per-dataset metadata is absent so all toolboxes agree on the sample-zero time, and document the fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #886
The Marimo
h5_readerdefaulted a missingTimeSampleOffsetattribute to0.0for every receiver component. The Plotting/Utilities toolboxes (trace_time.receiver_time_offset, used byread_time_history,plot_Ascan,plot_Bscan,outputfiles_merge) treat the same legacy datasets as-dt/2forH*/I*, matching whatfields_outputswrites into current files. The Marimo dashboards therefore plotted legacy magnetic-field and current traces half a step late, andsubtract_receiver_referencerejected a current-format target against a legacy background with "target and background sample times differ" for H/I components even though the recordings were identical.What changed
gprMax/toolboxes/Marimo/h5_reader.py: when a receiver dataset has noTimeSampleOffset, fall back toreceiver_time_offset(component, sample_interval)fromgprMax.toolboxes.Utilities.trace_time(in_read_receiversand in theget_time_axisfallback) instead of0.0. Imports sorted per the pre-commit isort profile; docstring updated.gprMax/toolboxes/Marimo/README.md: one sentence documenting the legacy fallback.tests/toolboxes/test_marimo_h5_reader.py: newlegacy_h5_filefixture (metadata attributes stripped);test_legacy_file_component_time_offsetcheckscomponent_metaandget_time_axisfor E (0) and H (-dt/2);test_legacy_file_matches_current_file_and_plotting_toolboxchecks the legacy axis equals both the current-file axis andread_time_history(...).time.tests/toolboxes/test_physical_trace_consumers.py:test_legacy_background_without_sampling_metadata_matches_current_targetsubtracts a legacy background from a current target forEz,Hx,Ix.How tested
get_time_axisreturns0.0for legacyHx/Hz, and the subtraction test raisesValueError: target and background sample times differforHx/Ix(5 failed, 5 passed for-k legacy).pytest tests/toolboxes/test_marimo_h5_reader.py tests/toolboxes/test_physical_trace_consumers.py tests/toolboxes/test_plotting_outputs.py tests/toolboxes/test_outputfiles_merge.py-> 111 passed; the Marimo processing/trace-matrix/hyperbola suites also pass (201 passed in total across the Marimo tests).black --line-length 100andisort --profile black --line-length 100clean onh5_reader.pyandtest_marimo_h5_reader.py; only the new lines were touched intest_physical_trace_consumers.py, which already exceeds the 100-column pre-commit setting upstream (pyproject.tomlstill says 120).Notes
TimeSampleOffset, so their behaviour is unchanged; only legacy/third-party files without per-dataset metadata are affected.get_time_axiswithoutreceiver/componentstill returns the E-field (whole-step) axis, as before.