From 9bc13294d8ece6c3c5d7458c0a7a3b87a454ef3d Mon Sep 17 00:00:00 2001 From: sprause Date: Thu, 19 Jan 2023 16:14:00 +0100 Subject: [PATCH] sort chirps and chirp ids in time --- code/behavior.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/behavior.py b/code/behavior.py index 57362e2..e6aad6a 100644 --- a/code/behavior.py +++ b/code/behavior.py @@ -53,8 +53,6 @@ class Behavior: self.start_s = (self.start_s - shift) / factor self.stop_s = (self.stop_s - shift) / factor - - """ 1 - chasing onset 2 - chasing offset @@ -83,9 +81,14 @@ temporal encpding needs to be corrected ... not exactly 25FPS. """ def main(datapath: str): - # behabvior is pandas dataframe with all the data + + # behavior is pandas dataframe with all the data bh = Behavior(datapath) + # chirps are not sorted in time (presumably due to prior groupings) + # sort chirps and corresponding fish_ids of the chirps + bh.chirps = bh.chirps[np.argsort(bh.chirps)] + bh.chirps_ids = bh.chirps_ids[np.argsort(bh.chirps)] fig, ax = plt.subplots() ax.plot(bh.chirps, np.ones_like(bh.chirps), marker='o')