gaaem_forward

GA-AEM (gatdaem1d) 1D TDEM forward modelling backend.

GA-AEM (gatdaem1d) 1D TDEM forward modelling backend.

Public API: forward_gaaem / prior_data_gaaem (mirrored by integrate.anemone_forward for the anemone backend). gatdaem1d is imported lazily so importing integrate never requires it.

integrate.gaaem_forward.forward_gaaem(C=array([], dtype=float64), thickness=array([], dtype=float64), stmfiles=None, tx_height=array([], dtype=float64), txrx_dx=-13, txrx_dy=0, txrx_dz=0.1, GEX={}, file_gex=None, showtime=False, **kwargs)

Perform forward modeling using the GA-AEM method.

Parameters:
  • C (numpy.ndarray, optional) – Conductivity array. Default is np.array(()).

  • thickness (numpy.ndarray, optional) – Thickness array. Default is np.array(()).

  • stmfiles (list, optional) – List of STM files. Default is None.

  • tx_height (numpy.ndarray, optional) – Transmitter height array. Default is np.array(()).

  • txrx_dx (float, optional) – X-distance between transmitter and receiver. Default is -13.

  • txrx_dy (float, optional) – Y-distance between transmitter and receiver. Default is 0.

  • txrx_dz (float, optional) – Z-distance between transmitter and receiver, positive UP (GA-AEM convention). Default is 0.1. Ignored when a GEX is given: the offsets are then taken from the GEX (see gex_txrx_offset()).

  • GEX (dict, optional) – GEX dictionary. Default is {}.

  • file_gex (str, optional) – Path to GEX file. Default is None.

  • showtime (bool, optional) – Flag to display execution time. Default is False.

  • showInfo (int, optional) – Level of verbosity for output.

  • doCompress (bool, optional) – Flag to enable layer compression. Default is True.

Returns:

Forward modeled data array.

Return type:

numpy.ndarray

integrate.gaaem_forward.forward_gaaem_chunk(C_chunk, tx_height_chunk, thickness, stmfiles, file_gex, Nhank, Nfreq, **kwargs)

Perform forward modeling using the GA-AEM method on a chunk of data.

Parameters:
  • C_chunk (numpy.ndarray) – The chunk of data to be processed.

  • tx_height_chunk (numpy.ndarray) – The transmitter heights for this chunk.

  • thickness (float) – The thickness of the model.

  • stmfiles (list) – A list of STM files.

  • file_gex (str) – The path to the GEX file.

  • Nhank (int) – The number of Hankel functions.

  • Nfreq (int) – The number of frequencies.

  • **kwargs (dict) – Additional keyword arguments.

Returns:

The result of the forward modeling.

Return type:

numpy.ndarray

integrate.gaaem_forward.get_process_handle_count()

Return the number of handles used by the current process (Windows only).

Returns:

The number of handles used by the current process.

Return type:

int

integrate.gaaem_forward.gex_txrx_offset(GEX)

Tx->Rx offset (dx, dy, dz) from a GEX dict in GA-AEM’s convention.

The GEX frame has z positive DOWN (SkyTEM RxCoilPosition1 z = -2: the receiver is 2 m above the frame); GA-AEM’s txrx_dz is positive UP (RX_height = TX_height + txrx_dz), so the GEX z offset is negated. Ground systems (tTEM) give the Rx position relative to TxCoilPosition1, airborne systems (SkyTEM) relative to the Tx frame. Validated against AarhusInv on SkyTEM (see ISSUE_rx_z_sign.md).

integrate.gaaem_forward.prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorCopy=True, im=1, id=1, im_height=0, Nhank=280, Nfreq=12, is_log=False, parallel=True, force_replace=False, f_prior_data_h5='', randomize=True, **kwargs)

Generate prior data for the GA-AEM method.

Parameters:
  • f_prior_h5 (str) – Path to the prior data file in HDF5 format.

  • file_gex (str, optional) – Path to the file containing geophysical exploration data (.gex format).

  • stmfiles (list of str, optional) – List of STM files for system configuration. If not provided, will be generated from file_gex.

  • N (int, optional) – Number of soundings to consider. Default is 0 (use all).

  • doMakePriorCopy (bool, optional) – Flag indicating whether to make a copy of the prior file. Default is True.

  • f_prior_data_h5 (str, optional) – Output path for the prior-data copy (only used when doMakePriorCopy=True). If empty (default), a name is generated automatically as '<prior-stem>_<gex/stm-basename>[_N<N>]_Nh<Nhank>_Nf<Nfreq>.h5'. The path actually used is always the return value.

  • randomize (bool, optional) – When doMakePriorCopy=True and N < N_in: draw N random realizations (True, default) or copy the first N sequentially (False). Only used when a copy is made.

  • im (int, optional) – Index of the model. Default is 1.

  • id (int, optional) – Index of the data. Default is 1.

  • im_height (int, optional) – Index of the model for height. Default is 0.

  • Nhank (int, optional) – Number of Hankel transform quadrature points. Default is 280.

  • Nfreq (int, optional) – Number of frequencies. Default is 12.

  • is_log (bool, optional) – Flag to apply logarithmic scaling to data. Default is False.

  • parallel (bool, optional) – Flag indicating whether multiprocessing is used. Default is True. When True, forward modeling is parallelized across available CPUs.

  • **kwargs (dict) –

    Additional keyword arguments:

    Ncpuint, optional

    Number of CPUs to use for parallel processing. Default is 0, which uses all available CPUs. Only used when parallel=True.

    force_replacebool, optional

    If True, delete an existing /D{id} dataset before writing. If False (default), print a warning and return early if the dataset already exists.

    showInfoint, optional

    Level of verbosity for output (0=silent, 1=normal, 2=verbose).

Returns:

Filename of the HDF5 file containing the updated prior data.

Return type:

str

Notes

This function computes forward-modeled electromagnetic responses for prior model realizations using the GA-AEM forward modeling code. The forward modeling can be parallelized for faster computation on multi-core systems.

Examples

>>> # Basic usage with all CPUs
>>> f_prior_data = prior_data_gaaem(f_prior_h5, file_gex)
>>> # Use specific number of CPUs
>>> f_prior_data = prior_data_gaaem(f_prior_h5, file_gex, Ncpu=4)
>>> # Sequential processing (no parallelization)
>>> f_prior_data = prior_data_gaaem(f_prior_h5, file_gex, parallel=False)