tiskitpy.DataCleaner

class tiskitpy.DataCleaner(stream, remove_list, noise_channel='output', n_to_reject=3, min_freq=None, max_freq=None, show_progress=False, fast_calc=False, **kwargs)

Bases: object

Calculate and apply ResponseFunction-based data cleaner

Works on raw data, without instrument corrections

By default, calculates corrected intermediate and final spectra directly from the stream data, applying the frequency response functions to each FFT.

Parameters:
  • stream (obspy.core.stream.Stream) – time series data used to calculate cleaner

  • remove_list (list) – list of channels to remove, in order. Can use “*” and “?” as wildcards

  • noise_channel (str) – which channel the noise is on. Choices are: “input”, “output”, “equal”, “unknown”, “model”

  • n_to_reject (int) – Number of neighboring frequencies for which the coherence must be above the 95% signifcance level in order to use for cleaning (0 means use all frequencies)

  • min_freq (float) – Do not process frequencies below this value

  • max_freq (float) – Do not process frequencies above this value

  • show_progress (bool) – Show progress plots

  • fast_calc (bool) – Calculate corrected spectra directly from previous spectra (ATACR-style).

  • kwargs (SpectralDensity.from_stream() properties) – window_s, windowtype, z_threshold, remove_eqs, avoid_spans, …

RFList

list of data cleaner frequency response functions

Type:

list of ResponseFunctions

starttimes

start times for each spectra used

Type:

list of obspy.UTCDateTime

avoided_spans (class

TimeSpans): avoided time spans

apply(stream, in_time_domain=False, set_dtype=True)

Apply DataCleaner to a data stream

Parameters:
  • stream (Stream) – list of channels to remove, in order

  • in_time_domain – do work in time domain (default is freq domain, time_domain is much slower)

Returns:

corrected data

Return type:

stream (obspy.core.stream.Stream)

Assumes frequency response function is for counts, not resp_corrected data.

apply_to_sdf(sdf)

Correct spectral density functions

Can only apply fast_calc method, because SpectralDensity object does not contain enough information to do otherwise

Parameters:

sdf (SpectralDensity) – data to apply to

Returns:

corrected spectral densities

Return type:

sdf (SpectralDensity)

apply_to_streams_sdf(stream, fast_calc=False, **kwargs)

Calculate corrected spectral density functions from an input stream

Applys the DataCleaner values to each FFT

Parameters:
  • stream (obspy.core.stream.Stream) – data to apply to

  • fast_calc (bool) – Calculate corrected spectra directly from previous spectra.

  • kwargs (dict) – keyword arguments for SpectralDensity.from_stream()

Returns:

corrected spectral density

functions

Return type:

sdf (SpectralDensity)

plot()

Plot data cleaning frequency response functions