pycsamt.forward.config3d#

Configuration for pyCSAMT quasi-3D MT forward modelling.

ForwardConfig3D follows the same source-of-truth file pattern as ForwardConfig and ForwardConfig2D.

Quick start#

from pycsamt.forward.config3d import ForwardConfig3D

ForwardConfig3D.write_template("my_3d.yml")   # annotated defaults

# edit my_3d.yml …

cfg = ForwardConfig3D.from_file("my_3d.yml")
cfg.validate()

grid = cfg.to_grid()
from pycsamt.forward.em3d import MT3DForward
resp = MT3DForward(cfg.freq_grid(), grid, verbose=cfg.verbose).run()

Classes

ForwardConfig3D([freq_min, freq_max, ...])

Collect settings for a quasi-3D MT forward modelling run.

class pycsamt.forward.config3d.ForwardConfig3D(freq_min=0.01, freq_max=1000.0, n_freqs=15, method='quasi3d', nx=20, ny=20, nz=15, x_max=8000.0, y_max=8000.0, z_max=4000.0, n_pad=8, pad_factor=1.3, bg_rho=100.0, model_type='halfspace', anomaly_rho=5.0, anomaly_x_lo=2000.0, anomaly_x_hi=6000.0, anomaly_y_lo=2000.0, anomaly_y_hi=6000.0, anomaly_z_lo=300.0, anomaly_z_hi=1500.0, n_layers=4, lateral_variation=True, corr_length=2000.0, nx_stations=5, ny_stations=5, verbose=True)[source]#

Bases: object

Collect settings for a quasi-3D MT forward modelling run.

Parameters:
  • freq_min (float) – Frequency range [Hz].

  • freq_max (float) – Frequency range [Hz].

  • n_freqs (int)

  • method (str) – Forward method (‘quasi3d’).

  • nx (int) – Core cell counts.

  • ny (int) – Core cell counts.

  • nz (int) – Core cell counts.

  • x_max (float) – Core extents [m].

  • y_max (float) – Core extents [m].

  • z_max (float) – Core extents [m].

  • n_pad (int)

  • pad_factor (float)

  • bg_rho (float)

  • model_type ({'halfspace', 'block_anomaly', 'random_layered'})

  • anomaly_rho (float)

  • anomaly_x_lo (float)

  • anomaly_x_hi (float)

  • anomaly_y_lo (float)

  • anomaly_y_hi (float)

  • anomaly_z_lo (float)

  • anomaly_z_hi (float)

  • n_layers (int)

  • lateral_variation (bool)

  • corr_length (float)

  • nx_stations (int)

  • ny_stations (int)

  • verbose (bool)

Examples

Default halfspace:

>>> cfg = ForwardConfig3D()
>>> cfg.validate()
>>> grid = cfg.to_grid()

Block anomaly:

>>> cfg = ForwardConfig3D(
...     model_type='block_anomaly',
...     anomaly_rho=5.0,
...     anomaly_x_lo=2000., anomaly_x_hi=6000.,
...     anomaly_y_lo=2000., anomaly_y_hi=6000.,
...     anomaly_z_lo=300.,  anomaly_z_hi=1500.,
... )
freq_min: float = 0.01#
freq_max: float = 1000.0#
n_freqs: int = 15#
method: str = 'quasi3d'#
nx: int = 20#
ny: int = 20#
nz: int = 15#
x_max: float = 8000.0#
y_max: float = 8000.0#
z_max: float = 4000.0#
n_pad: int = 8#
pad_factor: float = 1.3#
bg_rho: float = 100.0#
model_type: str = 'halfspace'#
anomaly_rho: float = 5.0#
anomaly_x_lo: float = 2000.0#
anomaly_x_hi: float = 6000.0#
anomaly_y_lo: float = 2000.0#
anomaly_y_hi: float = 6000.0#
anomaly_z_lo: float = 300.0#
anomaly_z_hi: float = 1500.0#
n_layers: int = 4#
lateral_variation: bool = True#
corr_length: float = 2000.0#
nx_stations: int = 5#
ny_stations: int = 5#
verbose: bool = True#
validate()[source]#

Raise ValueError on invalid parameters.

Return type:

None

freq_grid()[source]#

Return the logarithmically spaced frequency array [Hz].

Return type:

ndarray

to_grid(seed=None)[source]#

Construct a Grid3D from this config.

Parameters:

seed (int or None) – Random seed (used only for model_type='random_layered').

Return type:

Grid3D

to_solver_kwargs()[source]#

Return kwargs for MT3DForward.

Return type:

dict[str, Any]

to_template(path='forward_config_3d.py', *, fmt=None)[source]#

Write an annotated source-of-truth file.

Parameters:
Return type:

Path

classmethod write_template(path='forward_config_3d.py', *, fmt=None)[source]#

Generate a documented source-of-truth configuration file.

Parameters:
  • path (path-like)

  • fmt ({"py", "json", "yml", "yaml"}, optional)

Return type:

pathlib.Path

classmethod from_file(path, *, strict=True)[source]#

Load from a source-of-truth file.

Parameters:
  • path (path-like)

  • strict (bool)

Return type:

ForwardConfig3D

classmethod read(path, *, strict=True)#

Load from a source-of-truth file.

Parameters:
  • path (path-like)

  • strict (bool)

Return type:

ForwardConfig3D

summary()[source]#
Return type:

str