tiskitpy.PSDVals
- class tiskitpy.PSDVals(freqs_and_vals, value_units='unknown')
Bases:
objectHolds PSD frequencies and values
- freqs
frequencies
- Type:
list
- values
values in dB
- Type:
list
- value_units
units of the values
- Type:
str
- Parameters:
freqs_and_vals (tuple)) –
frequencies, PSD values, and is_dB (bool), entered as: ([[freq1, value1],
[freq2, value1], … [freqN, valueN]],
is_dB)
frequencies must be monotonically increasing is_DB: True: Input values are in dB ref 1 {value_units}^2/Hz
False: Input values are in {value_units}
value_units (str) – Units of values before converting to dB
- property accel_as_vel
velocity
- Type:
Convert a PSD that was ref
- Type:
acceleration to ref
- as_trace(ref_trace, network=None, station=None, location=None, channel=None, plotit=False, **kwargs)
Return a Trace with the given spectral shape
- Parameters:
ref_trace (
obspy.core.stream.Traceor dict) – trace whose parameters will be used, or dict with keys ‘sampling_rate’ (float), ‘starttime’ (obspy.UTCDateTime), ‘endtime’ (obspy.UTCDateTime) and possibly ‘response’ (obspy.core.inventory.Response).network (str) – network code (default: value in ref Trace, or ‘XX’)
station (str) – station code (default: value in ref Trace, or ‘STA’)
location (str) – location code (default: value in ref Trace, or ‘00’)
channel (str) – channel code (default: value in ref Trace, or ‘CCC’)
plotit (bool or str) – plot the components of the transformation (psd, fft, fresp). If a string, use as the plot’s title.
**kwargs (dict) – keyword arguments to pass to self._as_fft()
- Returns:
trace (class:obspy.stream.Trace) phases (
numpy.ndarray): FFT phases (radians)used to create this trace
- Return type:
tuple
- copy()
Return a deep copy of self
- classmethod from_amp_var_period(amplitude, variance, period, value_units='unknown')
Generate a class object from an amplitude, a variance and a central period
- classmethod from_loglog_slope(val_1Hz, slope, logf_low, logf_high, logf_step, value_units='unknown')
Create PSDVals object with a loglog slope
- Parameters:
val_1Hz (float) – PSD level (dBs) at 1 Hz
slope (float) – PSD slope in log(dBs)/log(freq)
logf_low (float) – log10 of minimum frequency
logf_high (float) – log10 of maximum frequency
logf_step (float) – log10 frequency step
value_units (str) – Units of values before converting to dB
- plot()
- resample(new_f, reference='loglog')
Resample data using interpolation
- Parameters:
new_f (list or
np.array) – frequencies at which to evaluatereference (str) – What x and y dimensions to use as reference: ‘loglog’: log frequencies, log values (default) ‘semilogx’: log frequencies, linear values ‘semilogy’: linear frequencies, log values ‘linear’: linear frequencies and values
- resample_values(freqs, reference='loglog')
Resample values at the given frequencies
- Parameters:
freqs (list or
np.array) – frequencies at which to evaluatereference (str) – What x and y dimensions to use as reference: ‘loglog’: log frequencies, log values (default) ‘semilogx’: log frequencies, linear values ‘semilogy’: linear frequencies, log values ‘linear’: linear frequencies and values
- static sloped_freqs_and_values(val_1Hz, slope, logf_low, logf_high, logf_step)
Create freqs_and_values input for a loglog slope
- Parameters:
val_1Hz (float) – PSD level (dBs) at 1 Hz
slope (float) – PSD slope in log(dBs)/log(freq)
logf_low (float) – log10 of minimum frequency
logf_high (float) – log10 of maximum frequency
logf_step (float) – log10 frequency step