mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-04-04 15:20:19 +02:00
Update audio loader docstrings
This commit is contained in:
parent
ce952e364b
commit
bfc88a4a0f
@ -74,9 +74,9 @@ class AudioLoader(Protocol):
|
|||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
xr.DataArray
|
np.ndarray
|
||||||
The loaded and preprocessed audio waveform. Typically loads only
|
The loaded and preprocessed audio waveform as a 1-D NumPy
|
||||||
the first channel.
|
array. Typically loads only the first channel.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
------
|
------
|
||||||
@ -105,9 +105,10 @@ class AudioLoader(Protocol):
|
|||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
xr.DataArray
|
np.ndarray
|
||||||
The loaded and preprocessed audio waveform for the specified clip
|
The loaded and preprocessed audio waveform for the specified
|
||||||
duration. Typically loads only the first channel.
|
clip duration as a 1-D NumPy array. Typically loads only the
|
||||||
|
first channel.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
------
|
------
|
||||||
@ -147,4 +148,21 @@ class PreprocessorProtocol(Protocol):
|
|||||||
def process_spectrogram(self, spec: torch.Tensor) -> torch.Tensor: ...
|
def process_spectrogram(self, spec: torch.Tensor) -> torch.Tensor: ...
|
||||||
|
|
||||||
def process_numpy(self, wav: np.ndarray) -> np.ndarray:
|
def process_numpy(self, wav: np.ndarray) -> np.ndarray:
|
||||||
|
"""Run the full preprocessing pipeline on a NumPy waveform.
|
||||||
|
|
||||||
|
This default implementation converts the array to a
|
||||||
|
``torch.Tensor``, calls :meth:`__call__`, and converts the
|
||||||
|
result back to a NumPy array. Concrete implementations may
|
||||||
|
override this for efficiency.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
wav : np.ndarray
|
||||||
|
Input waveform as a 1-D NumPy array.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
np.ndarray
|
||||||
|
Preprocessed spectrogram as a NumPy array.
|
||||||
|
"""
|
||||||
return self(torch.tensor(wav)).numpy()
|
return self(torch.tensor(wav)).numpy()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user