Stimulus package#
Fixation class#
- class CFSVM.Element.Stimulus.Fixation(dirpath, kwargs)#
Bases:
CFSVM.Element.Stimulus.Stimulus
Handling fixation cross.
Derived from
TemporalElement
andSpatialElement
classes.- Constructor Summary
- Fixation(dirpath, kwargs)#
- Property Summary
- RESULTS = {'onset'}#
Parameters to parse into the processed results table.
- args#
Cell array storing arguments for PTB’s Screen(‘DrawLines’).
- Method Summary
- preload_args(screen)#
Loads args property with PTB Screen(‘DrawLines’) arguments.
- Parameters:
screen –
CustomScreen
object.
- show(experiment)#
Draws and shows fixation cross on the screen.
- Parameters:
experiment – An experiment object.
- Returns:
Onset time of the fixation.
- Return type:
float
Mask class#
- class CFSVM.Element.Stimulus.Mask(kwargs)#
Bases:
CFSVM.Element.Stimulus.Stimulus
Manipulating Mask stimulus.
Derived from
Stimulus
.- Constructor Summary
- Mask(kwargs)#
- Parameters:
dirpath –
CFSVM.Element.Stimulus.Stimulus.dirpath
. Defaults to ‘./Masks/’.duration –
CFSVM.Element.TemporalElement.duration
. Defaults to 0.1.soa –
soa
. Defaults to 0.2.blank –
CFSVM.Element.Stimulus.Stimulus.blank
. Defaults to 0.position –
CFSVM.Element.Stimulus.Stimulus.position
. Defaults to “Center”.xy_ratio –
CFSVM.Element.Stimulus.Stimulus.xy_ratio
. Defaults to 1.size –
CFSVM.Element.Stimulus.Stimulus.size
. Defaults to 1.padding –
CFSVM.Element.Stimulus.Stimulus.padding
. Defaults to 0.rotation –
CFSVM.Element.Stimulus.Stimulus.rotation
. Defaults to 0.contrast –
CFSVM.Element.SpatialElement.contrast
. Defaults to 1.
- Property Summary
- RESULTS = {'onset','offset'}#
Parameters to parse into the processed results table.
- left_rect#
[x0, y0, x1, y1] array - stimulus rect on the left screen.
- right_rect#
[x0, y0, x1, y1] array - stimulus rect on the right screen.
- soa#
Float - stimulus onset asynchrony between stimulus and mask. For soa < 0 - forward masking, soa == 0 - simultaneous masking, soa > 0 - backward masking
- Method Summary
- load_rect_parameters(screen, is_left_suppression)#
Calculates rects depending on suppression side for the trial.
- Parameters:
screen –
CustomScreen
object.is_left_suppression – bool
Mondrians class#
- class CFSVM.Element.Stimulus.Mondrians(kwargs)#
Bases:
CFSVM.Element.Stimulus.Stimulus
Manipulating Mondrian masks.
Derived from
Stimulus
.- Constructor Summary
- Mondrians(kwargs)#
- Parameters:
dirpath –
CFSVM.Element.Stimulus.Stimulus.dirpath
. Defaults to ‘’.temporal_frequency –
temporal_frequency
. Defaults to 10.duration –
CFSVM.Element.TemporalElement.duration
. Defaults to 5.position –
CFSVM.Element.Stimulus.Stimulus.position
. Defaults to “Center”.xy_ratio –
CFSVM.Element.Stimulus.Stimulus.xy_ratio
. Defaults to 1.size –
CFSVM.Element.Stimulus.Stimulus.size
. Defaults to 1.padding –
CFSVM.Element.Stimulus.Stimulus.padding
. Defaults to 0.rotation –
CFSVM.Element.Stimulus.Stimulus.rotation
. Defaults to 0.contrast –
CFSVM.Element.SpatialElement.contrast
. Defaults to 1.blank –
CFSVM.Element.Stimulus.Stimulus.blank
. Defaults to 0.crafter_masks –
crafter_masks
. Defaults to ‘’.is_control – Whether to flash mondrians on both screen fields. Defaults to false.
manual_rect –
CFSVM.Element.Stimulus.Stimulus.manual_rect
.
- Property Summary
- RESULTS = {'onset','offset'}#
Parameters to parse into the processed results table.
- args#
Cell array storing arguments for PTB’s Screen(‘DrawTextures’) for masks, stimuli, fixation and checkframe.
- crafter_masks#
Path to .mat file generated by CFS_crafter.
- indices#
1D array representing masks index for every frame.
- is_control#
Whether flash mondrians on both screens.
- n_max#
Int - overall max number of masks from blocks and trials.
- temporal_frequency#
Float in Hz, number of masks flashed per one second.
- vbls#
1D array recording onset times of every frame.
- Method Summary
- get_max(trial_matrix)#
Gets overall maximum number of masks from all blocks and trials.
- Parameters:
trial_matrix – Cell array with blocks and trials from the trials object.
- import_from_crafter(window)#
Import masks in CFS-crafter format.
- Parameters:
window – PTB window pointer.
- load_flashing_parameters(screen)#
Calculates parameters for flashing for the trial.
- Parameters:
screen –
CustomScreen
object.
- load_rect_parameters(screen, is_left_suppression)#
Calculates rects depending on suppression side for the trial.
- Parameters:
screen –
CustomScreen
object.is_left_suppression – bool
- shuffle()#
Shuffles masks textures.
Stimulus class#
- class CFSVM.Element.Stimulus.Stimulus#
Bases:
CFSVM.Element.TemporalElement
,CFSVM.Element.SpatialElement
A base class for different types of stimuli.
Derived from
TemporalElement
andSpatialElement
classes.- Property Summary
- blank#
Float in seconds for showing blank screen after the stimulus presentation, has the effect in only very specific cases.
- dirpath = '.'#
Char array for path to directory in which stimuli are stored.
- image_name#
Cell array of chars with name of current image.
- index#
Int describing current image (by position in the folder)
- manual_rect#
[x0, y0, x1, y1] array - manually entered stimulus position inside the screen fields. Will override position, size, padding and xy_ratio.
- padding#
Float between 0 and 1, when 0 alignment to the frame and 1 is alignment to the center of the
Fixation
.
- position = "Center"#
Char array. One of ‘UpperLeft’, ‘Top’, ‘UpperRight’, ‘Left’, ‘Center’, ‘Right’, ‘LowerLeft’, ‘Bottom’, ‘LowerRight’
- rotation#
Float describing degrees of rotation.
- size#
- textures#
Struct with fields PTB_indices - cell array with PTB textures indices, images_names - cell array of chars, len - number of textures.
- xy_ratio#
Nonnegative float describing x/y of the stimulus image.
- Method Summary
- get_manual_rect(screen_rectangle)#
- get_rect(screen_rectangle)#
Returns array with pixels coordinates for the new_rectangle in a given screen_rectangle, new_rectangle alignment, its size, padding and its X to Y ratio.
- Parameters:
screen_rectangle – [x0, y0, x1, y1] array with pixel positions.
- Returns:
resized and positioned rectangle array.
- Return type:
[x0, y0, x1, y1]
- import_images(window, parameters)#
Loads images from the provided path and makes an array of PTB textures from it.
- Parameters:
window – PTB window object.
images_number – (Optional) Number of textures to create.
SuppressedStimulus class#
- class CFSVM.Element.Stimulus.SuppressedStimulus(dirpath, kwargs)#
Bases:
CFSVM.Element.Stimulus.Stimulus
Manipulating stimulus suppressed by mondrians.
Derived from
Stimulus
.- Constructor Summary
- SuppressedStimulus(dirpath, kwargs)#
- Parameters:
dirpath –
CFSVM.Element.Stimulus.Stimulus.dirpath
.position –
CFSVM.Element.Stimulus.Stimulus.position
. Defaults to “Center”.xy_ratio –
CFSVM.Element.Stimulus.Stimulus.xy_ratio
. Defaults to 1.size –
CFSVM.Element.Stimulus.Stimulus.size
. Defaults to 0.5.padding –
CFSVM.Element.Stimulus.Stimulus.padding
. Defaults to 0.5.rotation –
CFSVM.Element.Stimulus.Stimulus.rotation
. Defaults to 0.contrast –
CFSVM.Element.SpatialElement.contrast
. Defaults to 1.duration –
CFSVM.Element.TemporalElement.duration
. Defaults to 1.blank –
CFSVM.Element.Stimulus.Stimulus.blank
. Defaults to 0.manual_rect –
manual_rect
.
- Property Summary
- RESULTS = {'onset','offset','position','index','image_name'}#
Parameters to parse into the processed results table.
- contrasts#
1D array representing contrast for every frame of flashing.
- indices#
1D array representing shown for current frame stimulus when set to 1.
- left_rect#
[x0, y0, x1, y1] array - stimulus rect on the left screen.
- right_rect#
[x0, y0, x1, y1] array - stimulus rect on the right screen.
- rotations#
1D array representing rotation for every frame of flashing.
- Method Summary
- load_flashing_parameters(screen, masks)#
Calculates contrasts arrays for flashing.
- Parameters:
screen –
CustomScreen
object.masks –
Mondrians
object.
- load_rect_parameters(screen, is_left_suppression)#
Calculates rects depending on suppression side for the trial.
- Parameters:
screen –
CustomScreen
object.is_left_suppression – bool
TargetStimulus class#
- class CFSVM.Element.Stimulus.TargetStimulus(dirpath, kwargs)#
Bases:
CFSVM.Element.Stimulus.Stimulus
Manipulating target stimulus.
Derived from
Stimulus
.- Constructor Summary
- TargetStimulus(dirpath, kwargs)#
- Parameters:
dirpath –
CFSVM.Element.Stimulus.Stimulus.dirpath
.duration –
CFSVM.Element.TemporalElement.duration
. Defaults to 1.position –
CFSVM.Element.Stimulus.Stimulus.position
. Defaults to “Center”.xy_ratio –
CFSVM.Element.Stimulus.Stimulus.xy_ratio
. Defaults to 1.size –
CFSVM.Element.Stimulus.Stimulus.size
. Defaults to 0.3.padding –
CFSVM.Element.Stimulus.Stimulus.padding
. Defaults to 0.5.rotation –
CFSVM.Element.Stimulus.Stimulus.rotation
. Defaults to 0.contrast –
CFSVM.Element.SpatialElement.contrast
. Defaults to 1.
- Property Summary
- RESULTS = {'onset','offset','index','image_name'}#
Parameters to parse into the processed results table.
- left_rect#
[x0, y0, x1, y1] array - stimulus rect on the left screen.
- right_rect#
[x0, y0, x1, y1] array - stimulus rect on the right screen.
- Method Summary
- load_rect_parameters(screen)#
Calculates rect coordinates on screen.
- Parameters:
screen –
@CustomScreen
object.
- show(experiment)#
Presents target for the provided duration.
- Parameters:
experiment – An experiment object.