Beispiel #1
0
def fillReadme(project_dict, AOT=False):
    """Fills out the header information in the README"""
    #print AOT, project_dict['SB_name']
    AOT_dict = OT_info.getOTinfo(project_dict['SB_name'],AOTpath=AOT)
    AOTdir = AOT_dict[0]
    readme_info = fill_README.getInfo(project_dict,AOT_dict)
    fill_README.write2Readme(project_dict['project_type'], project_dict['project_path'], readme_info, project_dict['casa_version']) # why won't this write??
    #fill_README.testwrite()
    #fill_README.cleanup(AOTdir['AOT'])
    return AOT_dict
def main(SB_name = False, project_path = False): 
    if project_path == False:
        project_path = os.getcwd()
    dictionaries = project_info.most_info(SBname = SB_name, project_path = project_path)
    OT_dict = dictionaries[1]
    project_dict = dictionaries[0]
    #readme_info = fill_README.getInfo(dictionaries[0], OT_dict)
    XMLroots=OT_dict[1]
    science_root = XMLroots['science_root']
    namespaces = XMLroots['namespaces']

    nms = getnum_ms(project_dict['project_type'],project_dict['project_path'])
    #IPython.embed()
    listobs = getListobs()
    line = listobs[0]
    index = listobs[1]
    nspws = getNspw(line, index)
    cell = getCell(line)
    scifld = getScienceFields(line, index)
    specinfo = getLines(index, int(nspws[0]))
    spwinfo = getSpwInfo(science_root, namespaces, nspws[1])
    rfreqHz = getRestFreq(science_root, namespaces)
    vwidth = getVelWidth(science_root, namespaces, rfreqHz=rfreqHz)
    rframe = getRefFrame(science_root, namespaces)
    #plotcmd = genPlotMS(spwinfo, rframe)
    plotcmd = ''
    sg = OT_dict[0]
    sName = sourceName(science_root, namespaces, project_dict['SB_name'])
    mbool = mosaicBool(namespaces, science_root, sName)
    mosaic = ismosaic(mbool, scifld[0], scifld[scifld.rfind(' ')-1:])
    if mbool == 'true':
        pc = getPhasecenter(science_root, namespaces)
    else: 
        pc = 'N/A'
    # get stuff from readme
    readme_dict = fill_README.getInfo(dictionaries[0], OT_dict)

    # fill dictionary
    parameters = {'project_number': project_dict['project_number'],'SB_name': project_dict['SB_name'],'PI_name': readme_dict['PI_name'],'title': readme_dict['title'],'nms':nms, 'specinfo':specinfo,'mosaic': mosaic[0], 'pointings': mosaic[1], 'scifields': scifld, 'scifield0': scifld[0], 'scifield1': scifld[scifld.rfind(' ')-1:], 'cellsize': cell[0], 'imsize':cell[1], 'rframe':rframe,  'vwidth':vwidth[0], 'rwidth': vwidth[1], 'rwidthunit': vwidth[2], 'spw_dict': spwinfo, 'plotcmd': plotcmd, 'rms': readme_dict['rms'], 'rms_unit': readme_dict['rms_unit'], 'rfreq':str(float(rfreqHz)*1e-9), 'phasecenter': pc}
    param = openFile()
    info = fillInfo(parameters) #! re-work this one too
    writeText(param, info)
    print 'The file imaging_parameters.txt is now in %s' % os.getcwd()
    # remove temp files
    fill_README.cleanup(OT_dict[0]['tempdir'])