scatseisnet.operation#
Miscellaneous operations for scatseisnet.
This module contains miscellaneous operations for scatseisnet, such as segmentation and pooling.
Terms of use
Copyright (C) 2021 Léonard Seydoux.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.
Functions#
|
Segment array into overlapping windows. |
|
Segment array into overlapping windows. |
|
Pooling operation performed on the last axis. |
Module Contents#
- scatseisnet.operation.segment(x: numpy.ndarray, window_size: int, stride: int | None = None) Generator[numpy.ndarray, None, None][source]#
Segment array into overlapping windows.
- Parameters:
x (
numpy.ndarray) – Array to segment.window_size (int) – Sliding window size in numpy of points
stride (int, optional) – Sliding window stride in numpy of points. If None, stride is equal to window_size.
- Yields:
The elements of the segmented array.
- scatseisnet.operation.segmentize(x: numpy.ndarray, window_size: int, stride: int | None = None) numpy.ndarray[source]#
Segment array into overlapping windows.
- Parameters:
x (
numpy.ndarray) – Array to segment.window_size (int) – Sliding window size in numpy of points
stride (int, optional) – Sliding window stride in numpy of points. If None, stride is equal to window_size.
- Return type:
The segmented array with shape
(n_windows, n_channels, n_times).
- scatseisnet.operation.pool(x: numpy.ndarray, reduce_type: Callable | None = None) numpy.ndarray[source]#
Pooling operation performed on the last axis.
- Parameters:
x (
numpy.ndarray) – The input data to pool.reduce_type (callable, optional) – The reducing operation (e.g.
numpy.mean()). If None, no operation is performed.
- Returns:
pooled – The data pooled with same shape of input data minus last dimension.
- Return type: