示例#1
0
 def analogOn(self, channel_id):
     if not self.filming:
         nicontrol.setAnalogLine(
             self.analog_settings[channel_id].board,
             self.analog_settings[channel_id].channel,
             self.analog_settings[channel_id].max_voltage,
         )
    def __init__(self, hardware, parameters, parent):
        QtGui.QMainWindow.__init__(self, parent)
        halModule.HalModule.__init__(self)

        # Define default values
        self.x_offset = 0.0
        self.y_offset = 0.0
        self.x_amp = 1.0
        self.y_amp = 1.0
        self.x_freq = 1000.0 # In Hz
        self.y_freq = 1000.0 # In Hz
        self.running = False
        self.run_during_film = False

        self.home_voltage = [0.0, 0.0]

        self.output_limits = [-10.0, 10.0]
        self.sampleRate = 2500.0 # In Hz
        
        self.ni_task = False

        # Initialize waveform
        self.waveform = False

        # update parameters
        self.parameters = parameters
        
        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup
        self.ui = galvoUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Galvo Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)

        self.ui.activateButton.setText("Run")
        self.ui.activateButton.clicked.connect(self.handleActivate)

        # set modeless
        self.setModal(False)

        # Update display
        self.updateDisplay()

        # Initialize to home voltage
        nicontrol.setAnalogLine("USB-6002", 0, self.home_voltage[0])
        nicontrol.setAnalogLine("USB-6002", 1, self.home_voltage[1])
 def zMoveTo(self, z):
     with mclLock:
         try:
             voltage = z * self.scale
             if (voltage > 0.0) and (voltage < 10.0):
                 nicontrol.setAnalogLine(self.board, self.line, voltage)
                 #self.ni_task.output(voltage)
         except AssertionError as e:
             print "Caught outputVoltage error:", type(e), str(e)
    def stopTask(self):
        # Stop current task
        self.ni_task.stopTask()
        self.ni_task.clearTask()

        # Return to home voltage
        nicontrol.setAnalogLine("USB-6002", 0, self.home_voltage[0])
        nicontrol.setAnalogLine("USB-6002", 1, self.home_voltage[1])

        # Update internal state
        self.running = False
 def amplitudeOn(self, channel_id, amplitude):
     nicontrol.setAnalogLine(self.channel_parameters[channel_id].board,
                             self.channel_parameters[channel_id].channel,
                             0.001 * amplitude)
 def amplitudeOff(self, channel_id):
     nicontrol.setAnalogLine(self.channel_parameters[channel_id].board,
                             self.channel_parameters[channel_id].channel,
                             self.channel_parameters[channel_id].min_voltage)
示例#7
0
 def zMoveTo(self, z):
     #self.ao_task.output(self.scale * z)
     #nicontrol.setAnalogLine("PCI-6713", 0, self.scale * z)
     nicontrol.setAnalogLine("PCIe-6259", 0, self.scale * z)
示例#8
0
 def analogOn(self, channel_id):
     if not self.filming:
         nicontrol.setAnalogLine(self.analog_settings[channel_id].board,
                                 self.analog_settings[channel_id].channel,
                                 self.analog_settings[channel_id].max_voltage)
示例#9
0
 def amplitudeOn(self, channel_id, amplitude):
     nicontrol.setAnalogLine(self.channel_parameters[channel_id].board,
                             self.channel_parameters[channel_id].channel,
                             0.001 * amplitude)
示例#10
0
 def amplitudeOff(self, channel_id):
     nicontrol.setAnalogLine(self.channel_parameters[channel_id].board,
                             self.channel_parameters[channel_id].channel,
                             self.channel_parameters[channel_id].min_voltage)