Skip to content

Commit

Permalink
add bandpass
Browse files Browse the repository at this point in the history
  • Loading branch information
kahst committed Feb 16, 2024
1 parent 983222d commit ee586ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ Here's a complete list of all command line arguments:
--overlap, Overlap of prediction segments. Values in [0.0, 2.9]. Defaults to 0.0.
--threads, Number of CPU threads.
--batchsize, Number of samples to process at the same time. Defaults to 1.
--fmin and --fmax, Minimum and maximum frequency for bandpass filter. Defaults to 0 and 15000.
----
+
. After the analysis, run `segments.py` to extract short audio segments for species detections to verify results.
Expand Down
16 changes: 16 additions & 0 deletions embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ def analyzeFile(item):
parser.add_argument(
"--batchsize", type=int, default=1, help="Number of samples to process at the same time. Defaults to 1."
)
parser.add_argument(
"--fmin",
type=int,
default=cfg.SIG_FMIN,
help="Minimum frequency for bandpass filter in Hz. Defaults to {} Hz.".format(cfg.SIG_FMIN)
)
parser.add_argument(
"--fmax",
type=int,
default=cfg.SIG_FMAX,
help="Maximum frequency for bandpass filter in Hz. Defaults to {} Hz.".format(cfg.SIG_FMAX)
)

args = parser.parse_args()

Expand All @@ -165,6 +177,10 @@ def analyzeFile(item):
# Set overlap
cfg.SIG_OVERLAP = max(0.0, min(2.9, float(args.overlap)))

# Set bandpass frequency range
cfg.BANDPASS_FMIN = max(0, min(cfg.SIG_FMAX, int(args.fmin)))
cfg.BANDPASS_FMAX = max(cfg.SIG_FMIN, min(cfg.SIG_FMAX, int(args.fmax)))

# Set number of threads
if os.path.isdir(cfg.INPUT_PATH):
cfg.CPU_THREADS = int(args.threads)
Expand Down

0 comments on commit ee586ae

Please sign in to comment.