Skip to content

Commit

Permalink
MRG: #254 from vocalpy/remove-birdsongrec-exceptions
Browse files Browse the repository at this point in the history
Remove exceptions from birdsongrec.py
  • Loading branch information
NickleDave authored May 18, 2023
2 parents 14620cf + c228040 commit 3500c19
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/crowsetta/birdsongrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ def birdsongrec2annot(annot_path='Annotation.xml', concat_seqs_into_songs=True,
else:
wavpath = Path(wavpath)

if not wavpath.exists():
raise NotADirectoryError(
"Value specified for 'wavpath' not recognized as an existing directory."
f"\nValue for 'wavpath' was: {wavpath}"
)

# `birdsong-recongition-dataset` also has a 'Sequence' class
# but it is slightly different from the `generic.Sequence` used by `crowsetta`
seq_list_xml = birdsongrec.parse_xml(annot_path,
Expand All @@ -88,11 +82,7 @@ def birdsongrec2annot(annot_path='Annotation.xml', concat_seqs_into_songs=True,

wav_filename = os.path.join(wavpath, seq_xml.wav_file)
wav_filename = os.path.abspath(wav_filename)
if not os.path.isfile(wav_filename):
raise FileNotFoundError(
f'.wav file {wav_filename} specified in '
f'annotation file {annot_path} is not found'
)

samp_freq = soundfile.info(wav_filename).samplerate
onsets_s = np.round(onset_inds / samp_freq, decimals=3)
offsets_s = np.round(offset_inds / samp_freq, decimals=3)
Expand Down

0 comments on commit 3500c19

Please sign in to comment.