Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
    net.py_network_sendfcnum(fcnum)

    # close connection, then re-open for image xfer
    net.py_network_stopserver()

    log_string = "STATUS:\tPolonator-acquirer: server establishing image transfer connection to processor, port %d..." % (proc_portnum)
    PL.p_log_simple(log_string)
    net.py_network_startserver(proc_portnum)

    log_string = "STATUS:\tPolonator-acquirer: server establishing image transfer connection to processor, port %d..." % (proc_portnum)
    PL.p_log(log_string)

    blank_image[:] = 0
    
    PL.p_log_simple("STATUS:\tPolonator-acquirer: waiting for processor to signal ready to begin")
    if net.py_network_waitforsend() != 1:
        PL.p_log("ERROR:\tPolonator-acquirer: processor requested the wrong kind of data (not an image)")
        exit_on_error(mf)
    PL.p_log_simple("STATUS:\tPolonator-acquirer: processor ready to receive first image")
    net.py_network_sendimage(0, 0, 0, blank_image)

    # MAESTRO SETUP
    PL.p_log("STATUS:\tPolonator-acquirer: opening connection to Maestro...")

    # IMAGE CAPTURE AND TRANSMIT
    # start capture on framegrabber
    PC.py_startAcquire()

    # initialize counters for image information transmitted to processor
    curr_fc = 0
    curr_array = 0