Esempio n. 1
0
def startLive(exposure, gain, color):
    global MaestroF
    MaestroF.filter_goto(color)
    MaestroF.shutter_open()
    pid = os.fork()        # this is a UNIX only syscall
    if pid == 0:
        #child process
        PC.cameraLive(exposure, gain)
        return 0;
Esempio n. 2
0
def main(argv=None):
    
    """
        Process command line
    """
    IlluminateWidth = 1920
    IlluminateHeight = 1080
    CameraWidth = 1000
    CameraHeight = 1000
    
    if argv is None:
        argv = sys.argv
    # end if
    argc = len(argv)
    print "newline\n"
    print "There are %d arguments\n" % argc     
    # make sure we have the correct number of arguments */
    if  (argc < 3) or (argc > 5):
        #testDMD.show_usage()
        show_usage()
        sys.exit(-1)
    #end if
    
    MF = MaestroFunctions()
    
    # process the numeric arguments 
    int_time = float(argv[1])
    em_gain  = int(argv[2])

    # process cube name 
    if argc < 4:
        mycube = DEFAULT_CUBE
    # end if
    else:
        mycube = str(argv[3])
        
    # end else

    # process TDI flag
    if argc < 5:
        TDI_flag = DEFAULT_TDI
    # end if
    else:
        TDI_flag = int(argv[4])
    # end else

    """
        Set up imaging
    """

    MF.darkfield_off() 
    print "the third argument is %s\n" % mycube 
    MF.filter_goto(mycube)



    """
        set up release hardware
    """

    # initialize the release system 
    print "Initializing release system\n"
    if PI.py_illuminate_init(IlluminateWidth, IlluminateHeight, \
                            CameraWidth, CameraHeight) < 0:
        sys.exit(-1)
    #end if
 
    # load an identity map for alignment parameters 
    PI.py_illuminate_alignment_load_identity()

    # enable release hardware 
    PI.py_illuminate_enable()
    PI.py_clear_memory()    # must run this or you will get line artifacts!!!!
    # generate an image 
    PI.generate_image()
    
    
    # expose image, so that it stays displayed 
    PI.py_illuminate_expose()

    """
    start imaging
    """

    # open shutter
    MF.shutter_open()

    # start imaging
    myargc = 3;
    myargv = ['0' ,'0','c','d']    # create a list of length 4
    myargv[2] = argv[1]
    myargv[3] = argv[2]

    # start in a separate process to avoid crash if window is closed
    
    pid = os.fork()        # this is a UNIX only syscall
    if pid == 0:
        #child process
        PC.cameraLive(myargc, myargv, TDI_flag)
        return 0;
    # end if

    # in parent process 
    # wait for child to terminate 
    #os.waitpid(pid,os.WNOHANG)     # this option WNOHANG is UNIX only
    os.wait()
    
    # close shutter
    MF.shutter_close()

    return 0