def main(): print "\n" print "Simple TCP/IP Run (Main) - Starting SMELLIE RUN..." #Perform a clean open and close of the Sepia Laser Driver before talking to ORCA. #iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() #sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) #rs.SetSelectedChannel(0) #sepiaUser.close(iDevIdx) myHost = '' # initialise the server machine ('' means: local host) myPort = 50006 # 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(check_connection_flag) # send signal to ORCA to check connection print "Simple TCP/IP Run (Main) - Waiting for run parameters from ORCA ... " iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() ORCA_set_ls_channel(connection, iDevIdx) iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() # need to reinitialise Sepia after turning off during the changing of the laserSwitch channel (part of ORCA_set_ls_channel) #ORCA_set_laser_parameters(connection) #complete_self_test(connection, iDevIdx, iSlotID) sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
def set_laser_switch_channel(channel): iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() rs.SetSelectedChannel(channel) sepiaUser.close(iDevIdx) rs.Execute() iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID)
def initialSetLaser(ls_channel,operation_mode,intensity): iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_laser_switch_channel(ls_channel) sepiaUser.set_laser_intensity(intensity, iDevIdx) # set the intensity to 100% sepiaUser.set_laser_frequency(operation_mode, iDevIdx) sepiaUser.close(iDevIdx)
def laser_testing_mode(): retValue = 0 try: 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) except errorCode, Argument: retValue = "Error: " + str(errorCode) + " " + str(Argument)
def set_laser_switch(laser_switch_channel): retValue = 0 try: print "Set the Laser switch to channel " + str(laser_switch_channel) iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() rs.SetSelectedChannel(int(laser_switch_channel)) sepiaUser.close(iDevIdx) rs.Execute() except errorCode, Argument: retValue = "Error: " + str(errorCode) + " " + str(Argument)
def fibreSwitchTesting(): iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_to_safe_state(iDevIdx, iSlotID) # set all the laser parameters to safe values #timestamp = str(time.time()) #timestamp = timestamp[0:10] # initiate test run across ALL laserSwitch channels and ALL fibreSwitch input/output channel combinations test_run(1, 1, iDevIdx, iModuleType, iSlotID) test_run(2, 2, iDevIdx, iModuleType, iSlotID) test_run(2, 3, iDevIdx, iModuleType, iSlotID) test_run(4, 4, iDevIdx, iModuleType, iSlotID) test_run(5, 5, iDevIdx, iModuleType, iSlotID) iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() # re-initialise Sepia sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) sepiaUser.close(iDevIdx) time.sleep(1)
def laserSwitchCheckTest(): iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_to_safe_state(iDevIdx, iSlotID) set_laser_switch_channel(0) set_laser_switch_channel(1) set_laser_switch_channel(2) set_laser_switch_channel(3) set_laser_switch_channel(4) set_to_safe_state(iDevIdx, iSlotID) sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) sepiaUser.close(iDevIdx)
def set_laser_intensity(intensity): retValue = 0 try: print "Set Laser Intensity to " + str(intensity) + "%" iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() time.sleep(1.0) sepiaUser.set_laser_intensity(int(intensity), iDevIdx) time.sleep(1.0) sepiaUser.close(iDevIdx) except errorCode, Argument: retValue = "Error: " + str(errorCode) + " " + str(Argument)
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 set_safe_states(): retValue = 0 try: iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() #sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) # turn the laser soft-lock on sepiaUser.set_laser_intensity(0, iDevIdx) # set the laser intensity to 0% sepiaUser.set_laser_frequency(6, iDevIdx) # set the laser frequency to external rising-edge trigger rs.SetSelectedChannel(0) # set the laserSwitch to channel 0 (default) sepiaUser.close(iDevIdx) rs.Execute() # execute the laserSwitch channel change from above except errorCode, Argument: retValue = "Error: " + str(errorCode) + " " + str(Argument)
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)
def firstRun(): ls_channel = 3 #choose the laser operation_mode = 6 #DO NOT USE 0 OR 1 !!!!!!!!!!!!!!! intensity = 0 #this is in percentage of the intensity #Set to safe states iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_to_safe_state(iDevIdx, iSlotID) # set all the laser parameters to safe values initialSetLaser(ls_channel,operation_mode,intensity) #Set the fibre switch to check this is working fine fibre_switch_input_channel = 1 fibre_switch_ouput_channel = 10 setFibreSwitch(fibre_switch_input_channel,fibre_switch_ouput_channel)
def main(): iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_to_safe_state(iDevIdx, iSlotID) # set all the laser parameters to safe values timestamp = str(time.time()) timestamp = timestamp[0:10] filename = 'Testing_SMELLIE_at_5MHz_' + timestamp + '.txt' f = open(filename, 'w') # initiate test run across ALL laserSwitch channels and ALL fibreSwitch input/output channel combinations test_run(1, 1, f, iDevIdx, iModuleType, iSlotID) test_run(2, 2, f, iDevIdx, iModuleType, iSlotID) test_run(3, 3, f, iDevIdx, iModuleType, iSlotID) test_run(4, 4, f, iDevIdx, iModuleType, iSlotID) test_run(5, 5, f, iDevIdx, iModuleType, iSlotID) iDevIdx,iModuleType,iSlotID = sepia.initialise() # re-initialise Sepia sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) sepiaUser.close(iDevIdx) f.close()
sys.exit('Simple Run (Check Safe States) - Laser Soft-lock is not enabled ... aborting run!') return def check_current_states(iDevIdx, iSlotID, input_intensity, input_frequency): intensity,frequency_number,pulse_mode,head_id = sepiaUser.get_laser_parameters(iDevIdx) if (intensity != input_intensity or frequency_number != input_frequency): sys.exit('Simple Run (Check Current States) - Laser States have not been correctly set to your specified values ... aborting run!') return ##### START OF THE MAIN PROGRAM #################################################################################################### # Initialisation stage iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() # initialise Sepia set_safe_states(iDevIdx, iSlotID) # sets all the Sepia parameters 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 rs.SetSelectedChannel(0) # set the laserSwitch channel to 1 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
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 main2(): firstRun() #cycleFibreSwitch() #main2() if __name__ == "__main__": iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() set_to_safe_state(iDevIdx, iSlotID) initialSetLaser(4,6,60) time.sleep(5) setFibreSwitch(4,8) #cycleFibreSwitch(3,2)
def main(): print "\n" print "Simple TCP/IP Run (Main) - Starting SMELLIE RUN..." #Perform a clean open and close of the Sepia Laser Driver before talking to ORCA. #iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() #sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) #rs.SetSelectedChannel(0) #sepiaUser.close(iDevIdx) myHost = '' # initialise the server machine ('' means: local host) myPort = 50007 # 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(check_connection_flag) # send signal to ORCA to check connection # Check for SMELLIE initialisation commmand from ORCA print "Simple TCP/IP Run (Main) - Looking for SMELLIE initialisation commmand from ORCA ... " connection.settimeout(5) # set a timeout of 5 seconds for receiving data try: while 1: start_init_data = connection.recv(1024) if (start_init_data == start_initialise_flag): # check if initialisation command has been given print "Simple TCP/IP Run (Main) - Start initialisation stage of the SMELLIE run" break except conn.timeout: connection.send(timeout_flag) main() connection.settimeout(None) # remove timeout for receiving data # Initialisation stage iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() # initialise Sepia check_sepia_connection(iModuleType, connection) # check that Sepia is working as expected check_ls_connection(connection) # check that the laserSwitch is working as expected set_safe_states(iDevIdx, iSlotID) # sets all the Sepia parameters 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) check_safe_states(iDevIdx, iSlotID, connection) # check that all devices are in their safe-states print "Simple TCP/IP Run (Main) - Looking for a Confirmation from ORCA to start the SMELLIE run ... " connection.settimeout(5) # set a timeout for receiving data try: while 1: start_run = connection.recv(1024) if (start_init_data == start_initialise_flag): # check if initialisation command has been given print "Simple TCP/IP Run (Main) - Ready to start sending run parameters" break except conn.timeout: connection.send(timeout_flag) main() connection.settimeout(None) # remove timeout for receiving data main() print "Simple TCP/IP Run (Main) - Waiting for run parameters from ORCA ... " ORCA_set_ls_channel(connection, iDevIdx) iDevIdx,iModuleType,iSlotID = sepiaUser.initialise() # need to reinitialise Sepia after turning off during the changing of the laserSwitch channel (part of ORCA_set_ls_channel) ORCA_set_laser_parameters(connection) complete_self_test(connection, iDevIdx, iSlotID) sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) ORCA_set_fs_channel(connection) number_of_pulses = ORCA_ni_get_pulses(connection) # get the number of pulses from the NI box trigger_frequency = ORCA_ni_get_trigger_frequency(connection) # get the trigger frequency of the NI box perform_run(connection, number_of_pulses, trigger_frequency, iDevIdx, iSlotID) # complete the SMELLIE run sys.exit("Simple TCP/IP Run (Main) - good exit")
import pysepiaUser as p import laserSwitch as rs #iDevIdx,iModuleType,iSlotID = p.initialise() #p.set_laser_intensity(int("10"), iDevIdx) #p.close(iDevIdx) iDevIdx,iModuleType,iSlotID = p.initialise() rs.SetSelectedChannel(3) p.close(iDevIdx) rs.Execute()
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
def main(): print "\n" print "Simple TCP/IP Run (Main) - Starting SMELLIE RUN..." #Perform a clean open and close of the Sepia Laser Driver before talking to ORCA. iDevIdx, iModuleType, iSlotID = sepiaUser.initialise() sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) rs.SetSelectedChannel(0) sepiaUser.close(iDevIdx) myHost = '' # initialise the server machine ('' means: local host) myPort = 50007 # 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.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( check_connection_flag) # send signal to ORCA to check connection # Check for SMELLIE initialisation commmand from ORCA print "Simple TCP/IP Run (Main) - Looking for SMELLIE initialisation commmand from ORCA ... " connection.settimeout(5) # set a timeout of 5 seconds for receiving data try: while 1: start_init_data = connection.recv(1024) if (start_init_data == start_initialise_flag ): # check if initialisation command has been given print "Simple TCP/IP Run (Main) - Start initialisation stage of the SMELLIE run" break except conn.timeout: connection.send(timeout_flag) main() connection.settimeout(None) # remove timeout for receiving data # Initialisation stage iDevIdx, iModuleType, iSlotID = sepiaUser.initialise() # initialise Sepia check_sepia_connection( iModuleType, connection) # check that Sepia is working as expected check_ls_connection( connection) # check that the laserSwitch is working as expected set_safe_states( iDevIdx, iSlotID) # sets all the Sepia parameters 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) check_safe_states( iDevIdx, iSlotID, connection) # check that all devices are in their safe-states print "Simple TCP/IP Run (Main) - Looking for a Confirmation from ORCA to start the SMELLIE run ... " connection.settimeout(5) # set a timeout for receiving data try: while 1: start_run = connection.recv(1024) if (start_init_data == start_initialise_flag ): # check if initialisation command has been given print "Simple TCP/IP Run (Main) - Ready to start sending run parameters" break except conn.timeout: connection.send(timeout_flag) main() connection.settimeout(None) # remove timeout for receiving data print "Simple TCP/IP Run (Main) - Waiting for run parameters from ORCA ... " ORCA_set_ls_channel(connection, iDevIdx) iDevIdx, iModuleType, iSlotID = sepiaUser.initialise( ) # need to reinitialise Sepia after turning off during the changing of the laserSwitch channel (part of ORCA_set_ls_channel) ORCA_set_laser_parameters(connection) complete_self_test(connection, iDevIdx, iSlotID) sepiaUser.laser_soft_lock_on(iDevIdx, iSlotID) ORCA_set_fs_channel(connection) number_of_pulses = ORCA_ni_get_pulses( connection) # get the number of pulses from the NI box trigger_frequency = ORCA_ni_get_trigger_frequency( connection) # get the trigger frequency of the NI box perform_run(connection, number_of_pulses, trigger_frequency, iDevIdx, iSlotID) # complete the SMELLIE run sys.exit("Simple TCP/IP Run (Main) - good exit")