Classes
Eyelink (window, timer[, isPsychopy, subject]) |
Interface for the SR Research Eyelink eyetracking system.. |
ROI ([image_path, output_path, …]) |
Generate regions of interest that can be used for data processing and analysis. |
imhr.eyetracking.
Eyelink
(window, timer, isPsychopy=True, subject=None, **kwargs)[source]¶Bases: imhr.eyetracking._eyelink.Eyelink
Interface for the SR Research Eyelink eyetracking system..
Parameters: |
|
---|
Methods
calibration (self) |
Start calibration procedure. |
connect (self[, calibration_type, …]) |
Connect to Eyelink. |
drift_correction (self[, origin]) |
Starts drift correction. |
finish_recording (self[, path]) |
Ending Eyelink recording. |
gc (self, bound, min_[, max_]) |
Creates gaze contigent event. |
sample (self) |
Collects new gaze coordinates from Eyelink. |
send_message (self, msg) |
Send message to Eyelink. |
send_variable (self, variables) |
send trial variable to eyelink at the end of trial. |
set_eye_used (self, eye) |
Set dominant eye. |
start_recording (self, trial, block) |
Starts recording of Eyelink. |
stop_recording (self[, trial, block, variables]) |
Stops recording of Eyelink. |
Notes
Examples
>>> eytracking = imhr.eyetracking(window=window, subject=subject)
calibration
(self)[source]¶Start calibration procedure.
Returns: |
|
---|
Examples
>>> eyetracking.calibration()
connect
(self, calibration_type=13, automatic_calibration_pacing=1000, saccade_velocity_threshold=35, saccade_acceleration_threshold=9500, sound=True, select_parser_configuration=0, recording_parse_type='GAZE', enable_search_limits=True, ip='100.1.1.1')[source]¶Connect to Eyelink.
Parameters: |
|
---|---|
Returns: |
|
Examples
>>> param = eyetracking.connect(calibration_type=13)
drift_correction
(self, origin='call')[source]¶Starts drift correction. This can be done at any point after calibration, including before and after eyetracking.start_recording has already been initiated.
Parameters: |
|
---|---|
Returns: |
|
Notes
Running drift_correction will end any start_recording event to function properly. Once drift correction has occured, it is safe to run start_recording.
Examples
>>> eyetracking.drift_correction()
finish_recording
(self, path=None)[source]¶Ending Eyelink recording.
Parameters: | |
---|---|
Returns: |
|
Notes
Examples
>>> #end recording session
>>> eyetracking.finish_recording()
gc
(self, bound, min_, max_=None)[source]¶Creates gaze contigent event. This function needs to be run while recording.
Parameters: |
|
---|
Examples
>>> # Collect samples within the center of the screen, for 2000 msec,
>>> # with a max limit of 10000 msec.
>>> region = dict(left=860, top=440, right=1060, bottom=640)
>>> eyetracking.gc(bound=bound, min_=2000, max_=10000)
sample
(self)[source]¶Collects new gaze coordinates from Eyelink.
Returns: |
---|
Examples
>>> eyetracking.sample(eye_used=eye_used)
send_message
(self, msg)[source]¶Send message to Eyelink. This allows post-hoc processing of event markers (i.e. “stimulus onset”).
Parameters: |
|
---|
Examples
>>> eyetracking.console(msg="eyetracking.calibration() started", color="blue")
send_variable
(self, variables)[source]¶send trial variable to eyelink at the end of trial.
Parameters: |
---|
set_eye_used
(self, eye)[source]¶Set dominant eye. This step is required for recieving gaze coordinates from Eyelink->Psychopy.
Parameters: |
|
---|
Examples
>>> dominant_eye = 'left'
>>> eye_used = eyetracking.set_eye_used(eye=dominant_eye)
start_recording
(self, trial, block)[source]¶Starts recording of Eyelink.
Parameters: | |
---|---|
Returns: |
|
Notes
Examples
>>> eyetracking.start_recording(trial=1, block=1)
stop_recording
(self, trial=None, block=None, variables=None)[source]¶Stops recording of Eyelink. Also allows transmission of trial-level variables to Eyelink.
Parameters: | |
---|---|
Returns: |
|
Notes
Examples
>>> variables = dict(stimulus='face.png', event='stimulus')
>>> eyetracking.stop_recording(trial=trial, block=block, variables=variables)
imhr.eyetracking.
ROI
(image_path=None, output_path=None, metadata_path=None, shape='box', **kwargs)[source]¶Bases: imhr.eyetracking._roi.ROI
Generate regions of interest that can be used for data processing and analysis.
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Attributes: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Raises: |
|
Methods
draw_contours (filepath[, img]) |
[summary] |
export_data (df, path, filename[, uuid, …]) |
[summary] |
extract_contours (image, imagename, roiname) |
[summary] |
extract_metadata (imagename, imgtype, layer) |
Extract metadata for each region of interest. |
finished (df[, errors]) |
Process bounds for all images. |
format_contours (imagename, metadata, …) |
[summary] |
format_image ([image, imgtype, isRaw, …]) |
Resize image and reposition image, relative to screensize. |
haarcascade (directory[, core, queue]) |
[summary] |
manual_detection (directory[, core, queue]) |
[summary] |
process () |
[summary] |
Notes
Examples
>>> from imhr.roi import ROI
>>> s = "/dist/example/raw/"; d="/dist/example/"
>>> ROI(source=s, output_path=d, shape='box')
>>> img.save('/Users/mdl-admin/Desktop/roi/PIL.png') #DEBUG: save PIL
>>> cv2.imwrite('/Users/mdl-admin/Desktop/roi/cv2.png', img_cv2) #DEBUG: save cv2
>>> plt.imshow(img_np); plt.savefig('/Users/mdl-admin/Desktop/roi/matplotlib.png') #DEBUG: save matplotlib
draw_contours
(filepath, img=None)[source]¶[summary]
Parameters: |
|
---|
export_data
(df, path, filename, uuid=None, newcolumn=None, level='image')[source]¶[summary]
Parameters: |
|
---|---|
Returns: |
|
extract_contours
(image, imagename, roiname)[source]¶[summary]
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
extract_metadata
(imagename, imgtype, layer)[source]¶Extract metadata for each region of interest.
Parameters: |
|
---|---|
Returns: |
|
finished
(df, errors=None)[source]¶Process bounds for all images.
Parameters: |
|
---|
format_contours
(imagename, metadata, roiname, roinumber, bounds, coords)[source]¶[summary]
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
format_image
(image=None, imgtype='psd', isRaw=False, isPreprocessed=False, isNormal=False, isHaar=False)[source]¶Resize image and reposition image, relative to screensize.
Parameters: |
|
---|---|
Attributes: |
|
Returns: |
|
haarcascade
(directory, core=0, queue=None)[source]¶[summary]
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
manual_detection
(directory, core=0, queue=None)[source]¶[summary]
Parameters: |
|
---|---|
Returns: |
|