2.14.2.5. pycsamt.emtools.qc#

Quality-control confidence ratios for EM transfer functions.

The composite confidence ratio (CR) used by this module is a bounded, weighted score:

CR = sum_k w_k s_k / sum_k w_k, for finite component scores s_k.

The default components are data coverage, tensor uncertainty, off-diagonal consistency, diagonal leakage, phase smoothness, and spatial coherence. Each score is clipped to [0, 1], where 1 is most trustworthy. The default manuscript classes are CR >= 0.95 (safe), 0.85 <= CR < 0.95 (recoverable/marginal), and CR < 0.85 (reject/review).

Functions

build_qc_table(sites, *[, include_skew, ...])

confidence_ratio(scores, *[, weights, ...])

Compute the composite confidence ratio from diagnostic scores.

export_confidence_map(sites, *[, csv_path, ...])

Export station confidence to CSV and/or a Surfer DSAA grid.

frequency_confidence_table(sites, *[, ...])

Return frequency-level confidence scores for EM stations.

overlay_noise_cone(ax, period, lo, hi, *[, ...])

Overlay lower and upper noise envelopes on an existing period axis.

overlay_spectral_holes(ax, sites, *[, ...])

Highlight gaps in spectral coverage on an existing QC plot.

plot_confidence_band_summary(sites, *[, ...])

Plot line-wide confidence statistics for each period sample.

plot_confidence_before_after(before_sites[, ...])

Compare matched station confidence before and after processing.

plot_confidence_component_map(sites, *[, ...])

Plot publication-style maps of confidence and its components.

plot_confidence_coverage_curve(sites, *[, ...])

Plot survey retention as the minimum confidence requirement rises.

plot_confidence_distribution(sites, *[, ...])

Summarize confidence distributions, exceedance, and line spread.

plot_confidence_grid_map(sites, *[, method, ...])

Render confidence on a regular map grid inside the survey hull.

plot_confidence_heatmap(sites, *[, method, ...])

Plot station confidence and its diagnostic components as a matrix.

plot_confidence_map(sites, *[, method, ...])

Map station-level confidence at geographic or projected coordinates.

plot_confidence_method_comparison(sites, *)

Compare presence and composite confidence on matched station maps.

plot_confidence_profile(sites, *[, method, ...])

Profile confidence-ratio (CR) scatter plot along the survey line.

plot_confidence_rank(sites, *[, method, ...])

Rank station scores and survey-line performance.

plot_confidence_risk_map(sites, *[, method, ...])

Plot spatial confidence risk, defined as 1 - confidence.

plot_consistency_fan(sites, *[, station, ...])

Plot cross-station response consistency as a fan diagram.

plot_coverage_psection(sites, *[, metric, ...])

Plot frequency coverage and data availability as a pseudosection.

plot_frequency_confidence_psection(sites, *)

Plot frequency confidence as a station-period pseudo-section.

plot_qc_quicklook(sites, *[, axes, figsize, ...])

Create a compact multi-panel quality-control summary for a survey.

plot_snr_hist(sites, *[, bins, figsize, ...])

Plot the distribution of signal-to-noise ratios across survey data.

plot_station_confidence_dashboard(sites, *)

Plot a 2-by-3 confidence dashboard for one station.

plot_station_confidence_spectrum(sites, *[, ...])

Plot confidence components versus period for one station.

plot_xyyx_crossover_map(sites, *[, figsize, ...])

Map XY/YX crossover behaviour across stations and frequencies.

qc_flags(sites, *[, min_frac_ok, ...])

station_confidence_table(sites, *[, method, ...])

Return station-level confidence scores for EM transfer functions.

pycsamt.emtools.qc.build_qc_table(sites, *, include_skew=True, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]
Parameters:
Return type:

Any

pycsamt.emtools.qc.confidence_ratio(scores, *, weights=None, n_freq=1, return_error=False)[source]

Compute the composite confidence ratio from diagnostic scores.

The confidence ratio is a weighted finite-score mean:

\[\mathrm{CR} = \frac{\sum_k w_k s_k \mathbf{1}_{s_k\ finite}} {\sum_k w_k \mathbf{1}_{s_k\ finite}}, \qquad 0 \leq s_k \leq 1.\]

The default score vector is coverage, uncertainty, offdiag, diagonal, phase, spatial with weights 0.35, 0.20, 0.15, 0.10, 0.10, 0.10. Missing scores are ignored and all finite scores are clipped to [0, 1].

The optional error is the population spread of available component scores; when only one score is available it falls back to the binomial standard error sqrt(CR * (1 - CR) / n_freq).

Parameters:
Return type:

float | tuple[float, float]

pycsamt.emtools.qc.frequency_confidence_table(sites, *, method='composite', weights=None, ci_hi=0.95, ci_lo=0.85, relerr_threshold=0.2, offdiag_tolerance_log10=0.35, diagonal_leakage_max=0.35, phase_jump_tolerance_deg=90.0, spatial_tolerance_log10=0.6, spacing_m=200.0, force_spacing=False, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]

Return frequency-level confidence scores for EM stations.

The returned table has one row for each station-frequency sample. It is designed as a reusable quality-control source for plots, masking rules, and inversion-preparation reports. method="presence" scores only finite impedance-tensor availability. method="composite" combines coverage, tensor uncertainty, off-diagonal consistency, diagonal leakage, phase smoothness, and same-frequency spatial coherence.

See station_confidence_table() for how distance_m, spacing_m, and force_spacing interact.

Parameters:
Return type:

Any

pycsamt.emtools.qc.export_confidence_map(sites, *, csv_path=None, surfer_path=None, method='composite', coordinate_system='auto', line_labels=None, grid_shape=(200, 200), max_triangle_edge=None, recursive=True, on_dup='replace', strict=False, verbose=0)[source]

Export station confidence to CSV and/or a Surfer DSAA grid.

CSV contains station coordinates, confidence, uncertainty, and composite components. The Surfer grid contains linearly interpolated confidence inside the station convex hull; cells outside it (and optionally across triangles longer than max_triangle_edge) use Surfer’s blank value. grid_shape is (nx, ny).

Parameters:
Return type:

dict[str, Path]

pycsamt.emtools.qc.plot_confidence_band_summary(sites, *, method='composite', ci_hi=0.95, ci_lo=0.85, figsize=(8.0, 4.0), spacing_m=200.0, recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Plot line-wide confidence statistics for each period sample.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.plot_confidence_before_after(before_sites, after_sites=None, *, method='composite', before_method=None, after_method=None, line_labels=None, before_label='Before', after_label='After', ci_hi=0.95, ci_lo=0.85, change_tolerance=0.01, show_errorbars=True, show_station_labels='auto', station_label_step=None, show_line_panel=True, improvement_color='#1a9850', degradation_color='#d73027', stable_color='#7f7f7f', delta_limit=None, marker_size=38.0, figsize=(12.2, 4.6), recursive=True, on_dup='replace', strict=False, verbose=0, axes=None)[source]

Compare matched station confidence before and after processing.

after_sites defaults to before_sites so scoring-method changes can also be audited explicitly with before_method and after_method. Stations are matched by name; unmatched stations are reported on the returned figure but are excluded from paired change statistics.

Parameters:
  • before_sites (Any)

  • after_sites (Any | None)

  • method (str)

  • before_method (str | None)

  • after_method (str | None)

  • line_labels (Any)

  • before_label (str)

  • after_label (str)

  • ci_hi (float)

  • ci_lo (float)

  • change_tolerance (float)

  • show_errorbars (bool)

  • show_station_labels (bool | str)

  • station_label_step (int | None)

  • show_line_panel (bool)

  • improvement_color (str)

  • degradation_color (str)

  • stable_color (str)

  • delta_limit (float | None)

  • marker_size (float)

  • figsize (tuple[float, float])

  • recursive (bool)

  • on_dup (str)

  • strict (bool)

  • verbose (int)

  • axes (Any)

Return type:

Figure

pycsamt.emtools.qc.plot_confidence_component_map(sites, *, method='composite', components=None, coordinate_system='auto', line_labels=None, connect=True, cmap='RdYlGn', marker_size=38.0, station_labels=False, station_label_step=None, line_names=True, ncols=4, figsize=None, map_aspect='auto', panel_letters=True, colorbar_label='Confidence component score', axes=None, recursive=True, on_dup='replace', strict=False, verbose=0)[source]

Plot publication-style maps of confidence and its components.

Every panel uses the same station geometry, extent, and fixed 0–1 color normalization, allowing direct scientific comparison between component scores. The default seven panels are overall confidence, coverage, uncertainty, off-diagonal consistency, diagonal leakage, phase smoothness, and spatial coherence.

map_aspect="auto" is the compact publication default. Use "geographic" to preserve longitude/latitude ground proportions or "equal" for equal numeric axis units.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_confidence_coverage_curve(sites, *, method='composite', line_labels=None, thresholds=None, ci_hi=0.95, ci_lo=0.85, show_station_retention=True, show_data_retention=True, show_route_retention=True, show_line_curves=True, show_threshold_values=True, station_color='#2166ac', data_color='#7b3294', route_color='#1b7837', line_cmap='tab10', figsize=(11.5, 4.6), recursive=True, on_dup='replace', strict=False, verbose=0, axes=None)[source]

Plot survey retention as the minimum confidence requirement rises.

Station retention is the fraction of stations meeting a threshold. Data retention weights qualifying stations by their number of valid transfer- function rows. Route retention is the fraction of connected survey length whose two bounding stations both qualify; it therefore detects spatial fragmentation that a station count alone can hide.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_confidence_distribution(sites, *, method='composite', metric='confidence', line_labels=None, ci_hi=0.95, ci_lo=0.85, bins=16, density=True, show_rug=True, show_violin=True, show_points=True, presence_color='#377eb8', composite_color='#e6550d', metric_color='#5e3c99', class_colors=('#f4a6a6', '#f6d78b', '#a9d8a0'), figsize=(12.0, 4.3), recursive=True, on_dup='replace', strict=False, verbose=0, axes=None)[source]

Summarize confidence distributions, exceedance, and line spread.

The three panels show a histogram with a lightweight Gaussian density, empirical cumulative distributions, and line-wise violin/box summaries. method='both' compares matched presence and composite scores. For a diagnostic component, select one method and pass its column as metric.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_confidence_heatmap(sites, *, method='composite', components=None, line_labels=None, station_order='route', ci_hi=0.95, ci_lo=0.85, cmap='RdYlGn', segmented_colors=True, annotate='auto', annotation_fmt='.2f', annotation_fontsize=5.5, station_label_step=None, show_line_names=True, show_line_separators=True, missing_color='#d9d9d9', figsize=(13.0, 4.8), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Plot station confidence and its diagnostic components as a matrix.

Stations are columns and metrics are rows. With station_order='route' each survey line is ordered using coordinate-derived chainage and lines remain contiguous. Missing component scores are shown explicitly rather than being assigned a misleading confidence colour.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.plot_confidence_map(sites, *, method='composite', coordinate_system='auto', mode='auto', line_labels=None, connect=True, contour_levels=12, colorbar_min='auto', segmented_colors=True, max_triangle_edge=None, show_stations=True, show_confidence_values=False, confidence_value_step=None, confidence_value_fmt='{:.2f}', confidence_value_fontsize=7.0, show_contour_lines=False, contour_line_levels=None, contour_line_colors='0.25', contour_linewidths=0.65, contour_linestyles='solid', contour_labels=True, contour_label_fmt='%.2f', contour_label_fontsize=7.0, contour_label_inline=True, show_threshold_contours=True, threshold_line_color='black', threshold_linewidth=1.35, threshold_linestyle='solid', station_labels=False, station_label_step=None, ci_hi=0.95, ci_lo=0.85, boundary_levels=None, cmap='RdYlGn', marker_size=72.0, figsize=(7.5, 5.5), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Map station-level confidence at geographic or projected coordinates.

Route and scatter modes do not interpolate between stations. Contour mode uses a triangular surface inside the survey’s convex hull and rejects collinear station layouts, so a single profile cannot accidentally appear to provide two-dimensional spatial coverage.

Parameters:
  • sites (path, EDI-like, Sites, or iterable) – Input stations accepted by station_confidence_table().

  • method ({"presence", "composite"}) – Confidence scoring method.

  • coordinate_system ({"auto", "geographic", "projected"}) – "auto" prefers longitude/latitude and falls back to easting/northing. The selected pair must be available per station.

  • mode ({"auto", "scatter", "route", "contour"}) – Map representation. "auto" selects "route" when connect is true and "scatter" otherwise. "contour" requires at least three non-collinear station coordinates.

  • line_labels (mapping, sequence, str, or None) – Optional survey-line membership. A mapping is keyed by station name; a sequence follows table order; one string assigns every station to that line. When omitted all stations form one route.

  • connect (bool) – Overlay routes within each line. In contour mode this is useful for retaining the acquisition geometry above the interpolated surface.

  • contour_levels (int or array-like) – Number of discrete filled intervals, or explicit boundaries.

  • colorbar_min (float or "auto") – Lower contour/colorbar boundary. "auto" rounds down the observed minimum: to a 0.05 step when all CR values are at least 0.5, otherwise to a 0.1 step. Applies consistently to contour, route, and scatter modes. Pass 0.0 to retain the original full 0–1 scale.

  • segmented_colors (bool) – Use discrete color intervals with explicit breaks at 0.50, ci_lo, ci_hi, and 1.00. Set false for a continuous gradient.

  • max_triangle_edge (float or None) – Optional maximum triangle-edge length, expressed in the selected map units. Triangles crossing a larger unsurveyed gap are masked.

  • show_stations (bool) – Draw confidence-coloured station markers over the map.

  • show_confidence_values (bool) – Annotate the numeric confidence beside each displayed station.

  • confidence_value_step (int or None) – Label every Nth station. None automatically thins surveys with more than 20 stations while retaining the final station value.

  • confidence_value_fmt (str) – Python format string for station confidence annotations.

  • confidence_value_fontsize (float) – Font size for station confidence annotations.

  • show_contour_lines (bool) – Overlay ordinary confidence isolines and, by default, their values.

  • contour_line_levels (array-like or None) – Isoline values. None uses the discrete filled-contour boundaries that fall within the observed confidence range.

  • contour_line_colors (Any) – Matplotlib styling passed to tricontour().

  • contour_linewidths (Any) – Matplotlib styling passed to tricontour().

  • contour_linestyles (Any) – Matplotlib styling passed to tricontour().

  • contour_labels (bool) – Label ordinary contour lines with their confidence values.

  • contour_label_fmt (str, mapping, or callable) – Label formatter passed to clabel().

  • contour_label_fontsize (float) – Numeric contour-label size.

  • contour_label_inline (bool) – Remove the line beneath each numeric contour label.

  • show_threshold_contours (bool) – Delineate 0.50, ci_lo, and ci_hi on the contour surface when those values are crossed by the observed data. The colorbar always marks every applicable boundary.

  • threshold_line_color (Any) – Styling for the emphasized confidence-class borders.

  • threshold_linewidth (float) – Styling for the emphasized confidence-class borders.

  • threshold_linestyle (str) – Styling for the emphasized confidence-class borders.

  • station_labels (bool) – Annotate station names. station_label_step controls thinning.

  • ci_hi (float) – Safe and recoverable/review confidence thresholds.

  • ci_lo (float) – Safe and recoverable/review confidence thresholds.

  • boundary_levels (array-like or None) – Confidence-class borders used by segmented colors, emphasized isolines, and colorbar ticks. None uses (0.50, ci_lo, ci_hi, 1.00). For example, pass (0.50, 0.85, 0.90, 1.00) for boundary-only contours at those values.

  • cmap (str) – Matplotlib appearance controls.

  • marker_size (float) – Matplotlib appearance controls.

  • figsize (tuple[float, float]) – Matplotlib appearance controls.

  • recursive (bool) – Passed through the standard EMTools site-loading API.

  • on_dup (str) – Passed through the standard EMTools site-loading API.

  • strict (bool) – Passed through the standard EMTools site-loading API.

  • verbose (int) – Passed through the standard EMTools site-loading API.

  • ax (matplotlib.axes.Axes or None) – Existing axes, or None to create one.

  • station_label_step (int | None)

Returns:

The map axes. Its _pycsamt_coordinate_system attribute records the coordinate system selected by "auto".

Return type:

matplotlib.axes.Axes

pycsamt.emtools.qc.plot_confidence_grid_map(sites, *, method='composite', coordinate_system='auto', line_labels=None, grid_shape=(180, 180), interpolation='linear', max_triangle_edge=None, ci_hi=0.95, ci_lo=0.85, levels=None, cmap='RdYlGn', segmented_colors=True, show_grid_edges=False, grid_edgecolor='white', grid_linewidth=0.15, show_threshold_contours=True, threshold_colors=('#9a6700', '#1b5e20'), threshold_linewidths=(1.4, 1.6), threshold_linestyles=('--', '-'), contour_labels=True, show_stations=True, marker_size=18.0, connect=True, line_names=True, nodata_color='white', map_aspect='auto', figsize=(8.2, 5.8), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Render confidence on a regular map grid inside the survey hull.

Unlike plot_confidence_map() contour mode, this function displays the actual regular cells used by raster and Surfer-style workflows. Cells outside the triangulated survey footprint remain blank. grid_shape is (nx, ny) and interpolation may be 'linear' or 'cubic'.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.plot_confidence_method_comparison(sites, *, coordinate_system='auto', line_labels=None, connect=True, ci_hi=0.95, ci_lo=0.85, confidence_cmap='RdYlGn', difference_cmap='RdBu', marker_size=42.0, station_labels=False, station_label_step=None, line_names=True, show_statistics=True, difference_limit=None, map_aspect='auto', figsize=(11.2, 4.5), axes=None, recursive=True, on_dup='replace', strict=False, verbose=0)[source]

Compare presence and composite confidence on matched station maps.

Panels show presence confidence, composite confidence, and composite - presence. The confidence panels share a fixed 0–1 color scale; the difference panel uses a symmetric zero-centred scale so score gains and penalties remain visually comparable.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_confidence_profile(sites, *, method='presence', ci_hi=0.95, ci_lo=0.85, shade_recoverable=True, shade_mode='score', annotate_low=True, annotate_low_step=None, station_labels=True, station_label_step=None, show_errorbars=True, smart_ylim=True, ylim=None, weights=None, spacing_m=200.0, force_spacing=False, figsize=(9.0, 4.0), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Profile confidence-ratio (CR) scatter plot along the survey line.

Reproduces the Fig. 3 style from Kouadio et al. (2024): one dot per station coloured green (CR >= ci_hi), pink (ci_lo <= CR < ci_hi), or red (CR < ci_lo), with dashed threshold lines.

With method="presence", CR is the fraction of frequencies with a valid finite Z tensor. With method="composite", CR combines coverage, tensor uncertainty, off-diagonal consistency, diagonal leakage, phase smoothness, and neighbor coherence.

Parameters:
  • sites (path, EDI-like, Sites, or iterable) – Input sites.

  • ci_hi (float) – Upper CR threshold (default 0.95, “safe”, green).

  • ci_lo (float) – Lower CR threshold (default 0.85, “recoverable”, pink).

  • shade_recoverable (bool) – If True, draw an interval cue for stations below ci_hi.

  • shade_mode ({"score", "full", "none"}) – "score" draws compact vertical intervals tied to each station point. "full" preserves the older full-height station shading. "none" disables station interval shading.

  • annotate_low (bool) – If True, draw a rotated station-name label above each point below ci_lo. Set False to turn these off entirely – e.g. when station_labels (the top-axis station ticks) already identifies every station and the per-point labels would just duplicate it.

  • annotate_low_step (int or None) – Gap between labeled low-confidence points, analogous to station_label_step but applied only to the (typically much smaller) subset of points below ci_lo. None auto-thins once there are more than 18 low points, the same threshold used for the top axis, so a survey where most stations are flagged doesn’t end up with every single one labeled. 1 forces every low point to be labeled regardless of count.

  • station_label_step (int or None) – Gap between visible station labels on the top axis. None chooses a readable spacing automatically while keeping all station tick marks.

  • show_errorbars (bool) – If True, draw the station-level confidence uncertainty returned by station_confidence_table().

  • smart_ylim (bool) – If True, zoom the lower y-limit when every station confidence is above ci_lo so small departures from the safe threshold remain visible.

  • ylim (tuple of float or None) – Explicit y-axis limits. Overrides smart_ylim when provided.

  • spacing_m (float) – The x-axis is real inter-station distance projected along the survey line (from EDI east/north, or lat/lon as a fallback) whenever at least two stations carry usable coordinates. spacing_m is only used as a uniform fallback for stations without coordinates, or for the whole line when none have any.

  • force_spacing (bool) – If True, skip coordinate lookup entirely and lay every station out at uniform spacing_m steps – e.g. when the available coordinates are known to be unreliable and a user-supplied spacing should be trusted instead.

  • figsize (tuple) – Figure size when a new figure is created.

  • recursive (bool) – Passed to ensure_sites().

  • on_dup (str) – Passed to ensure_sites().

  • strict (bool) – Passed to ensure_sites().

  • verbose (int) – Passed to ensure_sites().

  • ax (matplotlib.axes.Axes or None) – Axes to draw on; created if None.

  • method (str)

  • station_labels (bool)

  • weights (dict[str, float] | None)

Returns:

ax

Return type:

matplotlib.axes.Axes

pycsamt.emtools.qc.plot_confidence_rank(sites, *, method='composite', metric='confidence', line_labels=None, order='worst', max_stations=None, ci_hi=0.95, ci_lo=0.85, cmap='RdYlGn', connect=True, annotate_stations='auto', station_label_step=None, show_values=False, show_line_panel=True, line_statistic='median', show_iqr=True, marker_size=36.0, figsize=(11.5, 4.8), recursive=True, on_dup='replace', strict=False, verbose=0, axes=None)[source]

Rank station scores and survey-line performance.

Station ranks use the exact selected metric. The line panel ranks either the median (default, robust to isolated failures) or mean, and optionally shows the interquartile range. Rank 1 follows order: the lowest score for 'worst' and the highest score for 'best'.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_confidence_risk_map(sites, *, method='composite', coordinate_system='auto', mode='contour', line_labels=None, connect=True, ci_hi=0.95, ci_lo=0.85, risk_levels=None, cmap='YlOrRd', segmented_colors=True, show_threshold_contours=True, threshold_colors=('#d98e00', '#a50f15'), threshold_linewidths=(1.4, 1.8), threshold_linestyles=('--', '-'), contour_labels=True, show_stations=True, marker_size=38.0, station_labels=False, station_label_step=None, line_names=True, show_summary=True, max_triangle_edge=None, map_aspect='auto', figsize=(8.2, 5.8), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Plot spatial confidence risk, defined as 1 - confidence.

The confidence limits map directly to operational risk classes: risk <= 1-ci_hi is low, 1-ci_hi < risk <= 1-ci_lo is moderate, and risk > 1-ci_lo is high. Contour mode is intended for surveys containing at least three non-collinear stations; scatter mode remains scientifically honest for a single profile.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.plot_frequency_confidence_psection(sites, *, method='composite', ci_hi=0.95, ci_lo=0.85, metric='confidence', cmap='RdYlGn', section='dynamic', figsize=None, station_label_step=None, station_preset='pseudosection', station_style=None, spacing_m=200.0, recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Plot frequency confidence as a station-period pseudo-section.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.plot_station_confidence_dashboard(sites, *, station=None, method='composite', ci_hi=0.95, ci_lo=0.85, axes=None, figsize=(10.5, 6.0), spacing_m=200.0, recursive=True, on_dup='replace', strict=False, verbose=0)[source]

Plot a 2-by-3 confidence dashboard for one station.

The dashboard separates the final confidence score from the diagnostic components used to build it, avoiding the visual crowding of a single overlay axis.

Parameters:
Return type:

Figure

pycsamt.emtools.qc.plot_station_confidence_spectrum(sites, *, station=None, method='composite', ci_hi=0.95, ci_lo=0.85, figsize=(7.0, 4.0), spacing_m=200.0, recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]

Plot confidence components versus period for one station.

Parameters:
Return type:

Axes

pycsamt.emtools.qc.qc_flags(sites, *, min_frac_ok=0.6, min_snr_med=2.0, max_skew_med=6.0, recursive=True, on_dup='replace', strict=False, verbose=0)[source]
Parameters:
Return type:

DataFrame

pycsamt.emtools.qc.station_confidence_table(sites, *, method='composite', weights=None, relerr_threshold=0.2, offdiag_tolerance_log10=0.35, diagonal_leakage_max=0.35, phase_jump_tolerance_deg=90.0, spatial_tolerance_log10=0.6, spacing_m=200.0, force_spacing=False, recursive=True, on_dup='replace', strict=False, verbose=0, api=None)[source]

Return station-level confidence scores for EM transfer functions.

method="presence" reproduces the legacy criterion based only on finite tensor rows. method="composite" combines several station trust indicators: finite data coverage, tensor uncertainty when error tensors exist, off-diagonal consistency, diagonal leakage, phase smoothness, and spatial coherence with neighboring stations.

distance_m in the returned table is the real inter-station distance projected along the survey line, derived from EDI coordinates (east/north, or lat/lon as a fallback) whenever at least two stations carry usable coordinates. spacing_m is only used as a uniform per-station fallback for stations without coordinates, or for the whole line when no station has any. Pass force_spacing=True to bypass coordinate lookup entirely and lay every station out at uniform spacing_m steps – e.g. when the available coordinates are known to be unreliable.

Parameters:
Return type:

Any