GridPattern

class octa.patterns.GridPattern.GridPattern(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Base class for GridPatterns

Parameters
  • pattern (list, Pattern) – Values to be used in the repeater pattern.

  • n_rows (int) – Number of rows in the 2D grid.

  • n_cols (int) – Number of columns in the 2D grid.

  • patterntype (string) – Indicates the pattern type used.

  • patterndirection (string) – Indicates the pattern direction used.

Subclasses

class octa.patterns.GridPattern.RepeatAcrossElements(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the current pattern, until the total number of elements fits into the 2D grid structure.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.RepeatAcrossRows(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the provided pattern across the columns in the grid. The provided pattern is first either duplicated (when #elements < n_rows) or truncated (when #elements > n_rows) to fit in a single column.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.RepeatAcrossColumns(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the provided pattern across the rows in the grid. The provided pattern is first either duplicated (when #elements < n_cols) or truncated (when #elements > n_cols) to fit in a single row.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.RepeatAcrossLeftDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the provided pattern across the diagonal running from the top right corner to the bottom left corner.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.RepeatAcrossRightDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the provided pattern across the diagonal running from the top left corner to the bottom right corner.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.RepeatAcrossLayers(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the provided pattern across the layers within the stimulus running from inside to outside layers.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossElements(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the current pattern, until the total number of elements fits into the 2D grid structure.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossRows(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the provided pattern across the columns in the grid. The provided pattern is first either duplicated (when #elements < n_rows) or truncated (when #elements > n_rows) to fit in a single column.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossColumns(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the provided pattern across the rows in the grid. The provided pattern is first either duplicated (when #elements < n_cols) or truncated (when #elements > n_cols) to fit in a single row.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossLeftDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the provided pattern across the diagonal running from the top right corner to the bottom left corner.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossRightDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the provided pattern across the diagonal running from the top left corner to the bottom right corner.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.ElementRepeatAcrossLayers(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the values in the provided pattern across the layers within the stimulus running from inside to outside layers.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossElements(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Repeats the input pattern until there are as many elements as half the number of elements in the grid.

Returns

Current instance of the GridPattern.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossRows(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Mirrors the pattern across the horizontal midline of the grid. If the input pattern is not equal to half the number of rows (+1 if the number of rows is uneven), two manipulations can take place:

  1. If the provided pattern is shorter in length, the pattern as a whole is duplicated until it matches half the number of rows (+1 if uneven)

  2. If the provided pattern is longer, it is truncated to half the number of rows (+1)

Returns

Current instance of the GridPattern.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossColumns(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Mirrors the pattern across the horizontal midline of the grid. If the input pattern is not equal to half the number of columns (+1 if the number of columns is uneven), two manipulations can take place:

  1. If the provided pattern is shorter in length, the pattern as a whole is duplicated until it matches half the number of columns (+1 if uneven)

  2. If the provided pattern is longer, it is truncated to half the number of columns (+1)

Returns

Current instance of the GridPattern.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossLeftDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Mirrors the pattern across the diagonal running from the top left to the bottom right. If the pattern is shorter than the number of elements required to reach the diagonal, which is (n_rows + n_cols - 1) / 2, the pattern is repeated. If it is longer, the pattern is truncated.

Returns

Current instance of the GridPattern.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossRightDiagonal(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Mirrors the pattern across the diagonal running from the top right to the bottom left. If the pattern is shorter than the number of elements required to reach the diagonal, which is (n_rows + n_cols - 1) / 2, the pattern is repeated. If it is longer, the pattern is truncated.

Returns

Current instance of the GridPattern.

Return type

GridPattern

class octa.patterns.GridPattern.MirrorAcrossLayers(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, patternclass='GridPattern.')

Mirrors the provided pattern across the layers within the stimulus running from inside to outside layers.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossElements(start_value, end_value, n_rows=5, n_cols=5)

Creates a gradient where the number of elements equals the total number of elements in the grid.

Returns

Current instance of the object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossRows(start_value, end_value, n_rows=5, n_cols=5)

Creates a gradient across the rows of the grid.

Returns

Current instance of the object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossColumns(start_value, end_value, n_rows=5, n_cols=5)

Creates a gradient across the columns of the grid.

Returns

Current instance of the object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossLeftDiagonal(start_value, end_value, n_rows=5, n_cols=5)

Creates a diagonal gradient, starting in the top right corner and ending in the bottom left corner.

Returns

Current instance of the object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossRightDiagonal(start_value, end_value, n_rows=5, n_cols=5)

Creates a diagonal gradient, starting in the top left corner and ending in the bottom right corner.

Returns

Current instance of the object.

Return type

GridPattern

class octa.patterns.GridPattern.GradientAcrossLayers(start_value, end_value, n_rows=5, n_cols=5)

Creates a gradient across the layers within the stimulus running from inside to outside layers.

Returns

Current instance of the GridPattern object.

Return type

GridPattern

class octa.patterns.GridPattern.TiledGrid(source_grid, tile_multiplier)

The current grid is tiled across the rows and columns using the values in tile_multiplier

Parameters

tile_multiplier (list, tuple or int) – Two values indicating the tiling along the rows and columns respectively. If a single integer is provided, the tiling will be the same along the rows and columns

Returns

Return type

GridPattern

class octa.patterns.GridPattern.TiledElementGrid(source_grid, tile_multiplier)

Each element in the grid is expanded across rows and columns using the values in tile_multiplier

Parameters

tile_multiplier (list, tuple or int) – Two values indicating the tiling along the rows and columns respectively. If a single integer is provided, the tiling will be the same along the rows and columns

Returns

Return type

GridPattern

class octa.patterns.GridPattern.RandomPattern(pattern, n_rows=5, n_cols=5, patterntype=None, patterndirection=None, counts=None)

The provided pattern is repeated until the length is equal to the number of elements in the grid structure. The order of the elements is then randomized. A list of proportions can be provided to decide how many times each element has to be repeated.

Parameters

proportions (list (optional)) – Proportions for the random pattern.

Returns

Return type

GridPattern

Methods

octa.patterns.GridPattern.GridPattern.AddNormalJitter(self, mu=0, std=1, axis=None)

Adds a sample from a random normal distribution to each element in the generated GridPattern.

Parameters
  • mu (float, optional) – Mean of the normal distribution. The default is 0.

  • std (float, optional) – Standard deviation of the normal distribution. The default is 1.

  • 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

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.AddUniformJitter(self, min_val=- 1, max_val=1, axis=None)

Adds a sample from a uniform distribution to each element in the pattern.

Parameters
  • min_val (float, optional) – Lower bound of the uniform distribution. The default is -1.

  • max_val (float, optional) – Upper bound of the uniform distribution. The default is 1.

  • 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

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.RandomizeAcrossElements(self)

Randomizes the order of the elements in the pattern.

Returns

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.RandomizeAcrossRows(self)

Randomizes the order of the elements across rows in the pattern.

Returns

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.RandomizeAcrossColumns(self)

Randomizes the order of the elements across columns in the pattern.

Returns

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.RandomizeAcrossLeftDiagonal(self)

Randomizes the order of the elements across the left diagonal in the pattern.

Returns

Updated GridPattern object instance

Return type

GridPattern

octa.patterns.GridPattern.GridPattern.RandomizeAcrossRightDiagonal(self)

Randomizes the order of the elements across the right diagonal in the pattern.

Returns

Updated GridPattern object instance

Return type

GridPattern