ModalTarget

Definition of ModalTarget class.

class ModalTarget(frequency, velocity, velstd, description=(('rayleigh', 0), ))

Bases: swprepost.curveuncertain.CurveUncertain

Target information for a surface wave mode.

ModalTarget is a class for loading, manipulating, and writting surface wave target information for a single mode in preparation for surface wave inversion.

__init__(frequency, velocity, velstd, description=(('rayleigh', 0), ))

Initialize a ModalTarget object.

Parameters:
  • frequency, velocity, velstd (array-like) – Arrays of frequency, velocity, and velocity standard deviation values to fully describe a mode of experimental dispersion data (one per point).
  • description (tuple of tuples) – Each ModalTarget may describe one or more wavetypes and/or one or more modes. Each potential description of the ModalTarget is listed as tuple of the form (wavetype, modenumber) where wavetype is either “rayleigh” or “love” and modenumber is a non-negative integer. A mode number of zero refers to the fundamental mode. The potential descriptions of a mode are grouped into a tuple containing all possible descriptions. The default description is that of the fundamental Rayleigh mode expressed as ((“rayleigh”, 0),).
Returns:

ModalTarget – Instantiated ModalTarget object.

Raises:
  • TypeError – If frequency, velocity, and velstd are not array-like.
  • ValueError – If velstd is float and the value is less than zero.
cov
cut(pmin, pmax, domain='frequency')

Remove data outside of the specified range.

Parameters:
  • pmin, pmax (float) – New minimum and maximum parameter value in the specified domain, respectively.
  • domain ({‘frequency’, ‘wavelength’}, optional) – Domain along which to perform the cut.
Returns:

None – May update attributes frequency, velocity, and velstd.

easy_resample(pmin, pmax, pn, res_type='log', domain='wavelength', inplace=False)

Resample dispersion curve.

Resample dispersion curve over a specific range, using log or linear sampling in the frequency or wavelength domain.

Parameters:
  • pmin, pmax (float) – Minimum and maximum parameter value in the resampled dispersion data.
  • pn (int) – Number of points in the resampled dispersion data.
  • res_type ({‘log’, ‘linear’}, optional) – Resample using either logarithmic or linear sampling, default is logarithmic.
  • domain ({‘frequency’, ‘wavelength’}, optional) – Domain along which to perform the resampling.
  • inplace (bool) – Indicating whether the resampling should be done in place or if a new Target object should be returned.
Returns:

None or Target – If inplace=True returns None, and may update attributes frequency, velocity, and velstd. If inplace=False a new Target object is returned.

Raises:

NotImplementedError – If res_type and/or domain are not among the options specified.

frequency
classmethod from_csv(fname, description=(('rayleigh', 0), ))

Read ModalTarget from csv.

Read a comma seperated values (csv) file with header line(s) to construct a ModalTarget.

Parameters:
  • fname (str) – Relative or the full path to a file containing surface wave dispersion data. The field should have three columns: frequency in Hz, velocity in m/s, and velocity standard deviation in m/s.
  • description (tuple of tuples) – Each ModalTarget may describe one or more wavetypes and/or one or more modes. Each potential description of the ModalTarget is listed as tuple of the form (wavetype, modenumber) where wavetype is either “rayleigh” or “love” and modenumber is a non-negative integer. A mode number of zero refers to the fundamental mode. The potential descriptions of a mode are grouped into a tuple containing all possible descriptions. The default description is that of the fundamental Rayleigh mode expressed as ((“rayleigh”, 0),).
Returns:

ModalTarget – Initialized ModalTarget object.

Raises:

ValueError – If the format of the input file does not match that detailed above.

classmethod from_target(fname_prefix, version='3.4.2')

Create from target file.

Note that this method is still largely experimental and may not work for all cases.

Parameters:
  • fname_prefix (str) – Name of target file to be opened excluding the .target suffix, may include the relative or full path.
  • version ({‘2.10.1’, ‘3.10.2’}, optional) – Major version of Geopsy that was used to write the target file, default is ‘3.4.2’.
Returns:

ModalTarget – Instantiated ModalTarget object.

classmethod from_txt_dinver(fname, version='3.4.2')

Create from text format accepted by Dinver.

Parameters:
  • fname (str) – Name of output file, may a relative or full path.
  • version ({‘3.4.2’, ‘2.10.1’}, optional) – Version of Geopsy, default is version ‘3.4.2’.
Returns:

ModalTarget – Instantiated ModalTarget with information from file.

Raises:

NotImplementedError – If version does not match the options provided.

Notes

In previous versions of swprepost (v1.0.0 and earlier) an attempt was made to support all versions of Dinver’s .target and .param formats. However, this has become untenable due to the number and frequency of breaking changes that occur to these formats. Therefore, in lieu of supporting all versions, swprepost will seek to support only those versions directly associated with the open-source high-performance computing application swbatch.

classmethod from_wavelength(wavelength, velocity, velstd, description=(('rayleigh', 0), ))

Create from data processed in terms of wavelength.

Parameters:
  • frequency, velocity, velstd (array-like) – Arrays of frequency, velocity, and velocity standard deviation values to fully describe a mode of experimental dispersion data (one per point).
  • description (tuple of tuples) – Each ModalTarget may describe one or more wavetypes and/or one or more modes. Each potential description of the ModalTarget is listed as tuple of the form (wavetype, modenumber) where wavetype is either “rayleigh” or “love” and modenumber is a non-negative integer. A mode number of zero refers to the fundamental mode. The potential descriptions of a mode are grouped into a tuple containing all possible descriptions. The default description is that of the fundamental Rayleigh mode expressed as ((“rayleigh”, 0),).
Returns:

ModalTarget – Instantiated ModalTarget object.

is_no_velstd

Indicates True if every point has zero velstd.

logstd

Get logarithmic slowness standard deviation.

plot(x='frequency', y='velocity', yerr='velstd', ax=None, figkwargs=None, errorbarkwargs=None)

Plot ModalTarget information.

Parameters:
  • x ({‘frequency’, ‘wavelength’}, optional) – Select what should be plotted along the x-axis, default is ‘frequency’.
  • y ({‘velocity’, ‘slowness’}, optional) – Select what should be plotted along the y-axis, default is ‘velocity’.
  • yerr ({‘velstd’, ‘slostd’}, optional) – Select what should be plotted as the y-error, default is ‘velstd’.
  • ax (Axis, optional) – Provide an axes on which to plot, default is None meaning an axes will be created on-the-fly.
  • figkwargs (dict) – Additional keyword arguments defining the Figure. Ignored if ax is defined.
  • errorbarkwargs (dict) – Additional keyword arguments defining the styling of the errorbar plot.
Returns:

None or Tuple – If ax is defined this method returns returns None. If ax=None this method returns a tuple of the form (fig, ax) where fig is a Figure object and ax is an Axes object.

pseudo_depth(depth_factor=2.5)

Estimate depth based on the experimental dispersion data.

This method, along with :meth: pseudo-vs, may be useful to create plots of pseudo-Vs vs pseudo-depth for selecting appropriate boundaries for parameter limits in the inversion stage.

Parameters:depth_factor (float, optional) – Factor by which the mean wavelegnth is divided to produce an estimate of depth. Typical are between 2 and 3, default 2.5.
Returns:ndarray – Of pseudo-depth.
pseudo_vs(velocity_factor=1.1)

Estimate Vs based on the experimental dispersion data.

This method, along with :meth: pseudo-depth, may be useful to create plots of pseudo-Vs vs pseudo-depth for selecting appropriate boundaries for parameter limits.

Parameters:velocity_factor (float, optional) – Factor by which the mean Rayleigh wave velocity is multiplied to produce an estimate of shear-wave velocity. Typically range between 1 and 1.2, and is dependent upon the expected Poisson’s ratio, default is 1.1.
Returns:ndarray – Of pseudo-vs.
setcov(cov)

Set coefficient of variation (COV) to a constant value.

This method may be used if no velocity standard deviation was measured or provided. In general, a COV between 0.05 and 0.10 should provide a reasonable estimate of the uncertainty.

If velocity standard deviations have already been provided this method will overwrite them. If this is not desired refer to :meth: setmincov.

Parameters:cov (float) – Coefficient of variation to be used to replace velstd.
Returns:None – Updates attribute velstd.
Raises:ValueError: – If cov < 0.
setmincov(cov)

Set minimum coefficient of variation (COV).

If uncertainty in the experimental data has been provided, this method allows the setting of a minimum COV, where all data points with uncertainty below this threshold will be modified and those above this threshold will be left alone.

If no measure of uncertainty has been provided, prefer :meth: setcov.

Parameters:cov (float) – Minimum allowable COV.
Returns:None – May update attribute velstd.
Raises:ValueError – If cov < 0.
slostd

Get slowness standard deviation.

slowness
to_csv(fname)

Write ModalTarget to csv.

Parameters:fname (str) – Name of output file, may a relative or full path.
Returns:None – Writes file to disk.
to_target(fname_prefix, version='3.4.2')

Write info to the .target file format used by Dinver.

Parameters:
  • fname_prefix (str) – Name of target file without the .target suffix, a relative or full path may be provided.
  • version ({‘3.4.2’, ‘2.10.1’}, optional) – Version of Geopsy, default is version ‘3.4.2’.
Returns:

None – Writes file to disk.

Raises:

NotImplementedError – If version does not match the options provided.

Notes

In previous versions of swprepost (v1.0.0 and earlier) an attempt was made to support all versions of Dinver’s .target and .param formats. However, this has become untenable due to the number and frequency of breaking changes that occur to these formats. Therefore, in lieu of supporting all versions, swprepost will seek to support only those versions directly associated with the open-source high-performance computing application swbatch.

to_txt_dinver(fname, version='3.4.2')

Write in text format accepted by Dinver.

Parameters:
  • fname (str) – Name of output file, may a relative or full path.
  • version ({‘3.4.2’, ‘2.10.1’}, optional) – Version of Geopsy, default is version ‘3.4.2’.
Returns:

None – Write’s geopsy-styled text file to disk.

Raises:

NotImplementedError – If version does not match the options provided.

Notes

In previous versions of swprepost (v1.0.0 and earlier) an attempt was made to support all versions of Dinver’s .target and .param formats. However, this has become untenable due to the number and frequency of breaking changes that occur to these formats. Therefore, in lieu of supporting all versions, swprepost will seek to support only those versions directly associated with the open-source high-performance computing application swbatch.

velocity
velstd
vr40

Estimate Rayleigh wave velocity at a wavelength of 40m.

wavelength
Target

alias of swprepost.modaltarget.ModalTarget