Preferential Looking

This class is an extension of the PyHab Class (base) base class.

class PyHab.PyHabClassPL.PyHabPL(settingsDict)

A new preferential-looking version of PyHab that extends the base class rather than being a wholly separate class. There’s still a lot of redundant code here, which will require significant restructuring of the base class to fix.

abortTrial(onArray, offArray, trial, ttype, onArray2, stimName='', habTrialNo=0)

Aborts a trial in progress, saves any data recorded thus far to the bad-data structures

Parameters:
  • onArray (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-on Left events
  • offArray (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-off events
  • trial (int) – Trial number
  • ttype (string) – Trial type
  • onArray2 (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-on Right events
  • stimName (string) – If presenting stimuli, name of the stim file
Returns:

Return type:

dataRec(onArray, offArray, trial, type, onArray2, stimName='', habTrialNo=0)

Records the data for a trial that ended normally.

Parameters:
  • onArray (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-on Left events
  • offArray (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-off events
  • trial (int) – Trial number
  • ttype (string) – Trial type
  • onArray2 (list of dicts {trial, trialType, startTime, endTime, duration}) – Gaze-on Right events
  • stimName (string) – If presenting stimuli, name of the stim file
Returns:

Return type:

doTrial(number, ttype, disMovie)

Control function for individual trials, to be called by doExperiment Returns a status value (int) that tells doExperiment what to do next

Parameters:
  • number (int) – Trial number
  • ttype (string) – Trial type
  • disMovie (movieStim3 object) – Movie object for stimulus presentation
Returns:

int, 0 = proceed to next trial, 1 = hab crit met, 2 = end experiment, 3 = trial aborted

Return type:

endExperiment()

End experiment, save all data, calculate reliability if needed, close up shop :return: :rtype:

lookKeysPressed()

A simple boolean function to allow for more modularity with preferential looking Basically, allows you to set an arbitrary set of keys to start a trial once the attngetter has played. In this case, only B or M are sufficient.

Returns:True if the B or M key is pressed, False otherwise.
Return type: