def laser_toggle():
    """Toggle laser on or off
    Laser needs to be connected to DAQ_PORT and switched to "Digital modulation"
    If you use additional safety measurements to control the laser, make sure to undo them before starting the protocol!"""

    laser = DigitalModDevice(LSR_DAQ_PORT)
    laser.toggle()
    print("Laser was toggled")
def deliver_tone_shock():
    """
    Activates tone signal via digital trigger. Cycle is optional
    :param rep: Number of repetitions for signal [int]
    :param duration: Duration in seconds of signal for each rep [float]
    :param inter_time: Time in seconds between reps [float]
    """

    tone_gen = DigitalModDevice('Dev1/PFI5')
    tone_gen.toggle()
Example #3
0
    def _setup_device(type, port, ip):
        device = None
        if type == "NI":
            from experiments.utils.DAQ_output import DigitalModDevice

            device = DigitalModDevice(port)

        if type == "RASPBERRY":
            from experiments.utils.gpio_control import DigitalPiDevice

            device = DigitalPiDevice(port)

        if type == "RASP_NETWORK":
            from experiments.utils.gpio_control import DigitalPiDevice

            if ip is not None:
                device = DigitalPiDevice(port, ip)
            else:
                raise ValueError("IP required for remote GPIO control.")

        if type == "ARDUINO":
            from experiments.utils.gpio_control import DigitalArduinoDevice

            device = DigitalArduinoDevice(port)

        return device
def deliver_airpuff(rep: int = 1,
                    duration: float = 0.1,
                    inter_time: float = 0.1):
    """Controls pressure micro-injector via digital trigger signal.
    All other parameters need to be manually changed on the Device, this only triggers it!"""

    pump = DigitalModDevice(AP_DAQ_PORT)
    if rep > 1:
        pump.cycle(rep, duration, inter_time)
    else:
        pump.trigger()
    def _setup_device(type, port, ip):
        device = None
        if type == 'NI':
            from experiments.utils.DAQ_output import DigitalModDevice
            device = DigitalModDevice(port)

        if type == 'RASPBERRY':
            from experiments.utils.gpio_control import DigitialPiBoardDevice
            device = DigitialPiBoardDevice(port)

        if type == 'RASP_NETWORK':
            from experiments.utils.gpio_control import DigitialPiBoardDevice
            if ip is not None:
                device = DigitialPiBoardDevice(port, ip)
            else:
                raise ValueError('IP required for remote GPIO control.')

        return device
def laser_switch(switch: bool = False):
    """Toggle laser on or off
    Laser needs to be connected to DAQ_PORT and switched to "Digital modulation"
    If you use additional safety measurements to control the laser, make sure to undo them before starting the protocol!"""

    laser = DigitalModDevice(LSR_DAQ_PORT)
    if switch:
        laser.turn_on()
        print("Laser is switched on")

    else:
        laser.turn_off()
        print("Laser is switched off")
def toggle_device():
    """Controls micro peristaltic pump via digital trigger signal."""
    device = DigitalModDevice('Dev1/PFI2')
    device.toggle()
def withdraw_liqreward():
    """activates micro peristaltic pump"""
    pump_withdraw = DigitalModDevice('Dev1/PFI6')
    pump_withdraw.timed_on(3.5)
def deliver_liqreward():
    """Controls micro peristaltic pump via digital trigger signal."""
    pump_delivery = DigitalModDevice('Dev1/PFI2')
    pump_delivery.toggle()