final peak version with bool
This commit is contained in:
parent
7034e9421b
commit
844f65e24e
@ -12,7 +12,7 @@ from sklearn.preprocessing import normalize
|
|||||||
from modules.filters import bandpass_filter, envelope, highpass_filter
|
from modules.filters import bandpass_filter, envelope, highpass_filter
|
||||||
from modules.filehandling import ConfLoader, LoadData
|
from modules.filehandling import ConfLoader, LoadData
|
||||||
from modules.plotstyle import PlotStyle
|
from modules.plotstyle import PlotStyle
|
||||||
from modules.timestamps import group_timestamps, group_timestamp_v2
|
from modules.timestamps import group_timestamps, group_timestamps_v2
|
||||||
|
|
||||||
ps = PlotStyle()
|
ps = PlotStyle()
|
||||||
|
|
||||||
@ -527,6 +527,7 @@ def main(datapath: str) -> None:
|
|||||||
if len(baseline_ts) == 0 or len(search_ts) == 0 or len(freq_ts) == 0:
|
if len(baseline_ts) == 0 or len(search_ts) == 0 or len(freq_ts) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
# get index for each feature
|
# get index for each feature
|
||||||
baseline_idx = np.zeros_like(baseline_ts)
|
baseline_idx = np.zeros_like(baseline_ts)
|
||||||
search_idx = np.ones_like(search_ts)
|
search_idx = np.ones_like(search_ts)
|
||||||
@ -562,6 +563,7 @@ def main(datapath: str) -> None:
|
|||||||
bool_timestamps[cm] = False
|
bool_timestamps[cm] = False
|
||||||
|
|
||||||
# for checking if there are chirps on multiple electrodes
|
# for checking if there are chirps on multiple electrodes
|
||||||
|
|
||||||
chirps_electrodes.append(current_chirps)
|
chirps_electrodes.append(current_chirps)
|
||||||
|
|
||||||
for ct in current_chirps:
|
for ct in current_chirps:
|
||||||
@ -598,19 +600,21 @@ def main(datapath: str) -> None:
|
|||||||
# make index vector
|
# make index vector
|
||||||
index_vector = np.arange(len(sort_chirps_electrodes))
|
index_vector = np.arange(len(sort_chirps_electrodes))
|
||||||
# make it more than only two electrodes for the search after chirps
|
# make it more than only two electrodes for the search after chirps
|
||||||
combinations_best_elctrodes = list(itertools.combinations(range(3), 2))
|
combinations_best_elctrodes = list(
|
||||||
|
itertools.combinations(range(3), 2))
|
||||||
|
|
||||||
the_real_chirps = []
|
the_real_chirps = []
|
||||||
for chirp_index, seoc in enumerate(sort_chirps_electrodes):
|
for chirp_index, seoc in enumerate(sort_chirps_electrodes):
|
||||||
if bool_vector[chirp_index] == False:
|
if bool_vector[chirp_index] == False:
|
||||||
continue
|
continue
|
||||||
cm = index_vector[(sort_chirps_electrodes >= seoc) & (
|
cm = index_vector[(sort_chirps_electrodes >= seoc) & (
|
||||||
sort_chirps_electrodes <= seoc + config.chirp_window_threshold)]
|
sort_chirps_electrodes <= seoc + config.chirp_window_threshold)]
|
||||||
|
|
||||||
for combination in combinations_best_elctrodes:
|
for combination in combinations_best_elctrodes:
|
||||||
if set(combination).issubset(sort_electrodes[cm]):
|
if set(combination).issubset(sort_electrodes[cm]):
|
||||||
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
the_real_chirps.append(
|
||||||
"""
|
np.mean(sort_chirps_electrodes[cm]))
|
||||||
|
|
||||||
if set([0,1]).issubset(sort_electrodes[cm]):
|
if set([0,1]).issubset(sort_electrodes[cm]):
|
||||||
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
||||||
elif set([1,0]).issubset(sort_electrodes[cm]):
|
elif set([1,0]).issubset(sort_electrodes[cm]):
|
||||||
@ -619,7 +623,6 @@ def main(datapath: str) -> None:
|
|||||||
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
||||||
elif set([1,2]).issubset(sort_electrodes[cm]):
|
elif set([1,2]).issubset(sort_electrodes[cm]):
|
||||||
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
the_real_chirps.append(np.mean(sort_chirps_electrodes[cm]))
|
||||||
"""
|
|
||||||
|
|
||||||
bool_vector[cm] = False
|
bool_vector[cm] = False
|
||||||
for ct in the_real_chirps:
|
for ct in the_real_chirps:
|
||||||
|
@ -82,6 +82,7 @@ def group_timestamps_v2(sublists: List[List[Union[int, float]]], n: int, time_th
|
|||||||
current_group = []
|
current_group = []
|
||||||
# Create a set to store the timestamps that occur in at least n of the sublists
|
# Create a set to store the timestamps that occur in at least n of the sublists
|
||||||
common_timestamps = set.intersection(*[set(lst) for lst in sublists])
|
common_timestamps = set.intersection(*[set(lst) for lst in sublists])
|
||||||
|
embed()
|
||||||
# Iterate through the timestamps
|
# Iterate through the timestamps
|
||||||
for i in range(len(common_timestamps)):
|
for i in range(len(common_timestamps)):
|
||||||
# If the current timestamp is less than 50 milliseconds away from the previous timestamp
|
# If the current timestamp is less than 50 milliseconds away from the previous timestamp
|
||||||
|
Loading…
Reference in New Issue
Block a user