Skip to content

Commit 8f02890

Browse files
committed
Add no_photodiode keyword [skip CI]
1 parent d335fa2 commit 8f02890

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/npc_sessions/sessions.py

+15
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ def keywords(self) -> list[str]:
655655
self.keywords.append("late_autorewards")
656656
elif self.is_task:
657657
self.keywords.append("early_autorewards")
658+
if self.is_task and not getattr(self, "is_photodiode"):
659+
self.keywords.append("no_photodiode")
658660
for t in self.epoch_tags:
659661
if t not in self.keywords:
660662
self.keywords.append(t)
@@ -1986,6 +1988,19 @@ def is_templeton(self) -> bool:
19861988
"Not enough information to tell if this is a Templeton session"
19871989
)
19881990

1991+
@npc_io.cached_property
1992+
def is_photodiode(self) -> bool:
1993+
"""Do frame times from sync use photodiode info for the task data?
1994+
1995+
- in cases where diode signal is unreliable, we use vsync + constant
1996+
monitor lag to estimate frame times
1997+
"""
1998+
if not self.is_task:
1999+
raise AttributeError(f"{self.id} is not a session with behavior task")
2000+
task_frame_times = next(v for k,v in self.stim_frame_times if self.task_stim_name in k)
2001+
return any(np.array_equal(task_frame_times, array) for array in self.sync_data.constant_lag_frame_display_time_blocks)
2002+
2003+
19892004
# helper properties -------------------------------------------------------- #
19902005

19912006
@npc_io.cached_property

0 commit comments

Comments
 (0)