data = MyList() id_a = create_callbackdata_id(data) EveryNCallback = DAQmxEveryNSamplesEventCallbackPtr(EveryNCallback_py) DAQmxRegisterEveryNSamplesEvent(AItaskHandle,DAQmx_Val_Acquired_Into_Buffer,100,0,EveryNCallback,id_a) DoneCallback = DAQmxDoneEventCallbackPtr(DoneCallback_py) DAQmxRegisterDoneEvent(AItaskHandle,0,DoneCallback,None) os.system("del data.txt") os.system("del datach1new.txt") os.system("del datach2new.txt") total_data = [] #total_data = numpy.zeros((1,), dtype=numpy.float64) iDevIdx,iModuleType,iSlotID = sepia.initialise() for i in range (0,12): intensity = int(100 - i*3) sepia.set_laser_intensity(intensity,iDevIdx) DAQmxStartTask(AItaskHandle) DAQmxStartTask(AOtaskHandle) time.sleep(4.0) #raw_input('Acquiring samples continuously. Press Enter to interrupt\n') DAQmxStopTask(AItaskHandle) DAQmxStopTask(AOtaskHandle) temp_data = get_callbackdata_from_id(id_a) #total_data = total_data.append(temp_data) offset = 1 peak_length = 2
def check_set_states(iDevIdx,iSlotID,input_intensity,input_frequency): intensity2,frequency_number2,pulse_mode2,head_id2 = sepia.get_laser_states(iDevIdx) if (intensity2 != input_intensity or frequency_number2 != input_frequency): ##TODO: Send command to ORCA to cancel the run sys.exit('States have not been correctly set! Aborting run!') return ## START OF THE PROGRAM ################################################################################################# ## TODO: Need a while loop looking for communication from ORCA ##Initialisation steps iDevIdx,iModuleType,iSlotID = sepia.initialise() #Initialise the Sepia 2 box ## TODO: Need to check the relay switch here ## TODO: Need to check connections and error status and send to ORCA set_safe_states(iDevIdx,iSlotID) ##sets all the laser components to their safe states print here iDevIdx,iModuleType,iSlotID = sepia.initialise() #Initialise the Sepia 2 box sepia.laser_soft_lock_on(iDevIdx,iSlotID) print "here" check_safe_states(iDevIdx,iSlotID) ##checks all devices are in their safe states print "here check safe states" #setting up the relay box rs.SetRSChannel(4) ##sets the relay channel to 1 sepia.close(iDevIdx)
data = MyList() id_a = create_callbackdata_id(data) EveryNCallback = DAQmxEveryNSamplesEventCallbackPtr(EveryNCallback_py) DAQmxRegisterEveryNSamplesEvent(AItaskHandle, DAQmx_Val_Acquired_Into_Buffer, 100, 0, EveryNCallback, id_a) DoneCallback = DAQmxDoneEventCallbackPtr(DoneCallback_py) DAQmxRegisterDoneEvent(AItaskHandle, 0, DoneCallback, None) os.system("del data.txt") os.system("del datach1new.txt") os.system("del datach2new.txt") total_data = [] #total_data = numpy.zeros((1,), dtype=numpy.float64) iDevIdx, iModuleType, iSlotID = sepia.initialise() for i in range(0, 12): intensity = int(100 - i * 3) sepia.set_laser_intensity(intensity, iDevIdx) DAQmxStartTask(AItaskHandle) DAQmxStartTask(AOtaskHandle) time.sleep(4.0) #raw_input('Acquiring samples continuously. Press Enter to interrupt\n') DAQmxStopTask(AItaskHandle) DAQmxStopTask(AOtaskHandle) temp_data = get_callbackdata_from_id(id_a) #total_data = total_data.append(temp_data) offset = 1 peak_length = 2