Merge branch 'master' into alex

This commit is contained in:
Awendt 2023-01-13 16:04:13 +01:00
commit 41b75f1a68
2 changed files with 218 additions and 214 deletions

View File

@ -187,22 +187,9 @@ def main(datapath: str) -> None:
# start_index = t0 * data.samplerate # start_index = t0 * data.samplerate
# stop_index = (t0 + dt) * data.samplerate # stop_index = (t0 + dt) * data.samplerate
fig, axs = plt.subplots(
7,
2,
figsize=(20 / 2.54, 12 / 2.54),
constrained_layout=True,
sharex=True,
sharey='row',
)
# iterate through all fish # iterate through all fish
for i, track_id in enumerate(np.unique(ident[~np.isnan(ident)])[:2]): for i, track_id in enumerate(np.unique(ident[~np.isnan(ident)])[:2]):
# load region of interest of raw data file
data_oi = data[start_index:stop_index, :]
time_oi = raw_time[start_index:stop_index]
# get indices for time array in time window # get indices for time array in time window
window_index = np.arange(len(idx))[ window_index = np.arange(len(idx))[
(ident == track_id) & (time[idx] >= t0) & ( (ident == track_id) & (time[idx] >= t0) & (
@ -220,10 +207,25 @@ def main(datapath: str) -> None:
if len(freq_temp) < expected_duration * 0.9: if len(freq_temp) < expected_duration * 0.9:
continue continue
fig, axs = plt.subplots(
7,
config.electrodes,
figsize=(20 / 2.54, 12 / 2.54),
constrained_layout=True,
sharex=True,
sharey='row',
)
# get best electrode # get best electrode
electrode = np.argsort(np.nanmean(powers_temp, axis=0))[-1] best_electrodes = np.argsort(np.nanmean(
powers_temp, axis=0))[-config.electrodes:]
# <------------------------------------------ Iterate through electrodes # <------------------------------------------ Iterate through electrodes
for i, electrode in enumerate(best_electrodes):
# load region of interest of raw data file
data_oi = data[start_index:stop_index, :]
time_oi = raw_time[start_index:stop_index]
# plot wavetracker tracks to spectrogram # plot wavetracker tracks to spectrogram
# for track_id in np.unique(ident): # <---------- Find freq gaps later # for track_id in np.unique(ident): # <---------- Find freq gaps later
# here # here
@ -424,7 +426,8 @@ def main(datapath: str) -> None:
axs[3, i].set_title("Fitered above") axs[3, i].set_title("Fitered above")
axs[4, i].set_title("Filtered envelope of baseline envelope") axs[4, i].set_title("Filtered envelope of baseline envelope")
axs[5, i].set_title("Search envelope") axs[5, i].set_title("Search envelope")
axs[6, i].set_title("Filtered absolute instantaneous frequency") axs[6, i].set_title(
"Filtered absolute instantaneous frequency")
plt.show() plt.show()

View File

@ -1,6 +1,7 @@
# Duration and overlap of the analysis window in seconds # Duration and overlap of the analysis window in seconds
window: 5 window: 5
overlap: 0.5 overlap: 1
edges: 0.25
# Number of electrodes to go over # Number of electrodes to go over
electrodes: 3 electrodes: 3