from labscript_devices.NovaTechDDS9M import NovaTechDDS9M
from labscript_devices.Camera import Camera
from labscript_devices.PineBlaster import PineBlaster
from labscript_devices.NI_PCI_6733 import NI_PCI_6733
from labscript_utils.unitconversions import *

PulseBlaster(name='pulseblaster_0', board_number=0)
ClockLine(name='pulseblaster_0_clockline_fast',
          pseudoclock=pulseblaster_0.pseudoclock,
          connection='flag 0')
ClockLine(name='pulseblaster_0_clockline_slow',
          pseudoclock=pulseblaster_0.pseudoclock,
          connection='flag 1')
NI_PCIe_6363(name='ni_card_0',
             parent_device=pulseblaster_0_clockline_fast,
             clock_terminal='ni_pcie_6363_0/PFI0',
             MAX_name='ni_pcie_6363_0',
             acquisition_rate=100e3)
NovaTechDDS9M(name='novatechdds9m_0',
              parent_device=pulseblaster_0_clockline_slow,
              com_port="com10")

# Create a BIAS Camera, tirggered to take photos with flag 3 of pulseblaster_0
Camera('andor_ixon_0',
       pulseblaster_0.direct_outputs,
       'flag 3',
       BIAS_port=42520,
       serial_number="0000",
       SDK="IMAQdx",
       effective_pixel_size=4.6e-6,
       exposure_time=.1,
from labscript import *
from labscript_devices.PulseBlaster import PulseBlaster
from labscript_devices.NI_PCIe_6363 import NI_PCIe_6363

# Device definitions:
PulseBlaster(name='pulseblaster_0', board_number=0)
# Create a clock on one of the PulseBlaster's outputs:
ClockLine(
    name='pulseblaster_pseudoclock',
    pseudoclock=pulseblaster_0.pseudoclock,
    connection='flag 1',
)
NI_PCIe_6363(
    name='ni_card_0',
    parent_device=pulseblaster_pseudoclock,
    MAX_name='ni_pcie_6363_0',
    clock_terminal='/ni_pcie_6363_0/PFI0',
)

# Channel definitions:
Shutter(name='laser_shutter', parent_device=ni_card_0, connection='port0/line13')
AnalogOut(name='quadrupole_field', parent_device=ni_card_0, connection='ao0')
AnalogOut(name='bias_x_field', parent_device=ni_card_0, connection='ao1')

# Experiment logic:
start()
t = 0

# First laser pulse at t = 1 second:
t += 1
laser_shutter.open(t)