def send_initial_raw_images(num_array): #Network transfer declarations # int serv_sock; # socket for the server (this machine) i = 0 global datasize # prepare the network connection and send # open the port, and wait for processor to connect net.py_network_startserver(proc_portnum) while i < num_array: # read and send the auto_exposure raw images stagealign_rawimgfilename = "%s/polonator/G.007/acquisition/stagealign/stagealign-image0_%d.raw" % (os.environ["HOME"], i) PL.p_log_simple(stagealign_rawimgfilename) log_string = "STATUS:\t 1try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) baseimage = numpy.fromfile(file=stagealign_rawimgfilename, dtype=np.uint16) log_string = "STATUS:\t 2try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) blank_image = numpy.copy(baseimage) log_string = "STATUS:\t 3try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) while net.py_network_waitforsend() != 1: log_string = "Waiting to send the autoexposure images" PL.p_log(log_string) # end while log_string = "Trying to send autoexposure images %d" % (i) PL.p_log_simple(log_string) net.py_network_sendimage( 0, 0, i, blank_image) log_string = "Sent autoexposure images %d" % (i) PL.p_log_simple(log_string) i += 1
def send_FL_images(mystring, num_array): # prepare the network connection and send # open the port, and wait for processor to connect net.py_network_startserver(proc_portnum) string1 = mystring + len(mystring) - 1 PL.p_log(string1) log_string = "string1 length %d" % (len(string1)) PL.p_log(log_string) if string1 == "G": log_string = "success_%d.raw" % (0) PL.p_log(log_string) stagealign_dir_name = "%s/polonator/G.007/acquisition/autoexp_FL_images/fam/" % (os.environ["HOME"]) PL.p_log(stagealign_dir_name) elif string1 == "A": log_string = "success_%d.raw" % (0) PL.p_log(log_string) stagealign_dir_name = "%s/polonator/G.007/acquisition/autoexp_FL_images/cy3/" % (os.environ["HOME"]) PL.p_log(stagealign_dir_name) # elif elif string1 == "C": log_string = "success_%d.raw" % (0) PL.p_log(log_string) stagealign_dir_name = "%s/polonator/G.007/acquisition/autoexp_FL_images/txred/" % (os.environ["HOME"]) PL.p_log(stagealign_dir_name) # end elif elif string1 == "T": log_string = "success_%d.raw" % (0) PL.p_log(log_string) stagealign_dir_name = "%s/polonator/G.007/acquisition/autoexp_FL_images/cy5/" % (os.environ["HOME"]) PL.p_log(stagealign_dir_name) # end elif i = 0 while i < num_array: # read and send the FL autoe images stagealign_rawimgfilename = "%simage_%d.raw" % (stagealign_dir_name, 60+i*10) log_string = "STATUS:\t 1try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) baseimage = numpy.fromfile(file=stagealign_rawimgfilename, dtype=np.uint16) log_string = "STATUS:\t 2try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) blank_image = numpy.copy(baseimage) log_string = "STATUS:\t 3try to send the autoexposure images %s to processor, port %d..." % (stagealign_rawimgfilename, proc_portnum) PL.p_log(log_string) while net.py_network_waitforsend() != 1: log_string = "Waiting to send the autoexposure images" PL.p_log(log_string) # end while log_string = "Trying to send autoexposure FL images %d" % (i) PL.p_log_simple(log_string) net.py_network_sendimage(0, 0, i, blank_image) log_string = "Sent autoexposure FL images %d" % i PL.p_log_simple(log_string) i += 1 # end while i = 0 while i < 2: i = net.py_network_waitforsend() log_string = "waiting to receive the gain value back" PL.p_log(log_string) # end while gain = (i - 97)*10 + 60 log_string = "the autoexposure gain to use will be %d" % (gain) PL.p_log_simple(log_string) return gain
open the port, and wait for processor to connect """ if auto_exposure == 1: net.py_network_startserver(proc_portnum) array_string = argv[1] PL.p_log(array_string) if array_string == "0" or array_string == "1": PL.p_log(array_string) send_initial_raw_images(1) else: log_string = "STATUS:\tPolonator-acquirer: running autoexposure, server sending filename %s to processor, port %d..." % (argv[1], proc_portnum) PL.p_log_simple(log_string) # now send the filename for the current image set log_string = "STATUS:\tPolonator-acquirer: server sending filename %s to processor, port %d..." % (argv[1], proc_portnum) PL.p_log(log_string) net.py_network_sendfilename(array_string) # close connection, then re-open for flowcell number net.py_network_stopserver() net.py_network_startserver(proc_portnum) autoe_gain = send_FL_images(array_string,15) PC.setGain(autoe_gain) log_string = "STATUS:\tPolonator-acquirer: using the auto-exposure gain %d..." % (autoe_gain)