specd package

Subpackages

Submodules

specd.THSolver module

class specd.THSolver.THSolver(thick: ndarray, vp: ndarray, vs: ndarray, rho: ndarray, spherical: bool = False)[source]

Bases: object

compute_swd(wavetype: str, mode: int, T: ndarray) ndarray[source]

compute dispersion (phase/group) for a give wavetype

Parameters:
  • wavetype (str) – wave type, one of [‘Rc’,’Rg’,’Lc’,’Lg’]

  • mode (int) – which mode it will return, >=0

  • T (np.ndarray) – period, in s

Returns:

cg – phase velocity (for Rc,Lc) or group velocity (Rg,Lg)

Return type:

np.ndarray

specd.attenuation module

specd.attenuation.compute_q_sls_model(y_sls, w_sls, om, exact=False)[source]

compute Q model by a given SLS coefficients: Q^{-1}(om) = D(om) / N(om) where N(om) = sum_p y[p] * om^2 / (om^2 + w[p]^2) and D(om) = y[p] * om^2 / (om^2 + w[p]^2)

Parameters:
  • y_sls (np.ndarray) – y coefficients, shape(NSLS)

  • w_sls (np.ndarray) – w coefficients, shape(NSLS)

  • om (np.ndarray) – current angular frequency

  • exact (bool) – if True, N(om) and D(om) are all computed. Else set N =1.

specd.attenuation.compute_sls_coefs(freqmin: float, freqmax: float, NSLS=5, nfsamp=100, weight_by_freq=True, method='dual', Q_ref=1.0, random_seed=10)[source]

compute SLS coefs for reference model, by nonlinear inversion

Parameter

freqmin: float

minimum frequency

freqmax: float

maximum frequency

NSLS: int

no. of SLS solids, default = 5

nfsamp: int

no. of sampling points in [freqmin,freqmax], default = 100

weight_by_freq: bool

if apply frequency weighting in misfit function ,default = True

method: str

one of [‘dual’,’simulated’], dual or regular simulated annealling

Q_ref: float

reference Q value, default is 1. Donnot change it unless you know what you’re doning

random_seed: int

random seed, default 10

returns:
  • y (np.ndarray) – SLS factor

  • w (np.ndarray) – SLS angular frequency

specd.attenuation.test()[source]
specd.attenuation.y_corrector(y_sls, Q_ref: float, Q: float)[source]

correction from reference y to target y

Parameters:
  • y_sls (np.ndarray) – y factor for refernce sls model

  • Q_ref (float) – refernce Q

  • Q (float) – target Q

specd.specd module

class specd.specd.SpecWorkSpace(wavetype: str = None, has_att: bool = False)[source]

Bases: object

compute_egn(freq: float, ang_in_deg=0.0, only_phase=False) ndarray[source]

compute eigenvalues/eigenvectors

Parameters:
  • freq (float) – current frequency

  • ang_in_deg (float) – phase velocity azimuthal angle, in deg

  • only_phase (bool) – if False, only compute eigenvalues (phase velocities) if True, phase velocities and eigenfunctions will be computed

Returns:

c – phase velocities

Return type:

np.ndarray

get_egnfunc(imode: int, return_displ: bool, return_left=False)[source]

get eigenfunctions at current frequency/mode

Parameters:
  • imode (int) – mode number

  • return_left (bool) – if true, return left eigenvectors else return right eigenvectors

  • return_displ (bool) – if true return displacement instead of eigenvectors e.g. in scholte wave, eigenvectors = [u,v^{ar},chi^{ar}]

get_group_kl(imode: int)[source]

compute group velocity sensitivity kernels for mode {imode}

Parameters:

imode (int) – compute kernels at imode, imode elong [0,max_mode)

Returns:

  • frekl_c (np.ndarray) – group velocity kernels, shape(nkers,self._nz)

  • frekl_q (np.ndarray) – group velocity Q kernels,shape(nkers,self._nz), only returns when self._has_att = True

get_kernel_names()[source]

get names for Frechet derivative

Returns:

kl_name – list of kernel names

Return type:

list[str]

get_phase_kl(imode: int)[source]

compute phase velocity sensitivity kernels for mode {imode}

Parameters:

imode (int) – compute kernels at imode, imode elong [0,max_mode)

Returns:

  • frekl_c (np.ndarray) – phase velocity kernels, shape(nkers,self._nz)

  • frekl_q (np.ndarray) – phase velocity Q kernels,shape(nkers,self._nz), only returns when self._has_att = True

get_znodes()[source]

get mesh coordiantes, shape(nspec*NGLL+NGRL)

group_velocity()[source]

compute group velocites for each model at current frequency

Returns:

u – group velocities at current frequency

Return type:

float/complex

Note

before calling this routine, use_qz should be True in self.compute_egn

initialize(wavetype: str, z: ndarray, rho: ndarray, vph=None, vpv=None, vsh=None, vsv=None, eta=None, Qa=None, Qc=None, Qn=None, Ql=None, c21=None, Qani=None, qfunc_id=1, scale_rho=0.0, scale_v=0.0, scale_z=0.0, disp=False)[source]

initialize working space for SEM

Parameters:
  • wavetype (str) – wavetype, one of [‘love’,’rayl’,’aniso’]

  • z (np.ndarray) – depth vector, should include discontinuities at half sapce

  • rho (np.ndarray) – density, shape_like(z)

  • vph/vpv/vsh/vsv (np.ndarray) – VTI parameters, shape_like(z)

  • Qa/Qc/Qn/Ql (np.ndarray) – VTI quality factors, shape_like(z)

  • c21 (np.ndarray) – 21 elastic tensor, shape(21,nz)

  • nQani (int) – no. of Q models for fully anisotropy

  • Qnai (np.ndarray) – quality factors, shape(nQnai,nz)

  • disp (bool) – if True print model information

Note

The input parameters should be carefully chose by user. For Love wave, only vsh/vsv/Qsh/Qsv can be enabled, and for Rayleigh wave, only vph/vpv/vsv can ve enabled, and other params are for full anisotropy

Module contents