def set_safe_states(iDevIdx,iSlotID):
	sepia.laser_soft_lock_on(iDevIdx,iSlotID)	## turns the laser soft lock on 
	sepia.set_laser_intensity(0,iDevIdx)          #sets the intensity to 0%
	## TODO: Need to fix the frequencies in safepysepia and also need to check the numbers for internal and external triggers. 
	sepia.set_laser_frequency(6,iDevIdx) 		##sets the frequency to external trigger need to check this
	rs.SetRSChannel(0)			        ##sets the relay box to channel 0 (default channel)
	sepia.close(iDevIdx)
	rs.Execute()                                    ##executes the relay switch channel
def check_safe_states(iDevIdx,iSlotID):
	intensity,frequency_number,pulse_mode,head_id = sepia.get_laser_states(iDevIdx)
        print intensity,frequency_number,pulse_mode,head_id
	if (intensity != 0 or frequency_number != 6 or pulse_mode != 1):
		##TODO: Send command to ORCA to cancel the run
        	sepia.set_laser_intensity(0,iDevIdx)
		sys.exit('Safe states are not correctly set! Aborting run! (1)')
	##Check relay switch channel status 	
	relay_switch_default_channel = rs.GetDisplayChannel()
	if (relay_switch_default_channel != 0):
		##TODO: Send command to ORCA to cancel the run
                print "Stuff going wrong"
                #sepia.close(iDevIdx)
		#sys.exit('Safe states are not correctly set! Aborting run! (2)')
	##Check the laser soft lock status 	
	#laser_lock_on_check = sepia.get_laser_lock_status(iDevIdx,iSlotID)
	#print laser_lock_on_check 
	#if (laser_lock_on_check != 1):
		##TODO: Send command to ORCA to cancel the run
        #	sepia.laser_soft_lock_on(iDevIdx,iSlotID)
        #	print sepia.get_laser_lock_status(iDevIdx,iSlotID)
 	#	sys.exit('Safe states are not correctly set! Aborting run! (3)')
	return 	
Exemple #3
0
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
	threshold = 0.3
	time.sleep(3.0)
#setting up the relay box

rs.SetRSChannel(4)				##sets the relay channel to 1
sepia.close(iDevIdx)
rs.Execute()                                    ##executes the relay switch channel
iDevIdx,iModuleType,iSlotID = sepia.initialise() #Initialise the Sepia 2 box
sepia.laser_soft_lock_on(iDevIdx,iSlotID)


##set parameters stage
## these numbers need to integers 
input_intensity = 100
input_frequency = 4		                ##I think this corresponds to 5Hz
#input_rs_channel = 1
#input_fs_channel = 1  
sepia.set_laser_intensity(input_intensity,iDevIdx)	##sets the intensity to 100%
print "here1"
sepia.set_laser_frequency(input_frequency,iDevIdx)		##sets the frequency
print "here2"
#sepia.close(iDevIdx)
#sys.exit("forced exit here")

fs.SetFSChannel(54)				##sets the fibre switch channel to 1 
check_set_states(iDevIdx,iSlotID,input_intensity,input_frequency)

##TODO: Dry test using only the PMT's (this section needs to be put in ) 

##TODO: Send ORCA Parameters 

sepia.laser_soft_lock_off(iDevIdx,iSlotID)		## this function unlocks the laser 
time.sleep(5)						## pulse laser for 10 seconds
Exemple #5
0
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
    threshold = 0.3
    time.sleep(3.0)