From d804d781c6b39dfbd8feb8960f3a436b22b805ca Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Sun, 1 Jun 2025 19:40:39 +0200 Subject: [PATCH] wip --- process | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/process b/process index 3c35ecf..bc8d198 100755 --- a/process +++ b/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)