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:
"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.
resampleuses polyphase filtering and reaches any target rate, higher or lower.downsampledecimates by integer factors. It only lowers the sampling rate.
Resample
pydantic-model
¶
Bases: BatchPreProcessing
Resample the traces to a new sampling frequency.
Fields:
-
stations(set[NSL]) -
process(Literal['resample']) -
sampling_frequency(PositiveFloat) -
n_threads(int) -
_thread_pool(ThreadPoolExecutor)
Validators:
sampling_frequency
pydantic-field
¶
sampling_frequency: PositiveFloat = 100.0
The new sampling frequency in Hz.
stations
pydantic-field
¶
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. |
Downsample
pydantic-model
¶
Bases: BatchPreProcessing
Downsample the traces to a new sampling frequency.
Fields:
-
stations(set[NSL]) -
process(Literal['downsample']) -
sampling_frequency(PositiveFloat) -
n_threads(int) -
_thread_pool(ThreadPoolExecutor)
Validators:
sampling_frequency
pydantic-field
¶
sampling_frequency: PositiveFloat = 100.0
The new sampling frequency in Hz.
stations
pydantic-field
¶
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. |
Frequency filters¶
Butterworth filters remove noise outside the frequency band of the earthquakes. With zero_phase, the bandpass does not shift the phase arrivals.
{
"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:
-
stations(set[NSL]) -
process(Literal['bandpass']) -
corners(int) -
bandpass(Range) -
demean(bool) -
zero_phase(bool)
Validators:
-
validate_stations→stations -
_check_bandpass→bandpass
bandpass
pydantic-field
¶
Lower and upper corner frequency of the bandpass in Hz.
stations
pydantic-field
¶
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. |
Highpass
pydantic-model
¶
Bases: BatchPreProcessing
Highpass filter waveform data.
Fields:
-
stations(set[NSL]) -
process(Literal['highpass']) -
corners(int) -
frequency(PositiveFloat) -
demean(bool)
Validators:
stations
pydantic-field
¶
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. |
Lowpass
pydantic-model
¶
Bases: BatchPreProcessing
Lowpass filter waveform data.
Fields:
-
stations(set[NSL]) -
process(Literal['lowpass']) -
corners(int) -
frequency(PositiveFloat) -
demean(bool)
Validators:
stations
pydantic-field
¶
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. |
Denoising¶
The DeepDenoiser neural network removes noise from the waveforms. It is slow; use it for noisy stations and run it on a GPU.
{
"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:
-
stations(set[NSL]) -
process(Literal['deep-denoiser']) -
model(DenoiserModels) -
torch_use_cuda(bool | str)
Validators:
torch_use_cuda
pydantic-field
¶
Use CUDA for the PyTorch model. A string selects the device.
stations
pydantic-field
¶
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. |