Skip to content

Commit

Permalink
Fix subject attribute bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhardcastle committed Nov 22, 2024
1 parent 11c7ad7 commit 9628b66
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/npc_sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,22 +1982,24 @@ 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"
)
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

Expand All @@ -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(
[
Expand Down

0 comments on commit 9628b66

Please sign in to comment.