pyoperant.components module¶
-
class
pyoperant.components.
BaseComponent
(name=None, *args, **kwargs)[source]¶ Bases:
object
Base class for physcal component
-
class
pyoperant.components.
Hopper
(IR, solenoid, max_lag=0.3, inverted=False, *args, **kwargs)[source]¶ Bases:
pyoperant.components.BaseComponent
Class which holds information about a hopper
Parameters: - solenoid (hwio.BooleanOutput) – output channel to activate the solenoid & raise the hopper
- IR (
hwio.BooleanInput
) – input channel for the IR beam to check if the hopper is up - max_lag (float, optional) – time in seconds to wait before checking to make sure the hopper is up (default=0.3)
-
solenoid
¶ hwio.BooleanOutput
output channel to activate the solenoid & raise the hopper
-
IR
¶ hwio.BooleanInput
input channel for the IR beam to check if the hopper is up
-
max_lag
¶ float
time in seconds to wait before checking to make sure the hopper is up
-
check
()[source]¶ reads the status of solenoid & IR beam, then throws an error if they don’t match
Returns: True if the hopper is up.
Return type: bool
Raises: HopperActiveError
– The Hopper is up and it shouldn’t be. (The IR beam is tripped, but the solenoid is not active.)HopperInactiveError
– The Hopper is down and it shouldn’t be. (The IR beam is not tripped, but the solenoid is active.)
-
down
()[source]¶ Lowers the hopper.
Returns: True if the hopper drops. Return type: bool Raises: HopperWontDropError
– The Hopper did not drop.
-
feed
(dur=2.0, error_check=True)[source]¶ Performs a feed
- dur : float, optional
- duration of feed in seconds
Returns: Timestamp of the feed and the feed duration
Return type: (datetime, float)
Raises: HopperAlreadyUpError
– The Hopper was already up at the beginning of the feed.HopperWontComeUpError
– The Hopper did not raise for the feed.HopperWontDropError
– The Hopper did not drop fater the feed.
-
up
()[source]¶ Raises the hopper up.
Returns: True if the hopper comes up. Return type: bool Raises: HopperWontComeUpError
– The Hopper did not raise.
-
exception
pyoperant.components.
HopperActiveError
[source]¶ Bases:
pyoperant.errors.ComponentError
raised when the hopper is up when it shouldn’t be
-
exception
pyoperant.components.
HopperAlreadyUpError
[source]¶ Bases:
pyoperant.components.HopperActiveError
raised when the hopper is already up before it goes up
-
exception
pyoperant.components.
HopperInactiveError
[source]¶ Bases:
pyoperant.errors.ComponentError
raised when the hopper is down when it shouldn’t be
-
exception
pyoperant.components.
HopperWontComeUpError
[source]¶ Bases:
pyoperant.components.HopperInactiveError
raised when the hopper won’t come up
-
exception
pyoperant.components.
HopperWontDropError
[source]¶ Bases:
pyoperant.components.HopperActiveError
raised when the hopper won’t drop
-
class
pyoperant.components.
HouseLight
(light, *args, **kwargs)[source]¶ Bases:
pyoperant.components.BaseComponent
Class which holds information about the house light
- light : hwio.BooleanOutput
- output channel to turn the light on and off
Methods: on() – off() – timeout(dur) – turns off the house light for ‘dur’ seconds (default=10.0) punish() – calls timeout() for ‘value’ as ‘dur’
-
class
pyoperant.components.
LEDStripHouseLight
(lights, color=[100.0, 100.0, 100.0, 100.0], *args, **kwargs)[source]¶ Bases:
pyoperant.components.BaseComponent
Class which holds information about the RGBW LED Strip PWM house light
- light : hwio.PWMOutputs
- [R, G, B, W] output channels to turn the light on and off
Methods: on() – off() – set_color() – set the color change_color – sets color and turns on light timeout(dur) – turns off the house light for ‘dur’ seconds (default=10.0) punish() – calls timeout() for ‘value’ as ‘dur’
-
class
pyoperant.components.
PeckPort
(IR, LED, inverted=False, *args, **kwargs)[source]¶ Bases:
pyoperant.components.BaseComponent
Class which holds information about peck ports
Parameters: - LED (hwio.BooleanOutput) – output channel to activate the LED in the peck port
- IR (hwio.BooleanInput) – input channel for the IR beam to check for a peck
-
LED
¶ hwio.BooleanOutput
output channel to activate the LED in the peck port
-
IR
¶ hwio.BooleanInput
input channel for the IR beam to check for a peck
-
flash
(dur=1.0, isi=0.1)[source]¶ Flashes the LED on and off with isi seconds high and low for dur seconds, then revert LED to prior state.
Parameters: - dur (float, optional) – Duration of the light flash in seconds.
- isi (float,optional) – Time interval between toggles. (0.5 * period)
Returns: Timestamp of the flash and the flash duration
Return type: (datetime, float)
-
class
pyoperant.components.
RGBLight
(red, green, blue, *args, **kwargs)[source]¶ Bases:
pyoperant.components.BaseComponent
Class which holds information about an RGB cue light
- red : hwio.BooleanOutput
- output channel for the red LED
- green : hwio.BooleanOutput
- output channel for the green LED
- blue : hwio.BooleanOutput
- output channel for the blue LED