From 9628b669d4ec652851b002a6034d93f9bf2f616a Mon Sep 17 00:00:00 2001 From: bjhardcastle Date: Fri, 22 Nov 2024 15:16:10 -0800 Subject: [PATCH] Fix subject attribute bug --- src/npc_sessions/sessions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/npc_sessions/sessions.py b/src/npc_sessions/sessions.py index 00d9793..d3b4c45 100644 --- a/src/npc_sessions/sessions.py +++ b/src/npc_sessions/sessions.py @@ -1982,7 +1982,9 @@ def is_naive(self) -> bool: @property def is_stage_5_passed(self) -> bool: - """Before this session, had the subject passed stage 5 (two sessions meeting crossmodal dprime threshold)?""" + """Before this session, had the subject passed stage 5 (two sessions meeting crossmodal + dprime threshold)?""" + subject_id = str(self.id.subject) if self.is_templeton: logger.warning( f"{self.id} is a Templeton session: returning is_stage_5_passed = False, but we don't currently track this" @@ -1990,14 +1992,14 @@ def is_stage_5_passed(self) -> bool: return False for path in npc_lims.get_training_spreadsheet_paths(): try: - df = pd.read_excel(path, self.id.subject) + df = pd.read_excel(path, subject_id) except ValueError: # mouse not in this spreadsheet continue else: break else: logger.warning( - f"Could not find {self.subject.id} in training spreadsheets (and not a known Templeton session) - returning is_stage_5_passed = False, but this may be incorrect" + f"Could not find {subject_id} in training spreadsheets (and not a known Templeton session) - returning is_stage_5_passed = False, but this may be incorrect" ) return False @@ -2006,7 +2008,7 @@ def is_stage_5_passed(self) -> bool: return False return np.isnan( DynamicRoutingAnalysisUtils.getSessionsToPass( - mouseId=int(self.id.subject), + mouseId=int(subject_id), df=df, sessions=np.where( [