2.6.3.2. pycsamt.emtf.converters.spectra#

FCU-compatible recovery of EMTFs from historical EDI SPECTRA.

The SEG SPECTRA section stores a Hermitian cross-power matrix at each frequency. EMTF FCU uses those matrices to recover the transfer functions and the two covariance factors required for statistically correct rotation. This module implements the same single-station and remote-reference equations while keeping parsing in pycsamt.seg.spectra and rotation in pycsamt.emtf.orientation.

Functions

recover_spectra_transfer_functions(spectra, *)

Recover Z/T and full covariance from an EDI SPECTRA container.

resolve_spectra_channels(spectra)

Resolve FCU local/remote channel roles from SPECTRA channel order.

spectra_to_emtf(source, *[, spectra, ...])

Convert EDI SPECTRA to the format-neutral EMTF scientific model.

Classes

SpectraChannelMap(hx, hy, ex, ey[, hz, rx, ...])

Resolved local, remote, and output channel indices.

SpectraRecoveryResult(frequency, periods, ...)

Numerical result of one FCU-compatible SPECTRA recovery.

Exceptions

SpectraCovarianceWarning

Warning emitted for recoverable SPECTRA covariance issues.

SpectraRecoveryError

Raised when an exact EDI SPECTRA recovery cannot be performed.

exception pycsamt.emtf.converters.spectra.SpectraCovarianceWarning[source]

Bases: UserWarning

Warning emitted for recoverable SPECTRA covariance issues.

exception pycsamt.emtf.converters.spectra.SpectraRecoveryError[source]

Bases: EdIDataError

Raised when an exact EDI SPECTRA recovery cannot be performed.

class pycsamt.emtf.converters.spectra.SpectraChannelMap(hx, hy, ex, ey, hz=None, rx=None, ry=None, channel_types=())[source]

Bases: object

Resolved local, remote, and output channel indices.

Parameters:
hx: int
hy: int
ex: int
ey: int
hz: int | None = None
rx: int | None = None
ry: int | None = None
channel_types: tuple[str, ...] = ()
property local_h: tuple[int, int][source]
property remote_h: tuple[int, int][source]
property outputs: tuple[int, ...][source]
property reference_type: str[source]
class pycsamt.emtf.converters.spectra.SpectraRecoveryResult(frequency, periods, transfer_functions, channel_map, used_indices, skipped_indices, avgt, rotspec, combined_residual_covariance=None, combined_output_channels=())[source]

Bases: object

Numerical result of one FCU-compatible SPECTRA recovery.

Parameters:
frequency: ndarray
periods: ndarray
transfer_functions: dict[str, TransferFunction]
channel_map: SpectraChannelMap
used_indices: ndarray
skipped_indices: ndarray
avgt: ndarray
rotspec: ndarray
combined_residual_covariance: ndarray | None = None
combined_output_channels: tuple[str, ...] = ()
property impedance: TransferFunction[source]
property tipper: TransferFunction | None[source]
pycsamt.emtf.converters.spectra.resolve_spectra_channels(spectra)[source]

Resolve FCU local/remote channel roles from SPECTRA channel order.

Historical files commonly encode remote H channels as a second HX/HY pair. Explicit RX/RY or RHX/RHY labels are also accepted. When no remote pair is present, the local HX/HY pair is reused exactly as FCU does for a single-station analysis.

Parameters:

spectra (Any)

Return type:

SpectraChannelMap

pycsamt.emtf.converters.spectra.recover_spectra_transfer_functions(spectra, *, nfreq_policy='raise', missing_policy='raise', avgt_policy='raise')[source]

Recover Z/T and full covariance from an EDI SPECTRA container.

The implementation mirrors EMTF FCU’s read_edi_spectra equations. It intentionally does not rotate the spectra or the recovered TFs; Phase 7’s EMTF rotation engine performs any requested coordinate transformation.

Parameters:
  • spectra (Any)

  • nfreq_policy (str)

  • missing_policy (str)

  • avgt_policy (str)

Return type:

SpectraRecoveryResult

pycsamt.emtf.converters.spectra.spectra_to_emtf(source, *, spectra=None, nfreq_policy='raise', missing_policy='raise', avgt_policy='raise', target_angle=None)[source]

Convert EDI SPECTRA to the format-neutral EMTF scientific model.

If target_angle is supplied, the recovered full-covariance TFs are passed to the Phase-7 rotation engine; no spectra-specific rotation code is used here.

Parameters:
  • source (Any)

  • spectra (Any | None)

  • nfreq_policy (str)

  • missing_policy (str)

  • avgt_policy (str)

  • target_angle (float | None)

Return type:

EMTF