pyoperant.hwio module

class pyoperant.hwio.AudioOutput(interface=None, params={}, *args, **kwargs)[source]

Bases: pyoperant.hwio.BaseIO

Class which holds information about audio outputs and abstracts the methods of writing to them

Keyword arguments: interface – Interface() instance. Must have the methods ‘_queue_wav’,

‘_play_wav’, ‘_stop_wav’

params – dictionary of keyword:value pairs needed by the interface

Methods: queue(wav_filename) – queues read() – if the interface supports ‘_read_bool’ for this output, returns

the current value of the output from the interface. Otherwise this returns the last passed by write(value)

toggle() – flips the value from the current value

play()[source]
queue(wav_filename)[source]
stop()[source]
class pyoperant.hwio.BaseIO(interface=None, params={}, *args, **kwargs)[source]

Bases: object

any type of IO device. maintains info on interface for query IO device

class pyoperant.hwio.BooleanInput(interface=None, params={}, *args, **kwargs)[source]

Bases: pyoperant.hwio.BaseIO

Class which holds information about inputs and abstracts the methods of querying their values

Keyword arguments: interface – Interface() instance. Must have ‘_read_bool’ method. params – dictionary of keyword:value pairs needed by the interface

Methods: read() – reads value of the input. Returns a boolean poll() – polls the input until value is True. Returns the time of the change

callback(func)[source]
config()[source]
poll(timeout=None)[source]

runs a loop, querying for pecks. returns peck time or “GoodNite” exception

read()[source]

read status

class pyoperant.hwio.BooleanOutput(interface=None, params={}, *args, **kwargs)[source]

Bases: pyoperant.hwio.BaseIO

Class which holds information about outputs and abstracts the methods of writing to them

Keyword arguments: interface – Interface() instance. Must have ‘_write_bool’ method. params – dictionary of keyword:value pairs needed by the interface

Methods: write(value) – writes a value to the output. Returns the value read() – if the interface supports ‘_read_bool’ for this output, returns

the current value of the output from the interface. Otherwise this returns the last passed by write(value)

toggle() – flips the value from the current value

config()[source]
read()[source]

read status

toggle()[source]
write(value=False)[source]

write status

class pyoperant.hwio.PWMOutput(interface=None, params={}, *args, **kwargs)[source]

Bases: pyoperant.hwio.BaseIO

Class which abstracts the writing to PWM outputs

Keyword Arguments:
 
  • interface – Interface() instance. Must have ‘_write_bool’ method.

  • params – dictionary of keyword:value pairs needed by the interface

  • Methods

  • write(value) – writes a value to the output. Returns the value

  • read() – if the interface supports ‘_read_bool’ for this output, returns

    the current value of the output from the interface. Otherwise this returns the last passed by write(value)

config()[source]
read()[source]

read status

toggle()[source]

flip value

write(val=0.0)[source]

write status