ethoscope.hardware.interfaces package

Submodules

ethoscope.hardware.interfaces.interfaces module

class ethoscope.hardware.interfaces.interfaces.BaseInterface(do_warm_up=True)[source]

Bases: object

Template class which is an abstract representation of an hardware interface. It must define, in __init__(), how the interface is connected, and in send(), how information are communicated to the hardware. In addition, derived classes must implement a _warm_up(), method, which defines optionnal instructions passed to the hardware upon first connection (that is useful to experimenters that want to manually check their settings).

Parameters:do_warm_up
send(**kwargs)[source]

Method to request hardware interface to interact with the physical world. :param kwargs: keywords arguments

class ethoscope.hardware.interfaces.interfaces.DefaultInterface(do_warm_up=True)[source]

Bases: ethoscope.hardware.interfaces.interfaces.BaseInterface

Class that implements a dummy interface that does nothing. This can be used to keep software consistency when no hardware is to be used.

Template class which is an abstract representation of an hardware interface. It must define, in __init__(), how the interface is connected, and in send(), how information are communicated to the hardware. In addition, derived classes must implement a _warm_up(), method, which defines optionnal instructions passed to the hardware upon first connection (that is useful to experimenters that want to manually check their settings).

Parameters:do_warm_up
send(**kwargs)[source]
class ethoscope.hardware.interfaces.interfaces.HardwareConnection(interface_class, *args, **kwargs)[source]

Bases: threading.Thread

A class to build a connection to arbitrary hardware. It implements an instance of a BaseInterface which it uses to send instructions, asynchronously and on demand.

Parameters:
  • interface_class (class) – the class to use a an interface to hardware (derives from BaseInterface)
  • args – list of arguments passed the the hardware interface
  • kwargs – list of keyword arguments passed the the hardware interface
run()[source]

Infinite loop that send instructions to the hardware interface Do not call directly, used the start() method instead.

send_instruction(instruction=None)[source]

Stage an instruction to be sent to the hardware interface. Instructions will be parsed sequentially, but asynchronously from the main thread execution. :param instruction: a dictionary of keyword arguments ,matching those of interface_class.send(). :type instruction: dict()

stop(error=None)[source]

ethoscope.hardware.interfaces.sleep_depriver_interface module

class ethoscope.hardware.interfaces.sleep_depriver_interface.SleepDepriverInterface(port=None, *args, **kwargs)[source]

Bases: ethoscope.hardware.interfaces.lynx_motion.SimpleLynxMotionInterface

Class to connect and abstract the SSC-32U Lynx Motion servo controller. It assumes a BAUD of 115200, which can be configured on the board as described in the user manual (page 34).

Parameters:
  • port (str.) – the serial port to use. Automatic detection if None.
  • args – additional arguments
  • kwargs – additional keyword arguments
send(channel, dt=350, margin=10)[source]

Sleep deprive an animal by rotating its tube.

Parameters:
  • channel (int) – The channel to use (i.e. the number of the servo)
  • dt (int) – The time it takes to go from 0 to 180 degrees (in ms)
  • margin – the number of degree to pad rotation. eg 5 -> rotation from 5 -> 175
class ethoscope.hardware.interfaces.sleep_depriver_interface.SleepDepriverInterfaceCR(port=None, *args, **kwargs)[source]

Bases: ethoscope.hardware.interfaces.lynx_motion.SimpleLynxMotionInterface

Class to connect and abstract the SSC-32U Lynx Motion servo controller. It assumes a BAUD of 115200, which can be configured on the board as described in the user manual (page 34).

Parameters:
  • port (str.) – the serial port to use. Automatic detection if None.
  • args – additional arguments
  • kwargs – additional keyword arguments
send(channel, dt=800)[source]

Sleep deprive an animal by rotating its tube.

Parameters:
  • channel (int) – The channel to use (i.e. the number of the servo)
  • dt (int) – The time it takes to go from 0 to 180 degrees (in ms)
  • margin – the number of degree to pad rotation. eg 5 -> rotation from 5 -> 175

Module contents