コード例 #1
0
 def initializeWAMP(self):
     # define read and write locks
     self.rlock = None
     self.wlock = None
     
     # connect to the spectrometer
     self.raw = bool(RAW)
     self.spectrometer = oceanoptics.USB2000plus()
     self.spectrometer.integration_time(time_sec=INTEGRATION_TIME)
     self.wl = list(self.spectrometer.wavelengths())
     self.sp = list(self.spectrometer.intensities())
     
     # read new values off of spectrometer, lock while reading or writing
     @inlineCallbacks
     def capture():
         yield self.rlock 
         self.wlock = Deferred()
         self.sp = list(self.spectrometer.intensities())
         time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
         self.latestTime = time
         self.wlock.callback(None)
         self.wlock = None
         reactor.callLater(.1,capture)
         
     reactor.callInThread(capture)
     
     ## complete initialization
     BaseWAMP.initializeWAMP(self)
コード例 #2
0
 def initializeWAMP(self):
     config = self.config = SM_CONFIG
     ## construct a dictionary of steppermotor objects
     self.sms = {}
     for id, options in config.items():
         if DEBUG:
             self.sms[id] = FakeStepperMotor()
         elif options['pulse_channel'].find('ctr') is -1:
             print 'adding '+str(id)+' as a digital output sm'
             self.sms[id] = DigitalLineStepperMotor(
                 options['pulse_channel'],
                 options['counter_channel'],
                 options['direction_channel'],
                 step_rate = options['step_rate'],
                 backlash = options['backlash'],
                 log_file = options['log_file'],
                 enable_channel = options['enable_channel']
             )
         else:
             print 'adding '+str(id)+' as a counter output sm'
             self.sms[id] = PulseGeneratorStepperMotor(
                 options['pulse_channel'],
                 options['counter_channel'],
                 options['direction_channel'],
                 step_rate = options['step_rate'],
                 backlash = options['backlash'],
                 log_file = options['log_file'],
                 enable_channel = options['enable_channel']
             )
         
            
     ## complete initialization
     BaseWAMP.initializeWAMP(self)
コード例 #3
0
    def initializeWAMP(self):
        config = self.config = SM_CONFIG
        ## construct a dictionary of steppermotor objects
        self.sms = {}
        for id, options in config.items():
            if DEBUG:
                self.sms[id] = FakeStepperMotor()
            elif options['pulse_channel'].find('ctr') is -1:
                print 'adding ' + str(id) + ' as a digital output sm'
                self.sms[id] = DigitalLineStepperMotor(
                    options['pulse_channel'],
                    options['counter_channel'],
                    options['direction_channel'],
                    step_rate=options['step_rate'],
                    backlash=options['backlash'],
                    log_file=options['log_file'],
                    enable_channel=options['enable_channel'])
            else:
                print 'adding ' + str(id) + ' as a counter output sm'
                self.sms[id] = PulseGeneratorStepperMotor(
                    options['pulse_channel'],
                    options['counter_channel'],
                    options['direction_channel'],
                    step_rate=options['step_rate'],
                    backlash=options['backlash'],
                    log_file=options['log_file'],
                    enable_channel=options['enable_channel'])

        ## complete initialization
        BaseWAMP.initializeWAMP(self)
コード例 #4
0
 def initializeWAMP(self):
     protocol = yield getProtocol(
         TEST_STEPPER_MOTOR_SERVER if DEBUG else STEPPER_MOTOR_SERVER)
     self.polSM = ChunkedStepperMotorClient(protocol, POL)
     angle = yield getType(float, 'enter polarizer angle: ')
     self.offset = {}
     BaseWAMP.initializeWAMP(self)
     yield self.calibrateAngle(angle)
コード例 #5
0
 def initializeWAMP(self):        
     protocol = yield getProtocol(
         TEST_STEPPER_MOTOR_SERVER
         if DEBUG else
         STEPPER_MOTOR_SERVER
     )
     self.polSM = ChunkedStepperMotorClient(protocol,POL)
     angle = yield getType(float,'enter polarizer angle: ')
     self.offset = {}
     BaseWAMP.initializeWAMP(self)        
     yield self.calibrateAngle(angle)       
コード例 #6
0
 def initializeWAMP(self):
     self.tracking = False
     protocol = yield getProtocol(TEST_STEPPER_MOTOR_SERVER if DEBUG else STEPPER_MOTOR_SERVER)
     stepperMotors = self.stepperMotors = {id: ChunkedStepperMotorClient(protocol, id) for id in STEPPER_MOTOR_KEYS}
     calibrators = self.calibrators = {
         id: Calibrator() for id, Calibrator in ((KDP, KDPCrystalCalibrator), (BBO, BBOCrystalCalibrator))
     }
     self.offsets = {}
     wavelength = yield getType(float, "enter surf wavelength: ")
     BaseWAMP.initializeWAMP(self)
     yield self.calibrateWavelength(wavelength)
コード例 #7
0
 def initializeWAMP(self):
     self.tracking = False
     protocol = yield getProtocol(
         TEST_STEPPER_MOTOR_SERVER if DEBUG else STEPPER_MOTOR_SERVER)
     stepperMotors = self.stepperMotors = {
         id: ChunkedStepperMotorClient(protocol, id)
         for id in STEPPER_MOTOR_KEYS
     }
     calibrators = self.calibrators = {
         id: Calibrator()
         for id, Calibrator in ((KDP, KDPCrystalCalibrator),
                                (BBO, BBOCrystalCalibrator))
     }
     self.offsets = {}
     wavelength = yield getType(float, 'enter surf wavelength: ')
     BaseWAMP.initializeWAMP(self)
     yield self.calibrateWavelength(wavelength)
コード例 #8
0
    def initializeWAMP(self):
        config = self.config = SM_CONFIG
        ## construct a dictionary of steppermotor objects
        self.sms = {}
        for id, options in config.items():
            if DEBUG:
                self.sms[id] = FakeStepperMotor()
            elif options['pulse_channel'].find('ctr') is -1:
                print 'adding '+str(id)+' as a digital output sm'
                self.sms[id] = DigitalLineStepperMotor(
                    options['pulse_channel'],
                    options['counter_channel'],
                    options['direction_channel'],
                    step_rate = options['step_rate'],
                    backlash = options['backlash'],
                    log_file = options['log_file'],
                    enable_channel = options['enable_channel']
                )
            else:
                print 'adding '+str(id)+' as a counter output sm'
                self.sms[id] = PulseGeneratorStepperMotor(
                    options['pulse_channel'],
                    options['counter_channel'],
                    options['direction_channel'],
                    step_rate = options['step_rate'],
                    backlash = options['backlash'],
                    log_file = options['log_file'],
                    enable_channel = options['enable_channel']
                )
        
        ## build a dictionary of timers for enabled SMs;
        ## this is an example of how to start and stop a timer
        self.timers = {}
        for id, sm in self.sms.items():
            if sm.enable_channel is not None:
                self.timers[id] = reactor.callLater(
                    DELAY_TIME,
                    sm.disable
                )
                self.timers[id].cancel()

        ## complete initialization
        BaseWAMP.initializeWAMP(self)
コード例 #9
0
    def initializeWAMP(self):
        self.voltMeter = vm = yield getVoltMeter()
        self.updateLogFile()

        vm.setCallback(self._onVoltages)
        self.d = Deferred()
        self.d.addCallback(self.onVoltages)

        self.requests = []
        
        vm.setCallbackRate(CALLBACK_RATE)
        if TRIGGERING:
            getTriggerSourceEdge().addCallback(
                partial(
                    apply,
                    self.voltMeter.configureExternalTrigger
                )
            )
        vm.startSampling()
        BaseWAMP.initializeWAMP(self)
コード例 #10
0
    def initializeWAMP(self):
        self.voltMeter = vm = yield getVoltMeter()
        self.updateLogFile()

        vm.setCallback(self._onVoltages)
        self.d = Deferred()
        self.d.addCallback(self.onVoltages)

        self.requests = []
        
        vm.setCallbackRate(CALLBACK_RATE)
        if TRIGGERING:
            getTriggerSourceEdge().addCallback(
                partial(
                    apply,
                    self.voltMeter.configureExternalTrigger
                )
            )
        vm.startSampling()
        BaseWAMP.initializeWAMP(self)
コード例 #11
0
 def initializeWAMP(self):
     self.dgDict = dgDict
     self.dgOptions = DG_CONFIG if not DEBUG else DEBUG_DG_CONFIG
     BaseWAMP.initializeWAMP(self)
コード例 #12
0
 def initializeWAMP(self):
     self.dgDict = dgDict
     self.dgOptions = DG_CONFIG if not DEBUG else DEBUG_DG_CONFIG
     BaseWAMP.initializeWAMP(self)