Static functions

Functions that work with Frame objects.

Everything related to making LinMaze Frames.

Frame.multi_make(list_of_frames)[source]

Renders a list of frames with multiprocessing.

Parameters

list_of_frames ([Frame]) – A list of Frame objects that should be rendered.

Returns

A list of rendered Frames.

Frame.transition(left, right, transition_width)[source]

Takes two 2 dimensional matrices representing a grayscale image and returns them with a smooth transition of given width between them.

Parameters
  • left (np.array with ndim=2) – The image on the left.

  • right (np.array with ndim=2) – The image on the right.

  • transition_width (int) – The width of the smooth transition.

Frame.combine(list_of_frames)[source]

Makes a Frame that is a combination of a list of Frames.

Parameters

list_of_frames ([Frame]) – A list of Frame objects without transitions.

Returns

Frame

Abstract Frame classes

Abstract classes for all Frames to inherit from.

Frame

class Frame.Frame(width, height, rgb=(1, 1, 1))[source]

The visual component of the blocks that the mouse navigates in.

Parameters
  • width (int) – The width of the Frame in pixels.

  • height (int) – The height of the Frame in pixels.

  • rgb ((float, float, float)) – The Red, Green and Blue levels of the Frame.

static ext_make(frame)[source]

Tries to load the given Frame from cache or makes it and returns the rendered Frame.

make()[source]

Renders the Frame.

make_img()[source]

Makes a PIL Image of the Frame.

make_texture()[source]

Makes the Frame’s texture field that stores RGB data to be used as an OpenGL texture .

mirror()[source]

Horizontally mirrors the Frame

save_img(filename)[source]

Saves the bitmap image of the Frame with the given filename.

Parameters

filename (str) – The filename the image should be saved as.

show_img()[source]

Displays the bitmap image of the Frame.

Random Frame

class Frame.RandomFrame(width, height, seed)[source]

Bases: Frame.Frame

Abstract class all randomly generated Frames inherit from.

Parameters

seed – The seed of the random number generator

Wave Frame

class Frame.WaveFrame(width, height, wavelength, angle)[source]

Bases: Frame.Frame

Generic grating Frame, for more specific ones to inherit form.

Parameters
  • wavelength (int) – The wavelength of the grating in pixels, ie. the distance between the middles of the white portions.

  • angle (float) – The angle of the graing where 0 is vertical.

make()[source]

Renders the Frame.

static wave_func(val)[source]

Trigonometric function for a sinusoidal wave.

Specific Frames

All the different types of Frames you can make.

Binary noise

class Frame.BinaryNoise(width, height, seed)[source]

Bases: Frame.RandomFrame

Creates a Frame with noise, that only has black and white pixels

make()[source]

Renders the Frame.

Greyscale noise

class Frame.GreyNoise(width, height, seed)[source]

Bases: Frame.RandomFrame

Generates a frame with grayscale noise

make()[source]

Renders the Frame.

Checkerboard pattern

class Frame.Checkerboard(width, height, side_length)[source]

Bases: Frame.Frame

A Frame with a checkerboard pattern.

Parameters

side_length (int) – The length of sides of the squares that make up the checkerboard pattern in pixels.

make()[source]

Renders the Frame.

Cloud pattern

class Frame.Cloud(width, height, seed)[source]

Bases: Frame.RandomFrame

A Frame with a random cloud pattern in it.

make()[source]

Renders the Frame.

Marble pattern

class Frame.Marble(width, height, seed)[source]

Bases: Frame.RandomFrame

Generates a Frame with a marble pattern.

make()[source]

Renders the Frame.

Wood grain pattern

class Frame.Wood(width, height, seed)[source]

Bases: Frame.RandomFrame

Generates a Frame with a wood grain pattern.

make()[source]

Renders the Frame.

Sine wave modulated grating

class Frame.SineWave(width, height, wavelength, angle)[source]

Bases: Frame.WaveFrame

Sine wave modulated grating pattern Frame.

make()[source]

Renders the Frame.

Square wave modulated grating

class Frame.SquareWave(width, height, wavelength, angle)[source]

Bases: Frame.WaveFrame

Square wave modulated grating pattern Frame.

make()[source]

Renders the Frame.

Image file as Frame

class Frame.ImageFile(height, filename)[source]

Bases: Frame.Frame

A Frame made from a given image file.

Parameters

filename (string) – The name of the file the Frame should be made from.

make()[source]

Renders the Frame.

make_texture()[source]

Makes the Frame’s texture field that stores RGB data to be used as an OpenGL texture .