Grid

class octa.Stimulus.Grid(n_rows, n_cols, row_spacing=50, col_spacing=50, x_margin=20, y_margin=20, size=None, background_color='white', background_shape=None, stim_mask=None, stim_orientation=0, stim_mirrorvalue=None, stim_link=None, stim_classlabel=None, stim_idlabel=None)

Class for creating a Grid stimulus.

Attributes

see also Stimulus

Grid.n_elements

The number of elements in the Grid

Grid.n_rows

The number of rows in the Grid

Grid.n_cols

The number of columns in the Grid

Grid.shapes

The shape for each element in the grid.

Grid.fillcolors

The fillcolor for each element in the grid.

Grid.boundingboxes

The size for each element in the grid.

The size is defined in terms of a rectangular boundingbox that contains the element.

Grid.orientations

The orientations for each element in the grid.

Grid.borderwidths

The borderwidths for each element in the grid.

Grid.bordercolors

The bordercolor for each element in the grid.

Grid.opacities

The opacity for each element in the grid.

Grid.mirrorvalues

The mirror value for each grid element

The link for each grid element

Grid.classlabels

The class labels for each grid element

Grid.idlabels

The ids for each grid element

Grid.data

The data for each element in the grid.

Methods

see also Stimulus

octa.Stimulus.Grid.remove_element(self, element_id)

Removes the shape at position element_id from the display

Parameters

element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

octa.Stimulus.Grid.remove_elements(self, n_removals=0, element_id=None)

Removes the shape of a series of individual elements

Parameters
  • n_removals (int, optional) – The number of randomly chosen elements to remove in the stimulus. Default value is 0.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

octa.Stimulus.Grid.randomize_elements(self, direction='AcrossElements')

Randomizes the order of the elements in the Grid stimulus across a specified direction.

Parameters

direction (string) – A pattern direction (“AcrossElements”, “AcrossRows”, “AcrossColumns”, “AcrossLeftDiagonal”,”AcrossRightDiagonal”). Default is “AcrossElements”.

octa.Stimulus.Grid.swap_elements(self, n_swap_pairs=1, swap_pairs=None)

Swaps the position of two elements in the pattern. Once a position has been used in a swap, it will not be used again in additional swaps. As a consequence, the maximum number of possible swaps is N//2, where N is the number of elements in the pattern.

When doing multiple swaps, if two elements have been selected to be swapped around a first time, they will not be selected again. This means that subsequent swaps can never cancel out an initial swap.

Parameters
  • n_swap_pairs (int, optional) – Number of element pairs that will be swapped. Maximum value is half the total number of elements. Default is 1.

  • swap_pairs (tuple or list, optional) – Element indices of specific pairs of elements to be swapped.

octa.Stimulus.Grid.swap_distinct_elements(self, n_swap_pairs=1, distinction_features=['shapes', 'boundingboxes', 'fillcolors', 'orientations', 'opacities', 'mirrorvalues', 'links', 'classlabels', 'idlabels'])

Swaps the position of two elements in the pattern. The elements that wil be swapped need to be distinct on at least one element feature dimension specified in the distinction_features argument. Once an element is used in a swap, it will not be used in subsequent swaps.

Parameters
  • n_swap_pairs (int, optional) – Number of element pairs that will be swapped. Default is 1.

  • distinction_features (list) – Feature dimensions that will be inspected to decide if two elements are the same. Default is [‘shapes’, ‘boundingboxes’, ‘fillcolors’, ‘orientations’, ‘opacities’, ‘mirrorvalues’, ‘links’, ‘classlabels’, ‘idlabels’]

octa.Stimulus.Grid.swap_features(self, n_swap_pairs=1, feature_dimensions=['fillcolors'], swap_pairs=None)

Swaps the position of two element features in the pattern. Once an element is used in a swap, it will not be used in subsequent swaps.

Parameters
  • n_swap_pairs (int , optional) – Number of element pairs that will be swapped. Default is 1.

  • feature_dimensions (list, optional) – Feature dimensions that will be swapped between the elements. Default is [‘fillcolors’].

  • swap_pairs (tuple or list, optional) – Element indices of specific pairs of elements to be swapped.

octa.Stimulus.Grid.swap_distinct_features(self, n_swap_pairs=1, feature_dimensions=['fillcolors'])

Swaps the position of two element features in the pattern. The element features that wil be swapped need to be distinct on the element feature dimension specified in the feature_dimensions argument. Once an element is used in a swap, it will not be used in subsequent swaps.

Parameters
  • n_swap_pairs (int, optional) – Number of element pairs that will be swapped. Default is 1.

  • feature_dimensions (list) – Feature dimensions that will be swapped between the elements. Default is [‘fillcolors’].

octa.Stimulus.Grid.set_element_shape(self, element_id, shape_value)

Sets the shape of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • shape_value (Shape or None) – An element shape, or None if no shape needs to be displayed.

octa.Stimulus.Grid.set_element_shapes(self, shape_value, element_id=None, n_changes=None)

Sets the shapes of a series of individual elements

Parameters
  • shape_value (Shape, None, or list) – The new shape value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_fillcolor(self, element_id, fillcolor_value)

Sets the fillcolor of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • fillcolor_value (string or list) – Color string, or a list for animated colors.

octa.Stimulus.Grid.set_element_fillcolors(self, fillcolor_value, element_id=None, n_changes=None)

Sets the fillcolors of a series of individual elements

Parameters
  • fillcolor_value (string or list) – The new fillcolor value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_boundingbox(self, element_id, boundingbox_value)

Sets the boundingbox value for an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • boundingbox_value (int, float, or tuple) – The new boundingbox value to apply to the element.

octa.Stimulus.Grid.set_element_boundingboxes(self, boundingbox_value, element_id=None, n_changes=None)

Sets the boundingbox value for a series of individual elements

Parameters
  • boundingbox_value (int, float, tuple, or list) – The new boundingbox value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_orientation(self, element_id, orientation_value)

Sets the orientation of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • orientation_value (int or list) – Orientation of the element.

octa.Stimulus.Grid.set_element_orientations(self, orientation_value, element_id=None, n_changes=None)

Sets the orientations of a series of individual elements

Parameters
  • orientation_value (int or list) – The new orientation value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_borderwidth(self, element_id, borderwidth_value)

Sets the borderwidth of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • borderwidth_value (int, float, or list) – Size of the border.

octa.Stimulus.Grid.set_element_borderwidths(self, borderwidth_value, element_id=None, n_changes=None)

Sets the borderwidths of a series of individual elements

Parameters
  • borderwidth_value (int, float, or list) – The new borderwidth value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_bordercolor(self, element_id, bordercolor_value)

Sets the bordercolor of an individual element

Parameters
  • element_id (tuple, list or int) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • bordercolor_value (string or list) – Color string, or a list for animated colors.

octa.Stimulus.Grid.set_element_bordercolors(self, bordercolor_value, element_id=None, n_changes=None)

Sets the bordercolors of a series of individual elements

Parameters
  • bordercolor_value (string or list) – The new bordercolor value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_opacity(self, element_id, opacity_value)

Sets the opacity of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • opacity_value (int, float, or list) – A numeric value between 0 and 1, or a list for animated opacities.

octa.Stimulus.Grid.set_element_opacities(self, opacity_value, element_id=None, n_changes=None)

Sets the opacities of a series of individual elements

Parameters
  • opacity_value (int, float, or list) – The new opacity value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_mirrorvalue(self, element_id, mirror_value)

Sets the mirrorvalue of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • mirrorvalue_value (string) – A mirrorvalue string (‘none’, ‘horizontal’, ‘vertical’, or ‘horizontalvertical’)

octa.Stimulus.Grid.set_element_mirrorvalues(self, mirror_value, element_id=None, n_changes=None)

Sets the mirrorvalues of a series of individual elements

Parameters
  • mirror_value (string or list) – The new mirrorvalue value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

Sets the link of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • link_value (string) – A hyperlink string.

Sets the links of a series of individual elements

Parameters
  • link_value (string or list) – The new link value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_classlabel(self, element_id, classlabel_value)

Sets the classlabel of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • classlabel_value (string) – A classlabel string.

octa.Stimulus.Grid.set_element_classlabels(self, classlabel_value, element_id=None, n_changes=None)

Sets the classlabels of a series of individual elements

Parameters
  • classlabel_value (string or list) – The new classlabel value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_idlabel(self, element_id, idlabel_value)

Sets the idlabel of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • idlabel_value (string) – An idlabel string.

octa.Stimulus.Grid.set_element_idlabels(self, idlabel_value, element_id=None, n_changes=None)

Sets the idlabels of a series of individual elements

Parameters
  • idlabel_value (string or list) – The new idlabel value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.

octa.Stimulus.Grid.set_element_data(self, element_id, data_value)

Sets the data of an individual element

Parameters
  • element_id (int, tuple, or list) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element.

  • data_value (string) – Data string for the element.

octa.Stimulus.Grid.set_element_datas(self, data_value, element_id=None, n_changes=None)

Sets the data of a series of individual elements

Parameters
  • data_value (string or list) – The new data value(s) to apply to the specified elements.

  • element_id (int, tuple, or list, optional) – A single integer referring to the element’s index value (element number), or a tuple or list with the row and column index of the element, or a list of several element ids

  • n_changes (int, optional) – The number of randomly chosen elements to change in the stimulus.