ps2ff.interpolate

PS2FF class for converting point distances (epicentral or hypocentral) to equivalent average finite rupture distances (Rjb or Rrup). Based upon:

class ps2ff.interpolate.PS2FF[source]

Bases: object

files()[source]

Returns the table files that were used to construct this object.

Parameters:None
Returns:A tuple of the ratio file and variance file.
Return type:(str, str)
classmethod fromFile(rfile)[source]

Create a PS2FF object from a file specification. The file must exist in the ps2ff tables.

Parameters:rfile (str) – A file name (base file name only, not a full path) corresponding to one of the tables in the ps2ff.data resource. The file should be the “Ratios” file; the “Var” file name is derived from the Ratios file.
Returns:An object of the PS2FF class initialized with the tables corresponding to the rfile argument.
Return type:(PS2FF)
classmethod fromParams(dist_type=<DistType.Rjb: 'Rjb'>, mag_scaling=<MagScaling.WC94: 'WC94'>, mechanism=<Mechanism.A: 'A'>, AR=1.7, min_seis_depth=0, max_seis_depth=20)[source]

Create a PS2FF object from a set of parameters. Parameters must combine into a file name of an existing table in the ps2ff tables. The file name will take the form:

<dist_type>_<mag_scaling>_mech<mechanism>_ar<AR>_seis<min_seis_depth>_<max_seis_depth>_Ratios.csv

where the decimal point in the aspect ratio will be replaced with the letter ‘p’.

Parameters:
  • dist_type (DistType) – One of the DistType enum members. Typically DistType.Rjb (default) or DistType.Rrup. See ps2ff.constants for a complete list.
  • mag_scaling (MagScaling) – One of the MagScaling enum members.See ps2ff.constants for a complete list. The default is MagScaling.WC94.
  • mechanism (Mechanism) – A mechanism from the Mechanism enum. See ps2ff.constants for a complete list. The default is Mechanism.A.
  • AR (float) – The aspect ratio for the rupture computations. Typical values are 1.7 (default) and 1.0; tables may not exist for other values.
  • min_seis_depth (int) – The depth (km) to the top of the seismogenic zone. This is typically 0 (default); tables for other values may not exist.
  • max_seis_depth (int) – The depth (km) to the bottom of the seismogenic zone. Typical values are 15 (for ACR regions) and 20 (default, for SCR regions).
Returns:

An object of the PS2FF class initialized with the tables corresponding to the selected parameters.

Return type:

(PS2FF)

classmethod getValidFiles()[source]

Get a list of the valid conversion tables in the ps2ff package.

Parameters:None
Returns:A list of file names corresponding to the available tables in the ps2ff package.
r2r(r, M)[source]

Convert point distances to the equivalent average finite rupture distances, based on the parameters specified when creating this object.

Parameters:
  • r (numpy.ndarray) – An array of point distances (typically epicentral distance) in km.
  • M (numpy.ndarray) – An array (the same shape as r) of magnitudes.
Returns:

An array the same shape as r, with

distances converted to average finite rupture distance.

Return type:

(numpy.ndarray)

rat(r, M)[source]

Return ratios needed to convert point distances to the equivalent average finite rupture distances, based on the parameters specified when creating this object.

Parameters:
  • r (numpy.ndarray) – An array of point distances (typically epicentral distance) in km.
  • M (numpy.ndarray) – An array (the same shape as r) of magnitudes.
Returns:

An array the same shape as r, with

the ratios (multipliers) needed to convert r to average finite rupture distance.

Return type:

(numpy.ndarray)

var(r, M)[source]

Return the additional variance from the uncertainty in point distances vis a vis finite rupture distance.

Parameters:
  • r (numpy.ndarray) – An array of point distances (typically epicentral distance) in km.
  • M (numpy.ndarray) – An array (the same shape as r) of magnitudes.
Returns:

An array the same shape as r, containing the additional variance from the uncertainty in finite rupture distance for the distances in r.

Return type:

(numpy.ndarray)