sidescanpy.processing.inversion#
Undo recorded corrections, driven by processing_history.
No uncorrected copy of the backscatter is stored: radiometric steps are
inverted exactly from the parameters recorded in their history records, and
geometric/georef steps are undone by dropping the variables they added, and
layback by restoring the positions it kept.
uncorrected_backscatter()– the pre-radiometric signal as a DataArray (nothing else touched). Works lazily on dask-backed data.invert()– a dataset with the chosen steps undone and their history records removed.
Not invertible: crop_farrange (samples are gone), interpolate_aux
(the converter’s embedded per-ping values were overwritten) and caller-supplied
steps (unknown effect).
Legacy files: TVG records written by older versions (tvg_correction) carry
the same parameters and invert the same way. A legacy file whose only TVG
evidence is the processing_level == "radiometric" attribute falls back to
its stored LEGACY_RAW_VAR (backscatter_raw) variable.
2026 rshomberg@uri.edu
Contents
Built-in immutable sequence. |
|
Name of the in-memory variable holding the uncorrected signal (never stored on disk). |
|
Variable older files stored as a raw copy; read for legacy files, dropped on rewrite. |
|
|
|
Add the |
|
Undo recorded correction steps. |
- sidescanpy.processing.inversion.INVERTIBLE_STEPS#
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- sidescanpy.processing.inversion.UNCORRECTED_VAR = 'uncorrected'#
Name of the in-memory variable holding the uncorrected signal (never stored on disk).
- sidescanpy.processing.inversion.LEGACY_RAW_VAR = 'backscatter_raw'#
Variable older files stored as a raw copy; read for legacy files, dropped on rewrite.
- sidescanpy.processing.inversion.uncorrected_backscatter(ds)#
backscatter_intensitywith every recorded radiometric step undone.Equals
backscatter_intensitywhen no radiometric step was applied. Exact-zero input amplitude (clipped to -120 dB by TVG) comes back as 0. Lazy for dask-backed input. Does not modifyds.
- sidescanpy.processing.inversion.with_uncorrected_var(ds)#
Add the
uncorrectedvariable unlessdsalready has it.uncorrectedisuncorrected_backscatter()(backscatter_intensitywith every recorded radiometric step undone); lazy on dask-backed data. Returns a new dataset;dsis not modified.
- sidescanpy.processing.inversion.invert(ds, steps=None)#
Undo recorded correction steps.
- Parameters:
- dsxr.Dataset
Frequency channel dataset.
- stepsiterable of str, optional
Steps to undo, any of
INVERTIBLE_STEPS. Default: every one that has been applied. Radiometric steps are undone newest first and must include every radiometric step recorded after the oldest one requested (tvgcannot be undone underneath a laterrange_correction). Undoinggeometricalso undoesgeoref(it is derived from the geometric variables) and requiresrange_correctionto be undone too if it was applied (it needsground_range_m). Undoinglaybackrestores the recorded positions and also undoesgeoref(computed from the moved positions). Steps that were never applied are ignored.
- Returns:
- xr.Dataset
New dataset:
backscatter_intensityrestored, geometric/georef output variables dropped, layback positions restored, and the undone steps’ history records removed. Records of non-invertible steps (crop_farrange,interpolate_aux, custom steps) are kept.
- Raises:
- ValueError
For a non-invertible or unknown step name, or a request that would leave a dependent step behind (see above).