Skip to content

Commit

Permalink
Merge pull request #379 from ttngu207/datajoint_pipeline
Browse files Browse the repository at this point in the history
add patch_threshold at BlockSubjectAnalysis
  • Loading branch information
ttngu207 authored Jul 8, 2024
2 parents 5cbd091 + caca2e6 commit 88e5ecd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions aeon/dj_pipeline/analysis/block_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def make(self, key):
patch_rate = depletion_state_df.rate.iloc[0]
patch_offset = depletion_state_df.offset.iloc[0]

# handles patch rate value being INF
patch_rate = 999999999 if np.isinf(patch_rate) else patch_rate

self.Patch.insert1(
{
**key,
Expand Down Expand Up @@ -335,6 +338,7 @@ class Patch(dj.Part):
in_patch_time: float # total seconds spent in this patch for this block
pellet_count: int
pellet_timestamps: longblob
patch_threshold: longblob # patch threshold value at each pellet delivery
wheel_cumsum_distance_travelled: longblob # wheel's cumulative distance travelled
"""

Expand Down Expand Up @@ -478,6 +482,9 @@ def make(self, key):
"cum_time"
] = subject_in_patch_cum_time
subj_pellets = closest_subjects_pellet_ts[closest_subjects_pellet_ts == subject_name]

subj_patch_thresh = patch["patch_threshold"][np.searchsorted(patch["patch_threshold_timestamps"], subj_pellets.index.values) - 1]

self.Patch.insert1(
key
| dict(
Expand All @@ -487,6 +494,7 @@ def make(self, key):
in_patch_time=subject_in_patch_cum_time[-1],
pellet_count=len(subj_pellets),
pellet_timestamps=subj_pellets.index.values,
patch_threshold=subj_patch_thresh,
wheel_cumsum_distance_travelled=cum_wheel_dist_subj_df[subject_name].values,
)
)
Expand Down

0 comments on commit 88e5ecd

Please sign in to comment.