wip
This commit is contained in:
parent
3b483805df
commit
d804d781c6
1 changed files with 5 additions and 4 deletions
9
process
9
process
|
@ -99,6 +99,7 @@ def process_recording(filename):
|
|||
# not detecting an event
|
||||
if current_event:
|
||||
duration = (current_event['end_at'] - current_event['start_at']).total_seconds()
|
||||
current_event['duration'] = duration
|
||||
print(f'🔊 {current_event['start_at'].strftime('%Y-%m-%d %H:%M:%S')} ({duration:.1f}s): {current_event['start_freq']:.1f}Hz->{current_event['end_freq']:.1f}Hz @{current_event['max_amplitude']:.0f}rDB')
|
||||
|
||||
write_event(current_event=current_event, sound=sound, samplerate=samplerate)
|
||||
|
@ -124,10 +125,10 @@ def write_event(current_event, sound, samplerate):
|
|||
# write spectrogram
|
||||
plt.figure(figsize=(8, 6))
|
||||
plt.specgram(event_clip, Fs=samplerate, NFFT=samplerate, noverlap=samplerate//2, cmap='inferno', vmin=-100, vmax=-10)
|
||||
plt.title(f"Bootshorn @{event.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
plt.xlabel("Time (s)")
|
||||
plt.ylabel("Frequency (Hz)")
|
||||
plt.colorbar(label="Intensity (dB)")
|
||||
plt.title(f"Bootshorn @{event.strftime('%Y-%m-%d %H:%M:%S%z')}")
|
||||
plt.xlabel(f"Time {current_event['duration']:.1f}s")
|
||||
plt.ylabel(f"Frequency {current_event['start_freq']:.1f}Hz -> {current_event['end_freq']:.1f}Hz")
|
||||
plt.colorbar(label="Intensity (rDB)")
|
||||
plt.ylim(50, 1000)
|
||||
spectrogram_path = os.path.join(DETECTIONS_DIR, f"{filename_prefix}.png")
|
||||
plt.savefig(spectrogram_path)
|
||||
|
|
Loading…
Reference in a new issue