Skip to content

Commit

Permalink
Updating trial iteration
Browse files Browse the repository at this point in the history
I think that there's an issue with it figuring out when to iterate to the next hab trial too late, so trying moving that earlier.
  • Loading branch information
jfkominsky committed Mar 6, 2024
1 parent 7aedab1 commit 661b333
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions PyHab/PyHabClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,13 @@ def checkStop(self, blockName):
trialPerIter = len(targetTrials)/self.blockList[blockName]['metCritWindow'] # Typically this will be 1
currIter = 0
for n in range(0, len(targetTrials)):
if n % trialPerIter == 0 and n > 0:
currIter += 1
for i in range(0, len(self.verbDatList['verboseOff'])):
if self.verbDatList['verboseOff'][i]['trial'] == targetTrials[n]:
if self.verbDatList['verboseOff'][i]['duration'] >= self.habCrit[blockName]:
consecPostThreshold[currIter] = 1
if n % trialPerIter == 0 and n > 0:
currIter += 1


if 0 in consecPostThreshold: # It's a slightly weird way to do this but I think it will work.
return False
Expand Down
4 changes: 2 additions & 2 deletions testing/test_pyhab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,12 +1268,12 @@ def test_fixedtriallength(self):
currIter = 0

for n in range(0, len(targetTrials)):
if n % trialPerIter == 0 and n > 0:
currIter += 1
for i in range(0, len(self.dataInst.verbDatList['verboseOff'])):
if self.dataInst.verbDatList['verboseOff'][i]['trial'] == targetTrials[n]:
if self.dataInst.verbDatList['verboseOff'][i]['duration'] >= self.dataInst.habCrit[blockName]:
consecPostThreshold[currIter] = 1
if n % trialPerIter == 0 and n > 0:
currIter += 1
assert currIter == 2
assert consecPostThreshold == [1,1,1]

Expand Down

0 comments on commit 661b333

Please sign in to comment.