def test_run(ls_channel, fs_input_channel, logfile, iDevIdx, iModuleType, iSlotID):
    
    print "Installation Testing (Test Run) - Testing Laser Switch Channel: " + str(ls_channel)
    set_laser_switch_channel(ls_channel)
    sepiaUser.set_laser_intensity(100, iDevIdx) # set the intensity to 100%
    #sepiaUser.set_laser_frequency(4, iDevIdx) # this is the internal 5MHz trigger frequency ... use to check if Sepia is working properly
    
    for fs_output_channel in range(1, 15):

        channel_number = ((fs_input_channel - 1) * 14) + fs_output_channel
        fs.SetFSChannel(channel_number) # set the fibreSwitch channel
        sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID) # unlock the laser
        time.sleep(1)

        # this section of code is for generating a pulse via the NI Box, and reading the PMT value
        trigger_frequency = 10000
        number_of_pulses = 100000
        digi_trig = ni.GenerateDigitalTrigger(trigger_frequency, number_of_pulses)
        read_signal = ni.AcquireAnalogue()
        number_of_measurements = 1
        voltage_signal = str(read_signal.start(number_of_measurements))
        digi_trig.start()
        digi_trig.stop()
        read_signal = ni.AcquireAnalogue()
        a = raw_input("Generating pulse train ... press Enter to interrupt ...\n")
        read_signal.stop()

        logfile.write(str(ls_channel) + '\t' + str(channel_number) + '\t' + voltage_signal[1:-1] + '\n')
        
    sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
Beispiel #2
0
def perform_run(connection, number_of_pulses, trigger_frequency, iDevIdx, iSlotID):
# try/except statement didn't work here during testing with SNO+. Need to know why? 
	
	sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)
	digi_trig = ni.GenerateDigitalTrigger(trigger_frequency, number_of_pulses)
	digi_trig.start()
	digi_trig.stop()
	sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
	sepiaUser.close(iDevIdx)
	connection.send(continue_flag)
Beispiel #3
0
def perform_run(connection, number_of_pulses, trigger_frequency, iDevIdx,
                iSlotID):
    # try/except statement didn't work here during testing with SNO+. Need to know why?

    sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)
    digi_trig = ni.GenerateDigitalTrigger(trigger_frequency, number_of_pulses)
    digi_trig.start()
    digi_trig.stop()
    sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
    sepiaUser.close(iDevIdx)
    connection.send(continue_flag)
Beispiel #4
0
def set_soft_lock_off():
    retValue = 0
    try:
        print "Set laser soft lock on"
        iDevIdx,iModuleType,iSlotID = sepiaUser.initialiseSCMModule()
        time.sleep(1.0)
        sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)
        time.sleep(1.0)
        sepiaUser.close(iDevIdx)
    except errorCode, Argument:
        retValue = "Error: " + str(errorCode) + "  " + str(Argument)
def test_run(ls_channel, fs_input_channel, iDevIdx, iModuleType, iSlotID):
    
    print "Installation Testing (Test Run) - Testing Laser Switch Channel: " + str(ls_channel)
    set_laser_switch_channel(ls_channel)
    sepiaUser.set_laser_intensity(100, iDevIdx) # set the intensity to 100%
    sepiaUser.set_laser_frequency(2, iDevIdx) # this is the internal 5MHz trigger frequency ... use to check if Sepia is working properly
    
    for fs_output_channel in range(1, 15):

        channel_number = ((fs_input_channel - 1) * 14) + fs_output_channel
        fs.SetFSChannel(channel_number) # set the fibreSwitch channel
        sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID) # unlock the laser
        time.sleep(10) 
        sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
Beispiel #6
0
def cycleFibreSwitch(fs_input_channel,ls_channel):

    operation_mode = 6

    iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() 
    set_to_safe_state(iDevIdx, iSlotID)

    iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() 
    set_laser_switch_channel(ls_channel)

    iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()                    # re-initialise Sepia 
    sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)                          # soft lock on

    sepiaUser.set_laser_frequency(operation_mode, iDevIdx)

    intensity_value = 0

    print "FibreSwitchInput:" + str(fs_input_channel)
    print "LaserChannel:" + str(ls_channel)

    for intensity_iterator in range(0,80):

        intensity_value = 100 - intensity_iterator

        sepiaUser.set_laser_intensity(intensity_value, iDevIdx)
                                                   
        for fs_output_channel in range(7, 13):

            channel_number = ((fs_input_channel - 1) * 14) + fs_output_channel
            print "Intensity Value:" + str(intensity_value) +" FibreSwitchOutput:" + str(fs_output_channel)
            fs.SetFSChannel(channel_number) # set the fibreSwitch channel
            
            sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID) # unlock the laser
            time.sleep(5) 
            sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
            time.sleep(1)
        
    sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)                          # soft lock on
    sepiaUser.close(iDevIdx)                                                # close the Sepia box down... 
    
    time.sleep(1)
def setLaserAndFibreSwitch(ls_channel,fs_input_channel,fs_output_channel,time_in_minutes,operation_mode,intensity):
    
    iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() 
    set_to_safe_state(iDevIdx, iSlotID)                                     # set all the laser parameters to safe values

    set_laser_switch_channel(ls_channel)
    sepiaUser.set_laser_intensity(intensity, iDevIdx) # set the intensity to 100%
    sepiaUser.set_laser_frequency(operation_mode, iDevIdx) 


    channel_number = ((fs_input_channel - 1) * 14) + fs_output_channel      # pick the correct channel number
    print(channel_number)
    fs.SetFSChannel(channel_number)                                         # set the fibreSwitch channel
    laserTime = time_in_minutes*60.0                                        # time for program to wait before locking the laser (i.e. laser operating time)
    sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)                         # unlock the laser
    time.sleep(laserTime)                                                   # make Python sleep while laser is working 

    iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()                    # re-initialise Sepia 
    sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)                          # soft lock on
    sepiaUser.close(iDevIdx)                                                # close the Sepia box down...
    
    time.sleep(1)
Beispiel #8
0
def test_run(ls_channel, fs_input_channel, logfile, iDevIdx, iModuleType, iSlotID):
    print "Installation Testing (Test Run) - Testing Laser Switch Channel: " + str(ls_channel)
    set_laser_switch_channel(ls_channel)
    sepiaUser.set_laser_intensity(100, iDevIdx)	    # set the intensity to 100%
    sepiaUser.set_laser_frequency(4, iDevIdx)		# this is the internal 5MHz trigger frequency ... use to check if Sepia is working properly
    
    for fs_output_channel in range(1, 15):
        
		channel_number = ((fs_input_channel - 1) * 14) + fs_output_channel
        fs.SetFSChannel(channel_number)                          # set the fibreSwitch channel 
        sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)		     # unlock the laser 
        time.sleep(1)						

        # this section of code is for generating a pulse via the NI Box, and reading the PMT value
        trigger_frequency = 10000
        number_of_pulses = 100000
        digi_trig = ni.GenerateDigitalTrigger(trigger_frequency, number_of_pulses)
        read_signal = ni.AcquireAnalogue()
        number_of_measurements = 1  
        voltage_signal = str(read_signal.start(number_of_measurements))
		digi_trig.start()
        
		digi_trig.stop()
Beispiel #9
0
def main():	

        myHost = ''                                                     # initialise the server machine ('' means: local host)
        myPort = 50009                                                  # listen on a non-reserved port number

        conn.sockobj = conn.socket(conn.AF_INET, conn.SOCK_STREAM)       # make a TCP/IP socket object
        conn.sockobj.settimeout(None)                                    # No timeout on the socket
        conn.sockobj.setsockopt(conn.SOL_SOCKET,conn.SO_REUSEADDR,1)
        conn.sockobj.bind((myHost, myPort))                              # bind the socket object to the specified server and port number 
        conn.sockobj.listen(5)                                           # begin listening, and allow 5 pending connects

        # Check for connection confimation from ORCA
        print "Simple TCP/IP Run (Main) - Checking for connection confimation from ORCA ... "	
        while 1:                                                        # listen until process killed
                connection, address = conn.sockobj.accept()             # wait for next client connection
                print 'Connection made to:' + str(address)              # connection is a new socket
                if address : break		
        connection.send(str(check_connection_flag))                          # send signal to ORCA  to check connection

        controlFlag = '0'
        controlArgument = '0'
        master_mode_trigger_frequency = '0'
        master_mode_number_of_pulses = '0'

        # Get the control flag
        connection.settimeout(5) 
        try:
                while 1:
                        controlFlag = connection.recv(1024)
                        #print "ControlFlag = " + str(controlFlag)
                        break
                
        except conn.timeout:
                connection.send(timeout_flag)
                main()

        connection.send(str(check_connection_flag))         

        # Get the control argument
        connection.settimeout(5) 
        try:
                while 1:
                        controlArgument = connection.recv(1024)
                        break
                
        except conn.timeout:
                connection.send(timeout_flag)
                main()
                
        connection.send(str(check_connection_flag)) 
        #connection.send(str(check_connection_flag)) #send this to signify that this is finished
        #main()

        #print "ControlFlag = " + str(controlFlag)
        #controlFlag = 60
        
        try:
                #print 'controlFlag: ' + str(controlFlag)
                #print 'laser intensity flag' + str(set_laser_intensity_flag)
                # set the laser switch channel 
                if (int(controlFlag) == int(set_laser_switch_flag)):      
                        print "Set the Laser switch to state" + str(controlArgument)
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()
                        rs.SetSelectedChannel(int(controlArgument))
                        sepiaUser.close(iDevIdx)
                        rs.Execute() 
                
                # set safe sates
                elif (int(controlFlag) == int(set_safe_states_flag)):
                        print "Setting to safe states"
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()
                        set_safe_states(iDevIdx, iSlotID)
                        
                # set fibre switch channel 
                elif (int(controlFlag) == int(set_fibre_switch_channel_flag)):
                        print(controlArgument)
                        input_channel,output_channel = extractLaserFibreValues(controlArgument)
                        print "Set the Fibre Switch to input Channel:" + str(input_channel) +" and output channel:" + str(output_channel)
                        fs.SetIOChannels(int(input_channel), int(output_channel))
                        # fs.SetFSChannel(controlArgument)

                # set laser intensity 
                elif (int(controlFlag) == int(set_laser_intensity_flag)):
                        print "Set Laser Intensity to " + str(controlArgument) + "%"
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()
                        time.sleep(1.0)
                        sepiaUser.set_laser_intensity(int(controlArgument), iDevIdx)
                        time.sleep(1.0)
                        sepiaUser.close(iDevIdx)

                # set soft lock on
                elif (int(controlFlag) == int(set_laser_soft_lock_on_flag)):
                        print "Set laser soft lock on"
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialiseSCMModule()
                        time.sleep(1.0)
                        sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
                        time.sleep(1.0)
                        sepiaUser.close(iDevIdx)

                # start master mode run 
                elif (int(controlFlag) == int(master_mode_flag)):
                        master_mode_trigger_frequency,master_mode_number_of_pulses = extractMasterModeFromCode(controlArgument)
                        print "Starting a Master mode sub run with trig frequency: " + str(master_mode_trigger_frequency) + "Hz and num_of_pulses:" + str(master_mode_number_of_pulses)
                        #iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()
                        #time.sleep(1.0)
                        #iDevIdx2,iModuleType2,iSlotID2 = sepiaUser.initialiseSCMModule()
                        #sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID2)
                        #time.sleep(1.0)
                        digi_trig = ni.GenerateDigitalTrigger(int(master_mode_trigger_frequency), int(master_mode_number_of_pulses))
                        digi_trig.start()
                        digi_trig.stop()
                        #sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID2)
                        #time.sleep(1.0)
                        #sepiaUser.close(iDevIdx)
                        #sepiaUser.close(iDevIdx2)

                # set soft lock off
                elif (int(controlFlag) == int(set_laser_soft_lock_off_flag)):
                        print "Set laser soft lock off"
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialiseSCMModule()
                        time.sleep(1.0)
                        print sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)
                        time.sleep(1.0)
                        sepiaUser.close(iDevIdx)
                # set the laser frequency to high enough to see visually 
                elif (int(controlFlag) == int(set_laser_testing_frequency_mode)):
                        print "Setting laser to 20MHz testing Mode"
                        iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()
                        sepiaUser.set_laser_frequency(2, iDevIdx)        # set the laser frequency to 20Mhz
                        sepiaUser.close(iDevIdx)
                        
                else:
                        print "No command value recieved"
                        # put all the possible options in here

                        
        except:
                connection.send(timeout_flag)
                main()

        connection.send(str(check_connection_flag)) #send this to signify that this is finished

        print "Return to listening on the port"
        main()                                # return to listening on the port 
Beispiel #10
0
sepiaUser.close(iDevIdx)
rs.Execute()                                          # execute the laserSwitch channel change
iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()  # need to reinitialise Sepia after turning off during the changing of the laserSwitch channel (part of SetSelectedChannel)
sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)

# Set all Parameters (all must be INTEGERS)
input_intensity = 100
input_frequency = 4
input_rs_channel = 1
input_fs_channel = 1  
sepiaUser.set_laser_intensity(input_intensity, iDevIdx)	  # set the laser intensity to 100%
sepiaUser.set_laser_frequency(input_frequency, iDevIdx)   # set the laser frequency to Internal 5MHz
sepiaUser.close(iDevIdx)
fs.SetFSChannel(input_fs_channel)				          # set the fibreSwitch channel to 1 
#sys.exit("Simple Run (Main) - Forced Exit after Set Parameters stage")

check_current_states(iDevIdx, iSlotID, input_intensity, input_frequency)

sepiaUser.laser_soft_lock_off(iDevIdx, iSlotID)		     # unlock the laser 
time.sleep(30)						                     # pulse the laser for 30 seconds
sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)           # lock the laser again after pulsing is complete
set_safe_states(iDevIdx, iSlotID)	                     # set all laser parameter to their safe-state values 
iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()     # need to reinitialise Sepia after turning off during the changing of the laserSwitch channel (part of set_safe_states)
sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)

check_safe_states(iDevIdx, iSlotID, connection)		     # check that all devices are in their safe-states

iDevIdx,iModuleType,iSlotID = sepiaUser.initialise()     # re-initialise Sepia
sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
sepiaUser.close(iDevIdx)