DispersionSet¶
DispersionSet class definition.
-
class
DispersionSet
(identifier=0, misfit=0.0, rayleigh=None, love=None)¶ Bases:
object
Class for handling sets of :meth: DispersionCurve <swprepost.DispersionCurve> objects, which all belong to a common ground model.
Variables: - love (rayleigh,) – Container for DispersionCurve objects, of the form: {0:DispersionCurve0, … N:DispersionCurveN} where each key is the mode number and the value is the corresponding instantiated DispersionCurve object.
- identifier (int) – Model identifier of the DispersionSet.
- misfit (float) – Value of dispersion misfit if provided, None otherwise.
-
__init__
(identifier=0, misfit=0.0, rayleigh=None, love=None)¶ Create a DispersionCurveSet object.
Parameters: - identifier (str) – Unique identifier of the DispersionSet.
- misfit (float, optional) – DispersionSet misfit, default is 0.0.
- rayleigh, love (dict) – Container for DispersionCurve objects of the form {0:disp_curve_obj0, … N:disp_curve_objN} where each key is the mode number and the value is the corresponding DispersionCurve object.
Returns: DispersionSet – Instantiated DispersionSet object.
-
classmethod
check_type
(curveset, valid_type)¶ Check that the curveset are are valid.
Specifically: 1. Assume curveset is instance of dict. 2. If it is a dict, check all values are instances of the valid_type and return zero, otherwise raise TypeError. 3. If it is not check if None, if so return one. 4. Otherwise, raise TypeError.
-
classmethod
from_geopsy
(fname, nrayleigh='all', nlove='all')¶ Create from a text file following the Geopsy format.
Parameters: - fname (str) – Name of file to be read, may be a relative or full path.
- nrayleigh, nlove ({“all”, int}, optional) – Number of Rayleigh and Love modes to extract into a DispersionSet object, default is “all” meaning all available modes will be extracted.
Returns: DispersionSet – Instantiated DispersionSet object.
-
write_set
(fileobj, nrayleigh='all', nlove='all')¶ Write DispersionSet to current file.
Parameters: fname (str) – Name of file, may be a relative or the full path. Returns: None – Writes file to disk.
-
write_to_txt
(fname)¶ Write DispersionSet to Geopsy formated file.
Parameters: fname (str) – Name of file, may be a relative or the full path. Returns: None – Writes text representation to disk.