pycsamt.agents.phase_analysis#

pycsamt.agents.phase_analysis#

PhaseAnalysisAgent — Phase tensor, strike, and dimensionality analysis.

Wraps:

All figures are governed by PYCSAMT_SECTION and PYCSAMT_STYLE.

Classes

PhaseAnalysisAgent(*[, api_key, model, ...])

Run a full phase tensor, strike, and dimensionality survey analysis.

class pycsamt.agents.phase_analysis.PhaseAnalysisAgent(*, api_key=None, model=None, llm_provider='claude', skew_th=5.0, ellipt_th=0.1, band=None)[source]#

Bases: BaseAgent

Run a full phase tensor, strike, and dimensionality survey analysis.

Parameters:
  • api_key (str)

  • model (str)

  • llm_provider (str)

  • skew_th (float) – Skewness |β| threshold for 3-D classification (°).

  • ellipt_th (float) – Ellipticity λ threshold for 2-D classification.

  • band ((T_min, T_max) or None) – Period band for strike estimation.

  • keys (Output data)

  • ----------

  • path (sites /)

  • period_range ([T_min, T_max], optional)

  • output_dir (str, optional)

  • run_mohr (bool, optional — also produce Mohr circles (default False))

  • run_fingerprint (bool, optional — produce fingerprint grid (default True))

  • keys

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

  • (station (pt_table pandas DataFrame — full PT metrics per)

  • period)

  • (°) (strike_consensus float — consensus strike angle)

  • stations (strike_iqr float — IQR of strike across all)

  • per-(station (dim_table pandas DataFrame —)

  • classification (period))

  • n_1d

  • n_2d

  • class (n_3d int — count of observations per)

  • objects (figures dict — matplotlib Figure)

  • paths (figure_paths dict — saved file)

Examples

>>> agent  = PhaseAnalysisAgent()
>>> result = agent.execute({"path": "/data/L22PLT",
...                         "output_dir": "/out/pt"})
>>> result["strike_consensus"]
42.5
SYSTEM_PROMPT: str = 'You are an expert in MT phase tensor analysis and geological interpretation.\nGiven a survey phase tensor summary, write 4–5 sentences that:\n1. State the dominant dimensionality (1-D, 2-D, or 3-D) with evidence.\n2. Report the consensus geoelectric strike direction and its reliability.\n3. Identify periods / depth ranges where 3-D structure becomes significant.\n4. Note any anomalous stations (high skew, low ellipticity).\n5. Recommend whether to rotate data to strike before inversion.\nReply in plain English. No bullet points or markdown.\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