better chirpdetector
This commit is contained in:
parent
6193dab97d
commit
5763e807d0
@ -886,25 +886,25 @@ def chirpdetection(datapath: str, plot: str, debug: str = 'false') -> None:
|
|||||||
# normalize all three feature arrays to the same range to make
|
# normalize all three feature arrays to the same range to make
|
||||||
# peak detection simpler
|
# peak detection simpler
|
||||||
|
|
||||||
baseline_envelope = minmaxnorm([baseline_envelope])[0]
|
# baseline_envelope = minmaxnorm([baseline_envelope])[0]
|
||||||
search_envelope = minmaxnorm([search_envelope])[0]
|
# search_envelope = minmaxnorm([search_envelope])[0]
|
||||||
baseline_frequency_filtered = minmaxnorm(
|
# baseline_frequency_filtered = minmaxnorm(
|
||||||
[baseline_frequency_filtered]
|
# [baseline_frequency_filtered]
|
||||||
)[0]
|
# )[0]
|
||||||
|
|
||||||
# PEAK DETECTION ----------------------------------------------
|
# PEAK DETECTION ----------------------------------------------
|
||||||
|
|
||||||
# detect peaks baseline_enelope
|
# detect peaks baseline_enelope
|
||||||
baseline_peak_indices, _ = find_peaks(
|
baseline_peak_indices, _ = find_peaks(
|
||||||
baseline_envelope, prominence=config.prominence
|
baseline_envelope, prominence=config.baseline_prominence
|
||||||
)
|
)
|
||||||
# detect peaks search_envelope
|
# detect peaks search_envelope
|
||||||
search_peak_indices, _ = find_peaks(
|
search_peak_indices, _ = find_peaks(
|
||||||
search_envelope, prominence=config.prominence
|
search_envelope, prominence=config.search_prominence
|
||||||
)
|
)
|
||||||
# detect peaks inst_freq_filtered
|
# detect peaks inst_freq_filtered
|
||||||
frequency_peak_indices, _ = find_peaks(
|
frequency_peak_indices, _ = find_peaks(
|
||||||
baseline_frequency_filtered, prominence=config.prominence
|
baseline_frequency_filtered, prominence=config.frequency_prominence
|
||||||
)
|
)
|
||||||
|
|
||||||
# DETECT CHIRPS IN SEARCH WINDOW ------------------------------
|
# DETECT CHIRPS IN SEARCH WINDOW ------------------------------
|
||||||
@ -1097,4 +1097,4 @@ if __name__ == "__main__":
|
|||||||
datapath = "../data/2022-06-02-10_00/"
|
datapath = "../data/2022-06-02-10_00/"
|
||||||
# datapath = "/home/weygoldt/Data/uni/efishdata/2016-colombia/fishgrid/2016-04-09-22_25/"
|
# datapath = "/home/weygoldt/Data/uni/efishdata/2016-colombia/fishgrid/2016-04-09-22_25/"
|
||||||
# datapath = "/home/weygoldt/Data/uni/chirpdetection/GP2023_chirp_detection/data/mount_data/2020-03-13-10_00/"
|
# datapath = "/home/weygoldt/Data/uni/chirpdetection/GP2023_chirp_detection/data/mount_data/2020-03-13-10_00/"
|
||||||
chirpdetection(datapath, plot="show", debug="fish")
|
chirpdetection(datapath, plot="show", debug="false")
|
||||||
|
@ -1,47 +1,41 @@
|
|||||||
# directory setup
|
# Path setup ------------------------------------------------------------------
|
||||||
dataroot: "../data/"
|
|
||||||
outputdir: "../output/"
|
|
||||||
|
|
||||||
# Duration and overlap of the analysis window in seconds
|
dataroot: "../data/" # path to data
|
||||||
window: 5
|
outputdir: "../output/" # path to save plots to
|
||||||
overlap: 1
|
|
||||||
edge: 0.25
|
|
||||||
|
|
||||||
# Number of electrodes to go over
|
# Rolling window parameters ---------------------------------------------------
|
||||||
number_electrodes: 3
|
|
||||||
minimum_electrodes: 2
|
|
||||||
|
|
||||||
# Search window bandwidth and minimal baseline bandwidth
|
window: 5 # rolling window length in seconds
|
||||||
minimal_bandwidth: 20
|
overlap: 1 # window overlap in seconds
|
||||||
|
edge: 0.25 # window edge cufoffs to mitigate filter edge effects
|
||||||
|
|
||||||
# Instantaneous frequency smoothing usint a gaussian kernel of this width
|
# Electrode iteration parameters ----------------------------------------------
|
||||||
baseline_frequency_smoothing: 5
|
|
||||||
|
|
||||||
# Baseline processing parameters
|
number_electrodes: 2 # number of electrodes to go over
|
||||||
baseline_envelope_cutoff: 25
|
minimum_electrodes: 1 # mimumun number of electrodes a chirp must be on
|
||||||
baseline_envelope_bandpass_lowf: 2
|
|
||||||
baseline_envelope_bandpass_highf: 100
|
|
||||||
# baseline_envelope_envelope_cutoff: 4
|
|
||||||
|
|
||||||
# search envelope processing parameters
|
# Feature extraction parameters -----------------------------------------------
|
||||||
search_envelope_cutoff: 10
|
|
||||||
|
|
||||||
# Instantaneous frequency bandpass filter cutoff frequencies
|
search_df_lower: 20 # start searching this far above the baseline
|
||||||
# baseline_frequency_highpass_cutoff: 0.000005
|
search_df_upper: 100 # stop searching this far above the baseline
|
||||||
# baseline_frequency_envelope_cutoff: 0.000005
|
search_res: 1 # search window resolution
|
||||||
|
default_search_freq: 60 # search here if no need for a search frequency
|
||||||
|
minimal_bandwidth: 10 # minimal bandpass filter width for baseline
|
||||||
|
search_bandwidth: 10 # minimal bandpass filter width for search frequency
|
||||||
|
baseline_frequency_smoothing: 10 # instantaneous frequency smoothing
|
||||||
|
|
||||||
# peak detecion parameters
|
# Feature processing parameters -----------------------------------------------
|
||||||
prominence: 0.7
|
|
||||||
|
|
||||||
# search freq parameter
|
baseline_envelope_cutoff: 25 # envelope estimation cutoff
|
||||||
search_df_lower: 20
|
baseline_envelope_bandpass_lowf: 2 # envelope badpass lower cutoff
|
||||||
search_df_upper: 100
|
baseline_envelope_bandpass_highf: 100 # envelope bandbass higher cutoff
|
||||||
search_res: 1
|
search_envelope_cutoff: 10 # search envelope estimation cufoff
|
||||||
search_bandwidth: 20
|
|
||||||
default_search_freq: 60
|
|
||||||
|
|
||||||
# Classify events as chirps if they are less than this time apart
|
|
||||||
chirp_window_threshold: 0.015
|
|
||||||
|
|
||||||
|
# Peak detecion parameters ----------------------------------------------------
|
||||||
|
baseline_prominence: 0.00005 # peak prominence threshold for baseline envelope
|
||||||
|
search_prominence: 0.000004 # peak prominence threshold for search envelope
|
||||||
|
frequency_prominence: 2 # peak prominence threshold for baseline freq
|
||||||
|
|
||||||
|
# Classify events as chirps if they are less than this time apart
|
||||||
|
chirp_window_threshold: 0.02
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from IPython import embed
|
|||||||
def main(datapaths):
|
def main(datapaths):
|
||||||
|
|
||||||
for path in datapaths:
|
for path in datapaths:
|
||||||
chirpdetection(path, plot='show', debug='electrode')
|
chirpdetection(path, plot='show')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -43,6 +43,6 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
recs = pd.DataFrame(columns=['recording'], data=valid_datasets)
|
recs = pd.DataFrame(columns=['recording'], data=valid_datasets)
|
||||||
recs.to_csv('../recs.csv', index=False)
|
recs.to_csv('../recs.csv', index=False)
|
||||||
# main(datapaths)
|
main(datapaths)
|
||||||
|
|
||||||
# window 1524 + 244 in dataset index 4 is nice example
|
# window 1524 + 244 in dataset index 4 is nice example
|
||||||
|
Loading…
Reference in New Issue
Block a user