Stimulus

class octa.Stimulus.Stimulus(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)

Container class for creating a stimulus.

Parameters
  • x_margin (int, float, or tuple, optional) – Amount of extra space added to both sides of the stimulus in the x-direction. The default is 20.

  • y_margin (int, float, or tuple, optional) – Amount of extra space added to both sides of the stimulus in the y-direction. The default is 20.

  • size (tuple, optional) – If specified, fixes the size of the stimulus to the dimension given in the tuple. The center of the stimulus will be calculated to correspond to the center of all element positions in the stimulus.

  • background_color (string or list, optional) – Background color of the stimulus. The default is “white”.

  • background_shape (string or octa.shapes object, optional) – If specified, clips the stimulus to the specified shape (only the part of the stimulus that falls within the background shape will be visible). The center of the background shape will correspond to the center of all element positions in the stimulus. If a shape name is provided as string, the boundingbox of the shape will be equal to the stimulus size.

  • stim_mask (string or octa.shapes object, optional) – If specified, clips the stimulus to the specified shape. The center of the background shape will correspond to the center of all element positions in the stimulus. If a shape name is provided as string, the boundingbox of the shape will be equal to the stimulus size.

  • stim_orientation (int, float, or list, optional) – If not equal to 0, the stimulus will be rotated around its center according to the specified degree value. The default is 0.

  • stim_mirrorvalue (string, optional) – If specified, defines the way the stimulus will be mirrored (none, horizontal, vertical, or horizontalvertical).

  • stim_link (string, optional) – If specified, defines the hyperlink that will be activated when the stimulus is clicked.

  • stim_classlabel (string, optional) – If specified, defines the class label that can be used to add javascript or css changes to the stimulus.

  • stim_idlabel (string, optional) – If specified, defines the id label that can be used to add javascript or css changes to the stimulus.

Attributes

Stimulus.x_margin

The horizontal margin in the stimulus

Stimulus.y_margin

The vertical margin in the stimulus

Methods

octa.Stimulus.Stimulus.Render(self)

Prepares the SVG stimulus. The stimulus parameters are first parsed, then a new drawing is instantiated to which all the individual elements are added.

octa.Stimulus.Stimulus.Show(self)

Displays the current SVG stimulus in the IPython console window.

octa.Stimulus.Stimulus.GetSVG(self)

Gives the current stimulus as an SVG string.

octa.Stimulus.Stimulus.SaveSVG(self, filename, scale=None, folder=None)

Saves the current stimulus as an SVG file.

Parameters
  • filename (string) – Name of the svg file.

  • scale (int or float, optional) – Number that indicates the scaling factor to use on the original SVG size.

  • folder (string, optional) – Name of the folder in which the svg file needs to be saved.

octa.Stimulus.Stimulus.GetJSON(self)

Gives the JSON info concerning the current stimulus.

octa.Stimulus.Stimulus.SaveJSON(self, filename, folder=None)

Saves the current stimulus as a JSON file.

Parameters
  • filename (string) – Name of the json file.

  • folder (string, optional) – Name of the folder in which the json file needs to be saved.

octa.Stimulus.Stimulus.LoadFromJSON(filename, folder=None)

Creates a stimulus object from a JSON file.

Parameters
  • filename (string) – JSON file that needs to be loaded.

  • folder (string, optional) – Name of the folder in which the csv file needs to be saved.

Returns

A stimulus object with parameters extracted from the JSON file.

Return type

Stimulus

octa.Stimulus.Stimulus.SavePNG(self, filename, scale=None, folder=None)

Saves the current stimulus as a PNG file.

Parameters
  • filename (string) – Name of the png file.

  • scale (int or float, optional) – Number that indicates the scaling factor to use on the original SVG size.

  • folder (string, optional) – Name of the folder in which the png file needs to be saved.

octa.Stimulus.Stimulus.SavePDF(self, filename, scale=None, folder=None)

Saves the current stimulus as a PDF file.

Parameters
  • filename (string) – Name of the pdf file.

  • scale (int or float, optional) – Number that indicates the scaling factor to use on the original SVG size.

  • folder (string, optional) – Name of the folder in which the pdf file needs to be saved.

octa.Stimulus.Stimulus.SaveTIFF(self, filename, scale=None, folder=None)

Saves the current stimulus as a TIFF file.

Parameters
  • filename (string) – Name of the tiff file.

  • scale (int or float, optional) – Number that indicates the scaling factor to use on the original SVG size.

  • folder (string, optional) – Name of the folder in which the tiff file needs to be saved.

octa.Stimulus.Stimulus.SaveJPG(self, filename, scale=None, folder=None)

Saves the current stimulus as a JPG file.

Parameters
  • filename (string) – Name of the jpg file.

  • scale (int or float, optional) – Number that indicates the scaling factor to use on the original SVG size.

  • folder (string, optional) – Name of the folder in which the jpg file needs to be saved.

octa.Stimulus.Stimulus.GetElementsDF(self)

Gets a dataframe with all element information.

octa.Stimulus.Stimulus.SaveElementsDF(self, filename, folder=None)

Saves a dataframe with all element information as CSV file.

Parameters
  • filename (string) – Name of the csv file.

  • folder (string, optional) – Name of the folder in which the csv file needs to be saved.