Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.attenuation

A class to handle attenuation parameters.

Classes

LinearSolid

class LinearSolid(builtins.object):
    def __init__(
        self,
        y_j: numpy.ndarray,
        w_j: numpy.ndarray,
        Q: float,
        alpha: float = 1.0,
        pl_f_ref: float = 1.0,
        f_min: Optional[float] = None,
        f_max: Optional[float] = None,
    ):
        ...

Object representing a linear solid.

Parameters
  • y_j numpy.ndarray — y_j as in van Driel et al 2014 eq 8
  • w_j numpy.ndarray — w_j as in van Driel et al 2014 eq 6-8
  • Q float — target quality factor at reference frequency
  • alpha float — alpha exponent for power law Q
  • pl_f_ref float — reference frequency for power law Q
  • f_min Optional[float] — Minimum frequency for the optimization.
  • f_max Optional[float] — Maximum frequency for the optimization.
Methods
invert_linear_solids()
def invert_linear_solids(
    Q: float = 1.0,
    f_min: float = 0.001,
    f_max: float = 1.0,
    N: int = 3,
    nfsamp: int = 100,
    maxiter: int = 1000,
    fixfreq: bool = False,
    freq_weight: bool = True,
    pl_f_ref: float = 1.0,
    alpha: float = 0.0,
    ftol: float = 1e-10,
    exact: bool = False,
) -> LinearSolid:
    ...

Invert for the parameters of a linear solid.

Parameters
  • Q float — target qualtity factor at reference frequency
  • f_min float — frequency band (in Hz)
  • f_max float — frequency band (in Hz)
  • N int — number of standard linear solids
  • nfsamp int — number of sampling frequencies for computation of the misfit (log spaced in freqeuncy band)
  • maxiter int — number of iterations
  • fixfreq bool — use log spaced peak frequencies (fixed)
  • freq_weight bool — use frequency weighting to ensure better fit at high frequencies
  • pl_f_ref float — reference frequency for power law Q
  • alpha float — exponent for power law Q
  • ftol float — tolerance for the optimization
  • exact bool — use exact relation, van Driel et al 2014 eq 7 or approximate, eq 18
Returns LinearSolid
get_Q()
def get_Q(self, w: numpy.ndarray, exact: bool = False) -> numpy.ndarray:
    ...

Get Q.

Parameters
  • w numpy.ndarray — angular frequency omega
  • exact bool — use exact relation, van Driel et al 2014 eq 7 or approximate, eq 18
Returns numpy.ndarray
get_deltaM()
def get_deltaM(self, M_f_ref: float, f_ref: float = 1.0) -> float:
    ...

Get delta M = M_U - M_R, where M_U is the unrelaxed and M_R is the relaxed modulus as in eq 8, van Driel et al 2014.

Parameters
  • M_f_ref float — Modulus at the reference frequency (real value)
  • f_ref float — reference frequency
Returns float
get_gamma()
def get_gamma(self, f_ref: float = 1.0) -> float:
    ...

Get gamma as in eq 8, van Driel et al 2014.

Parameters
  • f_ref float — reference frequency
Returns float
get_modulus()
def get_modulus(
    self, w: numpy.ndarray, M_f_ref: float, f_ref: float = 1.0
) -> float:
    ...

Get the modulus as a function of frequency as in eq 6, van Driel et al 2014.

Parameters
  • w numpy.ndarray — array of angular frequencies
  • M_f_ref float — Modulus at the reference frequency (real value)
  • f_ref float — reference frequency
Returns float
get_relaxed_modulus()
def get_relaxed_modulus(self, M_f_ref: float, f_ref: float = 1.0) -> float:
    ...

Get the unrelaxed and M_U as in eq 8, van Driel et al 2014.

Parameters
  • M_f_ref float — Modulus at the reference frequency (real value)
  • f_ref float — reference frequency
Returns float
get_unrelaxed_modulus()
def get_unrelaxed_modulus(self, M_f_ref: float, f_ref: float = 1.0) -> float:
    ...

Get the unrelaxed and M_U as in eq 8, van Driel et al 2014.

Parameters
  • M_f_ref float — Modulus at the reference frequency (real value)
  • f_ref float — reference frequency
Returns float
optimal_bandwidth()
def optimal_bandwidth(N: int) -> float:
    ...

Bandwidth that results in about 1% error in fitting Q, see van Driel (2014), figure 4

Parameters
  • N int — Number of linear solids
Returns float
plot()
def plot(
    self,
    ffac: float = 10.0,
    nfsamp: int = 1000,
    errorlim: float = 1.1,
    show: bool = True,
    exact: bool = True,
    f_ref: float = 1.0,
    M_f_ref: float = 1.0,
) -> Optional[matplotlib.figure.Figure]:
    ...

Plot the linear solid.

Parameters
  • ffac float — frequenc factor to extent the plotting range beyonde the limits used in the optimization
  • nfsamp int — number of frequency samples
  • errorlim float — indicate errorlimits by horizontal lines
  • show bool — return with a figure object or show the figure on screen
  • exact bool — use exact relation, van Driel et al 2014 eq 7 or approximate, eq 18
  • f_ref float — reference frequency
  • M_f_ref float — Modulus at the reference frequency (real value)
Returns Optional[matplotlib.figure.Figure]
power_law_Q()
def power_law_Q(
    Q: float, alpha: float, w: numpy.ndarray, pl_f_ref: float = 1.0
) -> numpy.ndarray:
    ...
Parameters
  • Q float — target quality factor at reference frequency
  • alpha float — alpha exponent for power law Q
  • w numpy.ndarray — angular frequency omega
  • pl_f_ref float — reference frequency for power law Q
Returns numpy.ndarray
q_linear_solid()
def q_linear_solid(
    y_j: numpy.ndarray,
    w_j: numpy.ndarray,
    w: numpy.ndarray,
    exact: bool = False,
) -> numpy.ndarray:
    ...
Parameters
  • y_j numpy.ndarray — y_j as in van Driel et al 2014 eq 8
  • w_j numpy.ndarray — w_j as in van Driel et al 2014 eq 6-8
  • w numpy.ndarray — angular frequency omega
  • exact bool — use exact relation, van Driel et al 2014 eq 7 or approximate, eq 18
Returns numpy.ndarray