The Level class

class Level.Level(name, screen_res, zone_offset, transition_width=100, rgb=(1, 1, 1))[source]

An object that can be played for conditioning. You can add frames, events and rules to it to tune your conditioning.

Parameters:
  • name (str) – The name this Level will be refered to by (eg. in the default filename when saving)
  • screen_res (int, int) – The resolution of the simulation window. Set it to the resolution of the monitor if you are going to make the simulation full screen. eg.: (800,600)
  • zone_offset (int) – Zone offset in pixels, ie. what is the position of the mouse on the screen from the left.
  • transition_width (int) – How long should the transition (gradual fade) shold be between zones in pixels.
  • rgb (float, float, float) – Red, Green and Blue levels of the frames as floats between 0 and 1.
add_block(frame_type, *args, **kwargs)[source]

Adds a block of the specified type and parameters to the level.

add_event(name, event_type, *args)[source]

Adds an Event to the level which can be triggered by Rules.

Parameters:
  • name (string) – The name this Event can be referenced by
  • event_type (string) – type of the event can be ‘teleport’, ‘random_teleport’, ‘start_burst’, ‘stop_burst’, ‘port_on’, ‘port_off’, ‘pause’, ‘unpause’
  • args – The arguments for the Event of the given type.
add_rule(rule_type, event_name, *args)[source]

Adds a rule that triggers events based on animal behaviour.

Parameters:
  • rule_type (string) – The type of this rule, can be ‘zone’, ‘velocity’ or ‘speed’.
  • event_name (string) – The name of the Event this Rule can trigger.
  • args – The arguments for the Rule of the given type.
combined_frame

All the frames combined left to right.

dummy_frame

A frame that looks like the begining of the level.

image

An image of the Level’s combined frames.

play(*args, **kwargs)[source]

Plays the Level by making a Session for it.

Parameters:
  • args – Arguments of the Session created.
  • kwargs – Keyword arguments of the Session created.
render()[source]

Renders all the frames of the level, making it ready to be played.

save_image()[source]

Saves the picture of the Level

save_summary()[source]

Saves a human readable summary of the Level

show_image()[source]

Displays the level as a picture