pycsamt.agents.freq_decimation#

pycsamt.agents.freq_decimation#

FrequencyDecimationAgent — Intelligent period selection for inversion.

Selects an optimal subset of periods from the observed data by:

  1. Applying the SNR/QC flags from DataQCAgent to mask dead-band and low-quality frequencies.

  2. Choosing log-uniformly spaced survivors to give even depth coverage.

  3. Enforcing user-defined period bounds and a minimum SNR threshold.

The output is a dictionary of selected periods per station, ready to be consumed by InversionPrepAgent, Occam2DAgent, or ModEmAgent.

Classes

FrequencyDecimationAgent(*[, api_key, ...])

Select optimal periods from MT data for inversion.

class pycsamt.agents.freq_decimation.FrequencyDecimationAgent(*, api_key=None, model=None, llm_provider='claude', n_per_decade=6, snr_threshold=3.0, period_range=None, component='xy')[source]#

Bases: BaseAgent

Select optimal periods from MT data for inversion.

Parameters:
  • api_key (str)

  • model (str)

  • llm_provider (str)

  • n_per_decade (int, optional) – Number of periods to keep per decade of period range (default 6).

  • snr_threshold (float, optional) – Minimum SNR value to retain a frequency (default 3.0). Frequencies below this are excluded as dead-band.

  • period_range ([T_min, T_max], optional) – Hard period bounds in seconds. None uses the full data range.

  • component ({'xy', 'yx'}) – Component used for SNR proxy (default 'xy').

  • keys (Output data)

  • ----------

  • path (sites /)

  • qc_result (AgentResult or dict, optional — output from DataQCAgent) – (provides per-frequency SNR scores; if absent a proxy is computed)

  • n_per_decade

  • snr_threshold

  • period_range

  • output_dir (str, optional)

  • keys

  • ----------------

  • {station (dead_band_mask dict)

  • (station (n_original int — total available)

  • cells (n_selected int — retained)

  • cells

  • float (selection_ratio)

  • {station

  • dict (figure_paths)

  • dict

SYSTEM_PROMPT: str = 'You are an expert in MT data selection and frequency decimation for inversion.\nGiven a period decimation result, write 3-4 sentences that:\n1. State how many periods were selected versus available, and the selection ratio.\n2. Identify which frequency bands were excluded and the likely reason (dead band, low SNR).\n3. Confirm whether the selected periods cover the target depth range adequately.\n4. Recommend any additional frequencies that should be included or excluded.\nReply in plain English.\n'#

Override in subclasses to give the LLM its domain expertise.

execute(input_data)[source]#

Run this agent on input_data and return an AgentResult.

Subclasses must implement this method. The contract:

  • Reset self._last_cost = 0.0 at the top.

  • Record wall-clock time with t0 = time.time().

  • Return AgentResult(elapsed_seconds=time.time()-t0, cost_estimate_usd=self._last_cost, ...).

Parameters:

input_data (dict[str, Any])

Return type:

AgentResult