tiskitpy.Compliance
- class tiskitpy.Compliance(freqs, values, uncertainties, water_depth, noise_channel, gravity_corrected=False, coherence=None)
Bases:
objectSeafloor compliance class
- freqs
Frequencies (Hz)
- Type:
numpy.ndarray
- values
Normalized compliance values (1/Pa)
- Type:
numpy.ndarray
- uncertainties
Normalized compliance uncertainties (1/Pa)
- Type:
numpy.ndarray
- water_depth
water depth in meters
- Type:
float
- noise_channel
If a str, compliance comes from data and this is the channel on which noise was assumed to dominate
- Type:
str or None
- gravity_corrected
Has data-estimated compliance been corrected for gravitational attraction terms?
- Type:
bool
Seafloor compliance data class
- Parameters:
freqs (
numpy.ndarray) – Frequencies (Hz)values (
numpy.ndarray) – Normalized compliance values at each frequency (1/Pa)uncertainties (
numpy.ndarray) – Normalized compliance uncertainties at each frequency (1/Pa)water_depth (float) – water depth in meters
noise_channel (str) – (str or None): If a str, compliance comes from data and this is the channel on which noise was assumed to dominate
gravity_corrected (bool) – Has data-estimated compliance been corrected for gravitational attraction terms?
coherence (
numpy.ndarrayor None) – coherences at each frequency
- static calc_compliance(wdepth, freq, model)
Return compliance of a 1D model
- Parameters:
wdepth (float) – water depth (m)
freq (
numpy.nparray) – frequencies (1/s)model (
EarthModel1D) – 1D earth model
- static calc_norm_compliance(wdepth, freq, model)
Return normalized compliance of a 1D model
norm compliance == k(omega) * compliance
- Parameters:
wdepth (float) – water depth (m)
freq (
numpy.nparray) – frequencies (1/s)model (
EarthModel1D) – 1D earth model
>>> wdepth = 2000 >>> freqs = np.array([0.001, 0.003, 0.005, 0.01, 0.03]) >>> model = EarthModel1D([[1000, 3000, 3000, 1600], ... [1000, 3000, 4000, 2300], ... [1000, 3000, 5000, 2800], ... [3000, 3000, 7500, 4300], ... [3000, 3000, 8200, 4700]]) >>> np.set_printoptions(precision=1) >>> calc_norm_compliance(wdepth, freqs, model) array([-1.4e-11, -2.0e-11, -2.6e-11, -4.2e-11, -9.0e-11])
- correct_gravity_terms()
NOT YET IMPLEMENTED
- classmethod from_earth_model_1D(water_depth, freqs, earth_model, limit_freqs=True)
Create object with the compliance of a 1D earth model
- Parameters:
water_depth (float) – water depth (m)
freqs (list or
numpy.ndarray) – frequenciesearth_model (
tiskitpy.compliance.EarthModel1D) – 1D earth modellimit_freqs (bool) – limit frequencies to below Compliance.max_freq()?
- classmethod from_file(filename)
NOT YET IMPLEMENTED
- classmethod from_response_functions(rfs, wdepth, max_freq=None, z_str='*Z')
Extracts compliance from ResponseFunctions object
- Parameters:
rfs (
tiskitpy.ResponseFunctions) – z/p transfer function(s). The input_channel should be the pressure channelwdepth (float) – water depth (m)
max_freq (float) – maximum frequency to save. If None, use sqrt(g/(2*pi*wdepth))
z_str (str) – channel_id to use for z channel (may include ‘*’ wildcard)
- classmethod from_seafloor_synthetic(obj, max_freq=True)
Create object with the compliance of a SeafloorSynthetic object
Uses objs earth_model, IG_Pa_seafloor.freqs and water_depth attributes
- Parameters:
obj (
tiskitpy.SeafloorSynthetic) – the objectmax_freq (bool or float) – limit frequencies to: True: below Compliance.max_freq() float: below the value False: no limit applied
- static gravd(W, h)
Return linear ocean surface gravity wave wavenumbers
- Parameters:
W (
numpy.ndarray) – angular frequencies (rad/s)h (float) – water depth (m)
- Returns:
wavenumbers (rad/m)
- Return type:
K (
numpy.ndarray)
>>> f = np.array([0.0001, 0.001, 0.01, 0.1, 1, 10]) >>> K = gravd(2 * np.pi * f, 2000) >>> wlen = 2 * np.pi * np.power(K, -1) >>> np.set_printoptions(precision=1) >>> print(f'{K=} rad/m') K=array([4.5e-06, 4.5e-05, 5.2e-04, 4.0e-02, 4.0e+00, 4.0e+02]) rad/m >>> print(f'{wlen=} m') wlen=array([1.4e+06, 1.4e+05, 1.2e+04, 1.6e+02, 1.6e+00, 1.6e-02]) m >>> print(f'c={f*wlen} m/s') c=[140. 139.8 121.1 15.6 1.6 0.2] m/s
- static max_freq(water_depth)
Return estimated maximum compliance frequency for the given water depth
About one wavelength, from Janiszewski et al. (2019?)
- plot(errorbars=True, show=True, outfile=None)
Plot the compliance
- Parameters:
errorbars (bool) – plot error bars
show (bool) – show on the screen
outfile (str) – save figure to this filename
- Returns:
axis pair amplitude, phase
- Return type:
axa, axp
- static raydep(P, om, d, ro, vp2, vs2)
Propagator matrix solutionn for P-SV waves, minor vector method
- Parameters:
P (float) – surface wave slowness (s/m)
om (float) – surface wave angular frequency (radians/sec)
d (
numpy.ndarray) – layer thicknesses (meters?)rho (
numpy.ndarray) – layer densities (kg/m^3)vp2 (
numpy.ndarray) – layer P velocities squared (m/s)^2vs2 (
numpy.ndarray) – layer shear velocities squared (m/s)^2
- Returns:
- Parameters, each value is at layer top
v (
numpy.ndarray): vertical velocity (m/s?) u (numpy.ndarray): horizontal velocity (m/s?) zz (numpy.ndarray): vertical stress (Pa?) zx (numpy.ndarray): horizontal stress (Pa?)
- Return type:
(list)
Notes
- d, rho, vp2 and vs2 have one value for each layer (top to bottom),
must be same length
(Normalized compliance = -k*v/(omega*sigzz) )
>>> P = 1/140 # Corresponds to 2000m depth, low freqs >>> om = 2 * np.pi * 0.005 >>> d = np.array([1000, 1000, 1000, 3000, 3000]) >>> rho = np.array([3000, 3000, 3000, 3000, 3000]) >>> vp2 = np.array([3000**2, 4000**2, 5000**2, 7500**2, 8200**2]) >>> vs2 = np.array([1600**2, 2300**2, 2800**2, 4300**2, 4700**2]) >>> np.set_printoptions(precision=1) >>> raydep(P, om, d, rho, vp2, vs2) (array([1. , 0.7, 0.5, 0.4, 0.3]), array([ 1.8e-01, 6.0e-02, 1.2e-02, 5.2e-05, -5.8e-02]), array([-2.8e+08, -2.8e+08, -2.7e+08, -2.6e+08, -1.9e+08]), array([-0.0e+00, 3.1e+07, 5.4e+07, 7.6e+07, 1.0e+08]))
- write(base_name, units='1/Pa', out_dir=None)
Save compliance to a CSV file
- Parameters:
base_name (str) – base filename. “_{units}.csv” will be appended
units (str) – units in which to save compliance. One of ‘1/Pa’, ‘m/Pa’, ‘m/s/Pa’, ‘m/s^2/Pa’ (‘1/Pa’ is normalized compliance)
out_dir (str or
Path) – output directory (None: save to working directory)
- write_counts(base_name, z_response, p_response, out_dir=None)
Save compliance IN COUNTS to a CSV file
Only useful for creating compliance values for people who don’t know how to use inventories
- Parameters:
base_name (str) – base filename. “_{units}.csv” will be appended
z_reponse (
obspy.core.inventory.Responseor None) – response of the z channel. If None, expects p_response to be None too and assumes compliance and uncertainty were already in counts/countsp_reponse (
obspy.core.inventory.Responseor None) – response of the p channelout_dir (str or
Path) – output directory (None: save to working directory)