Commit 865d0679 authored by Oliver Kirsebom's avatar Oliver Kirsebom
Browse files

Added FAV threshold filter

parent 8d175762
......@@ -16,7 +16,7 @@ import ketos.data_handling.parsing as pa
from ketos.audio_processing.audio import AudioSignal, TimeStampedAudioSignal
from ketos.audio_processing.spectrogram import MagSpectrogram
from ketos.data_handling.data_handling import AudioSequenceReader
from ketos.audio_processing.spectrogram_filters import FrequencyFilter, WindowFilter, WindowSubtractionFilter, CroppingFilter, HarmonicFilter
from ketos.audio_processing.spectrogram_filters import FrequencyFilter, WindowFilter, WindowSubtractionFilter, CroppingFilter, HarmonicFilter, FAVFilter, FAVThresholdFilter
import time
from collections import namedtuple
from pint import UnitRegistry # SI units
......@@ -78,6 +78,14 @@ def parse_config(path):
elif x == 'HARMONIC':
f = HarmonicFilter()
filters.append(f)
elif x == 'FAV':
f = FAVFilter()
filters.append(f)
elif x == 'FAV_THRESHOLD':
f = FAVThresholdFilter()
filters.append(f)
else:
print('Warning: Unknown filter {0} will be ignored'.format(x))
# spectrogram
spectr_config = pa.parse_spectrogram_configuration(data['spectrogram'])
......@@ -270,12 +278,20 @@ def main(config_file=None, input_dir=None, output_file=None, show_graph=None, sa
elapsed_time = time.time() - start_time
print(time.strftime(" Elapsed time: %H:%M:%S", time.gmtime(elapsed_time)))
# number of columns
N = len(filtered_data.columns)
# plot
if save_graph or show_graph:
ax = plt.gca()
ax.set_xlabel('Time')
ax.set_ylabel('Filtered signal')
filtered_data.plot(y=filtered_data.columns, ax=ax)
if N < 10:
filtered_data.plot(y=filtered_data.columns, ax=ax)
else:
img = np.log10(filtered_data.to_numpy())
img_plot = ax.imshow(img.T, aspect='auto', origin='lower', extent=(0, 1, 0, 1))
if save_graph:
fname = output_file[:output_file.rfind('.')] + '.png'
plt.savefig(fname)
......
......@@ -9,7 +9,7 @@ setup(name='boat_detector',
license='GNU General Public License v3.0',
packages=find_packages(),
install_requires=[
'ketos==1.0.1',
'ketos==1.0.2',
],
entry_points = {"console_scripts": ["audio-filterer=bin.audio_filterer:main", "anomaly-detector=bin.anomaly_detector:main"]},
include_package_data=True,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment