pycsamt.agents.joint_agent#

pycsamt.agents.joint_agent#

JointInversionAgent — Multi-modal joint MT inversion via DRCNN.

Wraps JointInverter:

  • Fuses a primary MT dataset with a secondary modality (TEM, CSAMT, gravity proxy, or a second MT profile at a different frequency range).

  • Both modalities are observed at the same stations. When no secondary dataset is supplied the agent synthesises a complementary low-frequency response from the same LayeredModel to demonstrate the joint-inversion pipeline.

  • Produces a joint resistivity section (station × depth) that benefits from the complementary depth sensitivities of the two modalities.

Architecture#

The DRCNNNet (Dense-Residual CNN) is used as the shared feature extractor; each modality has its own encoding branch before the fused prediction head.

Requires PyTorch or TensorFlow.

Classes

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

Multi-modal MT joint inversion using DRCNN.

class pycsamt.agents.joint_agent.JointInversionAgent(*, api_key=None, model=None, llm_provider='claude', modalities=None, n_layers=5, n_freqs_primary=40, n_freqs_secondary=20, n_train_samples=2000, epochs=30, growth_rate=32)[source]#

Bases: BaseAgent

Multi-modal MT joint inversion using DRCNN.

Parameters:
  • api_key (str)

  • model (str)

  • llm_provider (str)

  • modalities (list[str]) – Names of the two modalities, e.g. ["mt", "tem"]. The first entry is the primary modality (loaded from sites/path); the second is loaded from secondary_path or synthesised when absent.

  • n_layers (int) – Number of depth layers in the output model (default 5).

  • n_freqs_primary (int) – Frequencies for the primary MT response features (default 40).

  • n_freqs_secondary (int) – Frequencies for the secondary modality features (default 20).

  • n_train_samples (int) – Synthetic training samples shared across both modalities (default 2000).

  • epochs (int) – Training epochs (default 30).

  • growth_rate (int) – DRCNN dense-block growth rate (default 32).

  • keys (Output data)

  • ----------

  • path (sites /)

  • secondary_path (str, optional — secondary modality EDI/TEM path)

  • output_dir (str, optional)

  • period_range ([T_min, T_max], optional)

  • keys

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

  • JointInverter (inverter)

  • {station (rms_per_station dict)

  • {station

  • float (rms_global)

  • list[str] (modalities)

  • dict (figure_paths)

  • dict

Examples

>>> agent = JointInversionAgent(modalities=["mt", "tem"], n_layers=5, epochs=20)
>>> result = agent.execute({"path": "/data/L22PLT"})
>>> result["rms_global"]
0.31
SYSTEM_PROMPT: str = 'You are an expert in multi-modal geophysical joint inversion using deep learning.\nGiven a joint MT inversion result, write 4-5 sentences that:\n1. Describe the two modalities fused and their complementary depth sensitivities.\n2. Assess the joint prediction quality (RMS, depth range, station count).\n3. Compare the joint result to a single-modality approach where possible.\n4. Identify where the secondary modality most improved the primary inversion.\n5. Recommend validation (borehole, gravity, seismic) and next modelling steps.\nReply in plain scientific 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