Positions

class octa.Positions.Positions(x, y, positiontype=None, positionparameters={})

The Positions object contains two Pattern objects for each of the x and y coordinates.

Getters are defined to immediately access the values in the Pattern objects.

Static methods are defined for generating template position structures

Parameters
  • x (Pattern) – Object that contains the values for the x-coordinates

  • y (Pattern) – Object that contains the values for the y-coordinates

  • positiontype (string) – Indicates the type of position definition used

  • positionparameters (dictionary) – Provides the parameters for the positiontype used

Methods

octa.Positions.Positions.GetPositions(self)

Returns the actual position values in the stimulus (including position jitter and position deviations)

octa.Positions.Positions.CreateRectGrid(n_rows, n_cols, row_spacing=50, col_spacing=50)

Static method to create a rectangular grid structure.

Parameters
  • n_rows (int) – Number of rows.

  • n_cols (int) – Number of columns.

  • row_spacing (int) – Distance between column centers. The default is 50.

  • col_spacing (int) – Distance between row centers. The default is 50.

Returns

Positions object with the generated (x,y) positions.

Return type

Positions

octa.Positions.Positions.CreateSineGrid(n_rows, n_cols, row_spacing=50, col_spacing=50, A=25, f=0.1, axis='xy')

Creates a rectangular regularly spaced grid and adds a sine wave modulation to the specified axis.

Parameters
  • n_rows (int) – Number of rows.

  • n_cols (int) – Number of columns.

  • row_spacing (int) – Distance between column centers.

  • col_spacing (int) – Distance between row centers.

  • A (int or float) – Amplitude of the modulation.

  • f (int or float) – Frequency of the modulation.

  • axis (string, optional) – String that contains the axis to which jitter should be applied. Possible values are “x”, “y”, “xy” or “x=y”. The default is “xy”.

Returns

Positions object with the generated (x,y) positions.

Return type

Positions

octa.Positions.Positions.CreateRandomPositions(n_elements, width=300, height=300, min_distance=30, max_iterations=10)

Generates random (x,y) positions

Parameters
  • n_elements (int) – The number of random positions.

  • width (int, optional) – The width of the stimulus. The default is 300.

  • height (int, optional) – The height of the stimulus. The default is 300.

  • min_distance (int, optional) – Minimum distance between all generated positions. The default is 30.

  • max_iterations (int, optional) – How many times the algorithm should try to generate positions if the min_distance criterion can not be satisfied. The default is 10.

Returns

Positions object with the generated (x,y) positions

Return type

Positions

octa.Positions.Positions.CreateCircle(radius, n_elements, starting_point='left')

Generates element positions on the circumference of a regularly spaced circle.

Parameters
  • radius (float) – Radius of the circle.

  • n_elements (int) – Number of elements on the circle.

  • starting_point (string) – Options are ‘left’, ‘right’, ‘top’, or ‘bottom’. Default value is ‘left’.

Returns

Positions object with the generated (x,y) positions.

Return type

Positions

octa.Positions.Positions.CreateShape(n_elements, src=None, path=None, width=300, height=300)

Generates element positions on the circumference of a custom shape (path) in an equally spaced way.

Parameters
  • n_elements (int) – Number of elements on the circle.

  • src (string, optional) – String indicating the source location for the svg file

  • path (string, optional) – Custom path defining the shape outline

  • width (int or float, optional) – Width of the shape outline. Default value is 300.

  • height (int or float, optional) – Height of the shape outline. Default value is 300.

Returns

Positions object with the generated (x,y) positions.

Return type

Positions

octa.Positions.Positions.CreateCustomPositions(x, y)

Static method to create custom positions.

Parameters
  • x (Pattern) – All the x-coordinates.

  • y (Pattern) – All the y-coordinates.

Returns

Positions object with the generated (x,y) positions.

Return type

Positions

octa.Positions.Positions.SetPositionJitter(self, axis='xy', distribution='normal', **kwargs)

Add jitter to the positions.

Parameters
  • axis (string, optional) – String that contains the axis to which jitter should be applied. Possible values are “x”, “y”, “xy” or “x=y”. The default is “xy”.

  • distribution (string, optional) – The type of jitter that should be used. The default is “normal”.

  • **kwargs (Additional arguments that depend on the requested jitter type:) – “normal”: Specify ‘mu’ and ‘std’

    “uniform”: Specify ‘min_val’ and ‘max_val’

Returns

The updated Positions object

Return type

Positions

octa.Positions.Positions.SetPositionDeviations(self, element_id=[0], x_offset=None, y_offset=None)

Add deviations to the positions.

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, or a list of several element ids. Default is [0].

  • x_offset (int, float, or list, optional) – (List of) numeric value(s) to add to the x coordinate of the specified element position(s).

  • y_offset (int, float, or list, optional) – (List of) numeric value(s) to add to the y coordinate of the specified element position(s).

Returns

The updated Positions object

Return type

Positions