Skip to content

Commit

Permalink
Add no_photodiode keyword [skip CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhardcastle committed Oct 1, 2024
1 parent d335fa2 commit 8f02890
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/npc_sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ def keywords(self) -> list[str]:
self.keywords.append("late_autorewards")
elif self.is_task:
self.keywords.append("early_autorewards")
if self.is_task and not getattr(self, "is_photodiode"):
self.keywords.append("no_photodiode")
for t in self.epoch_tags:
if t not in self.keywords:
self.keywords.append(t)
Expand Down Expand Up @@ -1986,6 +1988,19 @@ def is_templeton(self) -> bool:
"Not enough information to tell if this is a Templeton session"
)

@npc_io.cached_property
def is_photodiode(self) -> bool:
"""Do frame times from sync use photodiode info for the task data?
- in cases where diode signal is unreliable, we use vsync + constant
monitor lag to estimate frame times
"""
if not self.is_task:
raise AttributeError(f"{self.id} is not a session with behavior task")
task_frame_times = next(v for k,v in self.stim_frame_times if self.task_stim_name in k)
return any(np.array_equal(task_frame_times, array) for array in self.sync_data.constant_lag_frame_display_time_blocks)


# helper properties -------------------------------------------------------- #

@npc_io.cached_property
Expand Down

0 comments on commit 8f02890

Please sign in to comment.