Skip to content

Pre-processing

Before the image function annotates the waveforms, Qseek pre-processes them. pre_processing is a list of steps, applied in order. By default, the waveforms are resampled to 100 Hz and bandpass filtered between 0.5 and 30 Hz:

Default pre-processing
"pre_processing": [
  {"process": "resample", "sampling_frequency": 100.0},
  {"process": "bandpass", "bandpass": [0.5, 30.0]}
]

Each step applies to all stations, or only to the station codes in its stations list.

Resampling

The image function needs one sampling rate for all stations. If your stations record at different rates, resample them.

  • resample uses polyphase filtering and reaches any target rate, higher or lower.
  • downsample decimates by integer factors. It only lowers the sampling rate.
Resample
{
  "process": "resample",
  "stations": [],
  "sampling_frequency": 100.0,
  "n_threads": 8
}

Resample pydantic-model

Bases: BatchPreProcessing

Resample the traces to a new sampling frequency.

Fields:

Validators:

sampling_frequency pydantic-field

sampling_frequency: PositiveFloat = 100.0

The new sampling frequency in Hz.

n_threads pydantic-field

n_threads: int = 8

The number of threads to use for resampling.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.

prepare async

prepare() -> None

Prepare the pre-processing module.

Downsample
{
  "process": "downsample",
  "stations": [],
  "sampling_frequency": 100.0,
  "n_threads": 8
}

Downsample pydantic-model

Bases: BatchPreProcessing

Downsample the traces to a new sampling frequency.

Fields:

Validators:

sampling_frequency pydantic-field

sampling_frequency: PositiveFloat = 100.0

The new sampling frequency in Hz.

n_threads pydantic-field

n_threads: int = 8

The number of threads to use for downsampling.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.

prepare async

prepare() -> None

Prepare the pre-processing module.

Frequency filters

Butterworth filters remove noise outside the frequency band of the earthquakes. With zero_phase, the bandpass does not shift the phase arrivals.

Bandpass
{
  "process": "bandpass",
  "stations": [],
  "corners": 4,
  "bandpass": [
    0.5,
    30.0
  ],
  "demean": true,
  "zero_phase": true
}

Bandpass pydantic-model

Bases: BatchPreProcessing

Bandpass filter waveform data.

Fields:

Validators:

corners pydantic-field

corners: int = 4

Number of corners for the filter.

bandpass pydantic-field

bandpass: Range = Range(0.5, 30.0)

Lower and upper corner frequency of the bandpass in Hz.

demean pydantic-field

demean: bool = True

If True, demean the trace before filtering.

zero_phase pydantic-field

zero_phase: bool = True

If True, apply zero-phase filtering.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.

prepare async

prepare() -> None

Prepare the pre-processing module.

Highpass
{
  "process": "highpass",
  "stations": [],
  "corners": 4,
  "frequency": 0.1,
  "demean": true
}

Highpass pydantic-model

Bases: BatchPreProcessing

Highpass filter waveform data.

Fields:

Validators:

corners pydantic-field

corners: int = 4

Number of corners for the filter.

frequency pydantic-field

frequency: PositiveFloat = 0.1

Corner frequency of the highpass in Hz.

demean pydantic-field

demean: bool = True

If True, demean the trace before filtering.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.

prepare async

prepare() -> None

Prepare the pre-processing module.

Lowpass
{
  "process": "lowpass",
  "stations": [],
  "corners": 4,
  "frequency": 0.1,
  "demean": true
}

Lowpass pydantic-model

Bases: BatchPreProcessing

Lowpass filter waveform data.

Fields:

Validators:

corners pydantic-field

corners: int = 4

Number of corners for the filter.

frequency pydantic-field

frequency: PositiveFloat = 0.1

Corner frequency of the lowpass in Hz.

demean pydantic-field

demean: bool = True

If True, demean the trace before filtering.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.

prepare async

prepare() -> None

Prepare the pre-processing module.

Denoising

The DeepDenoiser neural network removes noise from the waveforms. It is slow; use it for noisy stations and run it on a GPU.

DeepDenoiser
{
  "process": "deep-denoiser",
  "stations": [],
  "model": "original",
  "torch_use_cuda": false
}

DeepDenoiser pydantic-model

Bases: BatchPreProcessing

De-noise the traces using the DeepDenoiser neural network (slow).

Fields:

Validators:

model pydantic-field

model: DenoiserModels = 'original'

The model to use for denoising.

torch_use_cuda pydantic-field

torch_use_cuda: bool | str = False

Use CUDA for the PyTorch model. A string selects the device.

stations pydantic-field

stations: set[NSL] = set()

List of station codes to process. E.g. ['6E.BFO', '6E.BHZ']. If empty, all stations are processed.

get_subclasses classmethod

get_subclasses() -> tuple[type[BatchPreProcessing], ...]

Returns a tuple of all the subclasses of BasePreProcessing.

filter_traces

filter_traces(batch: WaveformBatch) -> list[Trace]

Selects traces from the given list based on the stations specified.

Parameters:

Name Type Description Default
batch WaveformBatch

The batch of traces to select from.

required

Returns:

Type Description
list[Trace]

list[Trace]: The selected traces.