-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Added a test to check that detections above the nyquist freq a…
…re excluded
- Loading branch information
1 parent
14aefaf
commit 986cfc4
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Test suite to ensure that model detections are not incorrect.""" | ||
|
||
import os | ||
|
||
from batdetect2 import api | ||
|
||
DATA_DIR = os.path.join(os.path.dirname(__file__), "data") | ||
|
||
|
||
def test_no_detections_above_nyquist(): | ||
"""Test that no detections are made above the nyquist frequency.""" | ||
# Recording donated by @@kdarras | ||
path = os.path.join(DATA_DIR, "20230322_172000_selec2.wav") | ||
|
||
# This recording has a sampling rate of 192 kHz | ||
nyquist = 192_000 / 2 | ||
|
||
output = api.process_file(path) | ||
predictions = output["pred_dict"] | ||
assert len(predictions["annotation"]) != 0 | ||
assert all( | ||
pred["high_freq"] < nyquist for pred in predictions["annotation"] | ||
) |