pycsamt.emtools.frequency#
Functions
|
|
|
|
|
|
|
Drop rows whose frequency confidence is below |
|
Edit frequency rows and return diagnostics in one workflow. |
|
Return one row per original station-frequency edit decision. |
|
Summarize station-level changes after frequency editing. |
|
Set low-confidence frequency rows to NaN without changing the grid. |
|
|
|
|
|
|
|
Plot dropped, masked, recovered, and kept frequency decisions. |
|
Plot station-level before/after frequency-edit summary. |
|
Recover recoverable frequency rows using trusted neighboring rows. |
|
|
|
|
|
|
|
Classes
|
Container returned by confidence-based frequency editing. |
- class pycsamt.emtools.frequency.FrequencyEditResult(sites, report, decisions, mode, method, ci_hi, ci_lo, reject, interpolation)[source]#
Bases:
objectContainer returned by confidence-based frequency editing.
- Parameters:
- pycsamt.emtools.frequency.select_band(sites, *, fmin=None, fmax=None, band_hz=None, keep=None, inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.drop_duplicates(sites, *, tol=1e-10, inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.drop_low_confidence_frequencies(sites, *, method='composite', threshold=0.5, weights=None, also='both', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Drop rows whose frequency confidence is below
threshold.The confidence scores are computed with
pycsamt.emtools.qc.frequency_confidence_table(). The operation is station-aware: each station keeps or drops its own bad frequency rows. A newSitesobject is returned unlessinplace=True.
- pycsamt.emtools.frequency.mask_low_confidence_frequencies(sites, *, method='composite', threshold=0.5, weights=None, also='both', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Set low-confidence frequency rows to NaN without changing the grid.
- pycsamt.emtools.frequency.recover_low_confidence_frequencies(sites, *, method='composite', ci_hi=0.9, ci_lo=0.5, weights=None, interpolation='linear', reject='mask', also='both', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Recover recoverable frequency rows using trusted neighboring rows.
Rows with confidence in
[ci_lo, ci_hi)are treated as recoverable and are interpolated in log-frequency from rows with confidence>= ci_hi. Rows belowci_loare considered rejected and are either masked, dropped, or kept depending onreject.
- pycsamt.emtools.frequency.edit_frequencies_by_confidence(sites, *, mode='recover', before_sites=None, method='composite', threshold=0.5, ci_hi=0.9, ci_lo=0.5, weights=None, interpolation='linear', reject='drop', also='both', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]#
Edit frequency rows and return diagnostics in one workflow.
This is the high-level confidence-editing entry point. It applies one of the low-level edit strategies and immediately computes a station report and a station-frequency decision table. Use
before_siteswhensitesis already an in-memory object and a reliable before/after comparison is required, because lower-level site editors can mutate the wrapped impedance objects while constructing the edited return value.- Parameters:
sites (path-like, EDI-like, Sites, or sequence) – Input data to edit. Path-like inputs are normally safe to use directly because they can be loaded independently by the package. In-memory objects should be paired with
before_siteswhen the report must preserve an untouched baseline.mode ({'recover', 'drop', 'mask'}, default 'recover') – Frequency-editing strategy.
'recover'interpolates recoverable rows in log-frequency and handles rejected rows according toreject.'drop'removes rows belowthreshold.'mask'keeps the frequency grid but replaces low-confidence tensor rows by missing values when the container allows it.before_sites (optional) – Independent baseline used only for reporting and decision tracking. If omitted,
sitesis used as the baseline.method (str, default 'composite') – Confidence metric passed to
pycsamt.emtools.qc.frequency_confidence_table().threshold (float, default 0.50) – Confidence threshold used by
mode='drop'andmode='mask'.ci_hi (float, default 0.90 and 0.50) – High-confidence and low-confidence limits used by
mode='recover'and by the diagnostic report.ci_lo (float, default 0.90 and 0.50) – High-confidence and low-confidence limits used by
mode='recover'and by the diagnostic report.weights (dict or None, default None) – Optional confidence-metric weights.
interpolation ({'linear', 'nearest'}, default 'linear') – Interpolation strategy for recoverable rows in
mode='recover'.reject ({'drop', 'mask', 'keep'}, default 'drop') – Handling of rows below
ci_loinmode='recover'.also ({'z', 'tipper', 'both'}, default 'both') – Data blocks edited when present.
inplace (bool, default False) – Forwarded to the low-level edit function.
recursive (bool) – Site-loading options forwarded to
ensure_sites().on_dup (str) – Site-loading options forwarded to
ensure_sites().strict (bool) – Site-loading options forwarded to
ensure_sites().verbose (int) – Site-loading options forwarded to
ensure_sites().api (bool | None)
- Returns:
Edited sites together with station-level and station-frequency diagnostics.
- Return type:
- pycsamt.emtools.frequency.frequency_edit_report(before_sites, after_sites, *, method='composite', ci_hi=0.9, ci_lo=0.5, weights=None, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]#
Summarize station-level changes after frequency editing.
The report compares the native frequency rows and finite tensor rows before and after an edit such as dropping, masking, or recovery. It also carries the median confidence from
pycsamt.emtools.qc.frequency_confidence_table().
- pycsamt.emtools.frequency.frequency_edit_decision_table(before_sites, after_sites, *, method='composite', ci_hi=0.9, ci_lo=0.5, weights=None, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]#
Return one row per original station-frequency edit decision.
- pycsamt.emtools.frequency.plot_frequency_edit_summary(before_sites, after_sites, *, method='composite', ci_hi=0.9, ci_lo=0.5, figsize=(9.0, 4.0), station_label_step=1, station_preset='pseudosection', station_style=None, ax=None)[source]#
Plot station-level before/after frequency-edit summary.
- pycsamt.emtools.frequency.plot_frequency_edit_decisions(before_sites, after_sites, *, method='composite', ci_hi=0.9, ci_lo=0.5, figsize=(10.0, 5.0), station_label_step=1, station_preset='pseudosection', station_style=None, ax=None)[source]#
Plot dropped, masked, recovered, and kept frequency decisions.
- pycsamt.emtools.frequency.regrid_to(sites, target_freq, *, method='nearest', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.regrid_logspace(sites, *, fmin=None, fmax=None, band_hz=None, per_decade=6, n_per_decade=None, method='nearest', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.decimate_step(sites, *, step=2, inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.smooth_mavg(sites, *, k=3, window=None, on='both', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.align_grid(sites, *, mode='union', ref_station=None, method='nearest', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
- pycsamt.emtools.frequency.plot_coverage_quality_heatmap(sites, *, axis='period', figsize=(7.5, 4.5), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]#
- pycsamt.emtools.frequency.plot_apparent_depth_psection(sites, *, axis_y='period', agg='median', figsize=(7.5, 4.5), log_color=True, recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]#