pygmi.maggrv.dataprep#

A set of Magnetic Data routines.

Classes#

ASig

Calculate analytic signal via a GUI.

Continuation

GUI to perform upward and downward continuation on potential field data.

Tilt1

Class used to gather information via a GUI, for function tilt1.

RTP

Perform Reduction to the Pole on Magnetic data.

Functions#

asig(data1[, showlog, piter])

Tilt angle calculations.

fftcont(data, h[, showlog, piter])

Continuation.

taylorcont(data, h[, showlog, piter])

Taylor Continuation.

tilt1(data1, azi, s[, k, showlog, piter])

Tilt angle calculations.

nextpow2(n)

Next power of 2.

rtp(data, I_deg, D_deg[, Ia, showlog, piter])

Reduction to the pole.

mlv_filter(image[, win_size])

Apply a 2D Mean of Least Variance (MLV) Edge Preserving Filter.

Module Contents#

class pygmi.maggrv.dataprep.ASig(parent=None)#

Bases: pygmi.misc.BasicModule

Calculate analytic signal via a GUI.

Parameters:

parent – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

pygmi.maggrv.dataprep.asig(data1, showlog=print, piter=iter)#

Tilt angle calculations.

Based on work by Gordon Cooper (School of Geosciences, University of the

Witwatersrand, Johannesburg, South Africa)

Parameters:
  • data1 (pygmi.raster.datatypes.Data) – PyGMI data with matrix of double to be filtered.

  • showlog (collections.abc.Callable[..., None]) – Show information using a function. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterator. The default is iter.

Returns:

Analytic signal

Return type:

MaskedArray

class pygmi.maggrv.dataprep.Continuation(parent=None)#

Bases: pygmi.misc.BasicModule

GUI to perform upward and downward continuation on potential field data.

Parameters:

parent – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

acceptall()#

Accept option.

Updates self.outdata, which is used as input to other modules.

pygmi.maggrv.dataprep.fftcont(data, h, showlog=print, piter=iter)#

Continuation.

Parameters:
  • data (pygmi.raster.datatypes.Data) – PyGMI raster data.

  • h (float) – Height.

  • showlog (collections.abc.Callable[..., None]) – Function for printing text. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterable. The default is iter.

Returns:

PyGMI raster data.

Return type:

Data

pygmi.maggrv.dataprep.taylorcont(data, h, showlog=print, piter=iter)#

Taylor Continuation.

Parameters:
  • data (pygmi.raster.datatypes.Data) – PyGMI raster data.

  • h (float) – Height.

  • showlog (collections.abc.Callable[..., None]) – Function for printing text. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterable. The default is iter.

Returns:

PyGMI raster data.

Return type:

Data

class pygmi.maggrv.dataprep.Tilt1(parent=None)#

Bases: pygmi.misc.BasicModule

Class used to gather information via a GUI, for function tilt1.

Parameters:

parent – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

pygmi.maggrv.dataprep.tilt1(data1, azi, s, k=2, showlog=print, piter=iter)#

Tilt angle calculations.

Based on work by Gordon Cooper (School of Geosciences, University of the

Witwatersrand, Johannesburg, South Africa)

Parameters:
  • data1 (pygmi.raster.datatypes.Data) – data with matrix of double to be filtered

  • azi (float) – directional filter azimuth in degrees from East

  • s (int) – size of smoothing matrix to use - must be odd input 0 for no smoothing

  • k (int) – Factor for EHGA filter. Must be > 0. Optional.

  • showlog (collections.abc.Callable[..., None]) – Show information using a function. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterator. The default is iter.

Returns:

  • t1 (MaskedArray) – Standard tilt angle

  • th (MaskedArray) – Hyperbolic tilt angle

  • t2 (MaskedArray) – Second order tilt angle

  • ta (MaskedArray) – Tilt Based Directional Derivative

  • tdx (MaskedArray) – Total Derivative

  • tahg (MaskedArray) – Tilt Angle of the Horizontal Gradient

  • ehga (MaskedArray) – Enhanced Horizontal Gradient Amplitude

Return type:

tuple[numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray]

pygmi.maggrv.dataprep.nextpow2(n)#

Next power of 2.

Based on work by Gordon Cooper (School of Geosciences, University of the

Witwatersrand, Johannesburg, South Africa).

Parameters:

n (float | numpy.typing.NDArray) – Current value.

Returns:

Next power of 2 output.

Return type:

float or ndarray

class pygmi.maggrv.dataprep.RTP(parent=None)#

Bases: pygmi.misc.BasicModule

Perform Reduction to the Pole on Magnetic data.

Parameters:

parent – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

acceptall()#

Accept option.

Updates self.outdata, which is used as input to other modules.

pygmi.maggrv.dataprep.rtp(data, I_deg, D_deg, Ia=20, showlog=print, piter=iter)#

Reduction to the pole.

Parameters:
  • data (pygmi.raster.datatypes.Data) – PyGMI raster data.

  • I_deg (float) – Magnetic inclination.

  • D_deg (float) – Magnetic declination.

  • Ia (float) – Amplitude correction inclination Ia in degree. The default is 20.

  • showlog (collections.abc.Callable[..., None]) – Show information using a function. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterator. The default is iter.

Returns:

PyGMI raster data.

Return type:

Data

pygmi.maggrv.dataprep.mlv_filter(image, win_size=5)#

Apply a 2D Mean of Least Variance (MLV) Edge Preserving Filter.

Parameters:
  • image (numpy.typing.NDArray) – 2D grayscale input image (float32 or float64).

  • win_size (int) – Size of the square window (must be an odd integer), by default 5

Returns:

Filtered 2D image.

Return type:

ndarray