pycsamt.agents.inversion_eval#

pycsamt.agents.inversion_eval#

InversionEvaluationAgent — Evaluate inversion result quality.

Computes: * Per-station RMS misfit between observed and model-predicted responses. * Residual phase tensor section (data PT minus model PT). * Misfit pseudosection (normalised ρa residuals).

Uses plot_station_response() for per-station response overlay and the phase tensor pipeline for residual PT.

Classes

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

Evaluate inversion quality: RMS, residual PT, misfit section.

class pycsamt.agents.inversion_eval.InversionEvaluationAgent(*, api_key=None, model=None, llm_provider='claude')[source]#

Bases: BaseAgent

Evaluate inversion quality: RMS, residual PT, misfit section.

Input keys#

sites_obs / path_obs : Sites or str — observed data sites_mod / path_mod : Sites or str — model-predicted responses output_dir : str, optional component : str — default "xy"

Output data keys#

rms_per_station dict {station: rms} rms_global float residual_pt_table pandas DataFrame figures dict figure_paths dict

SYSTEM_PROMPT: str = 'You are an expert MT inversion quality assessor.\nGiven a misfit summary, write 3–4 sentences that:\n1. State whether the inversion converged acceptably (RMS 0.8–1.5 = good).\n2. Identify stations or period bands with elevated misfit.\n3. Diagnose likely causes (3-D effects, noise, model inadequacy).\n4. Recommend whether to re-run with adjusted regularisation.\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

Parameters:
  • api_key (str | None)

  • model (str | None)

  • llm_provider (str)