コード例 #1
0
def make_callist(callist,caldir):
    """make_callist(callist, caldir)

    This reads in the file specified as callist.
    The path must be absolute, or the routine will return False

    The caldir is used to constructed the Frame object, so that future
    functions will know where the actual is located (thus, in theory,
    the calibration file and the callist can be in two different
    places.)

    
    """
    try:
        calfile = open(callist)
    except:
        return(False)

    calfilestr = calfile.read()
    calfilelist = calfilestr.splitlines()

    calframes = []
    flags = ""
    for line in calfilelist:
        linearray = line.split()
        if len(linearray) == 7:
            [filename,camera,filetype,grating,wavelen,xb,yb] = linearray
        elif len(linearray) > 7:
            [filename,camera,filetype,grating,wavelen,xb,yb] = linearray[0:6]
            flags = " ".join(linearray[6:])
        else:
            return([])
        calframe = Frame(name=filename,path=caldir,display_name=filename)
        calframe.grating = grating
        calframe.wavelength = wavelen
        calframe.type = filetype
        calframe.xbinning = xb
        calframe.ybinning = yb
        calframe.flags = flags
        calframe.exptime = 1
        calframe.target = 'horizon lock'
        calframe.aperture = 'long_1.0'

        if camera == "r":
            calframe.instrument=Instrument(name=u'lrisred',display_name=u'LRISRED')
        elif camera == "b":
            calframe.instrument =Instrument(name=u'lrisblue',display_name=u'LRISBLUE')
        
        calframes.append(calframe)
#        make_gratingdir(filename,grating,stddir)

    
    return(calframes)
コード例 #2
0
ファイル: watchdir_setup.py プロジェクト: bpholden/watchdir
def makecallist(callist,caldir,stddir):

    try:
        calfile = open(callist)
    except:
        return(False)

    calfilestr = calfile.read()
    calfilelist = calfilestr.splitlines()

    calframes = []
    flags = ""
    for line in calfilelist:
        linearray = line.split()
        if len(linearray) == 7:
            [filename,camera,filetype,grating,wavelen,xb,yb] = linearray
        elif len(linearray) > 7:
            [filename,camera,filetype,grating,wavelen,xb,yb] = linearray[0:6]
            flags = " ".join(linearray[7:])
        else:
            return([])
        calframepath = findframe(caldir,camera,grating,filename)
        if calframepath:
            calframe = Frame(name=filename,path=calframepath,display_name=filename)
            calframe.grating = grating
            calframe.wavelength = float(wavelen)
            calframe.type = filetype
            calframe.xbinning = int(xb)
            calframe.ybinning = int(yb)
            calframe.flags = flags
            if camera == "r":
                calframe.instrument=Instrument(name=u'lrisred',display_name=u'LRISRED')
            elif camera == "b":
                calframe.instrument =Instrument(name=u'lrisblue',display_name=u'LRISBLUE')
            calframes.append(calframe)
            make_gratingdir(filename,grating,stddir)
        else:
            print "Cannot find file %s in %s or appropriate subdirectories." % (filename,caldir)
    
    return(calframes)