Skip to content
Permalink
Browse files

BF: recreates previous option of using trials.next() to advance trials

This had been lost in python futurize step in
GH-38740bcaff28d063f6519461d2780a3850886889

Closes GH-2322
  • Loading branch information...
peircej committed Mar 5, 2019
1 parent b042258 commit c44621ab072ad7a6f6bb56d0c4d86865b57af1dc
Showing with 14 additions and 0 deletions.
  1. +8 −0 psychopy/data/staircase.py
  2. +6 −0 psychopy/data/trial.py
@@ -393,6 +393,8 @@ def __next__(self):
else:
self._terminate()

next = __next__ # allows user to call without a loop `val = trials.next()`

def _intensityInc(self):
"""increment the current intensity and reset counter
"""
@@ -1035,6 +1037,8 @@ def __next__(self):
else:
self._terminate()

next = __next__ # allows user to call without a loop `val = trials.next()`

def _checkFinished(self):
"""checks if we are finished
Updates attribute: `finished`
@@ -1242,6 +1246,8 @@ def __next__(self):
else:
self._terminate()

next = __next__ # allows user to call without a loop `val = trials.next()`

def _checkFinished(self):
"""checks if we are finished
Updates attribute: `finished`
@@ -1513,6 +1519,8 @@ def __next__(self):
else:
raise StopIteration

next = __next__ # allows user to call without a loop `val = trials.next()`

def _startNewPass(self):
"""Create a new iteration of the running staircases for this pass.
@@ -362,6 +362,8 @@ def __next__(self):
logging.exp(msg % vals, obj=self.thisTrial)
return self.thisTrial

next = __next__ # allows user to call without a loop `val = trials.next()`

def getFutureTrial(self, n=1):
"""Returns the condition for n trials into the future,
without advancing the trials. A negative n returns a previous (past)
@@ -1020,6 +1022,8 @@ def __next__(self):
logging.exp(msg % vals, obj=self.thisTrial)
return self.thisTrial

next = __next__ # allows user to call without a loop `val = trials.next()`

def getFutureTrial(self, n=1):
"""Returns the condition for n trials into the future, without
advancing the trials. Returns 'None' if attempting to go beyond
@@ -1516,6 +1520,8 @@ def __next__(self):
logging.exp(msg % vals, obj=self.thisTrial)
return self.thisTrial

next = __next__ # allows user to call without a loop `val = trials.next()`

def getCurrentTrialPosInDataHandler(self):
# if there's no trial weights, then the current position is simply
# [trialIndex, nRepetition]

0 comments on commit c44621a

Please sign in to comment.
You can’t perform that action at this time.