Exemplo n.º 1
0
def main(project_dict=False, AOT=False):
    """Asks the user for project information or reads the information from the provided dictionaries to write to the README"""
    if project_dict == False:
        project_dict = project_info.main()
    if AOT == False:
        AOT_dict = OT_info.getOTinfo(project_dict['SB_name'], AOTpath=False)
    else:
        AOT_dict = OT_info.getOTinfo(project_dict['SB_name'],AOTpath=AOT)
    AOTdir = AOT_dict[0]
    readme_info = getInfo(project_dict,AOT_dict)
    write2Readme(project_dict['project_type'], project_dict['project_path'], readme_info, project_dict['casa_version']) # why won't this write??
    #fill_README.testwrite()
    cleanup(AOTdir['AOT'])
Exemplo n.º 2
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
Exemplo n.º 3
0
def most_info(SBname=False, project_path = False): # project_path is the /lustre/naasc/username/Reduce_XXX directory
    import OT_info as OT
    import glob
    import os
    import sys

    #proj_type = project_type()
    if project_path == False:
        project_path = directory()
    if SBname == False:
        SBname = SB_name() 

    # figure out the project type:
    os.chdir(project_path)
    #print project_path
    folders = glob.glob('*')
    if 'sg_ouss_id' in folders:
        proj_type = "Imaging"
        version = casa_version()
    elif 'Imaging' in folders:
        proj_type = "Manual"    
        version = '4.4.0'
    elif 'S.MOUS.uid' in folders[0]: # in case people still do that
        proj_type = "Imaging"
        version = casa_version()
        project_path = project_path + folders[0]
    else:
        sys.exit('ERROR: Wrong directory or wrong structure in directory! Please make sure folder names comply with NA arc best practices for imaging or manual calibration.')

    os.chdir(project_path)
    AOT = glob.glob('*.aot')
    if not AOT:
         AOTpath = False
    else:
        AOTpath = os.getcwd()+'/' + AOT[0]
    print AOTpath
   
    OT_dict = OT.getOTinfo(SBname, AOTpath=AOTpath)
    AOTfile = OT_dict[0]['AOT']  
    project_number = AOTfile[AOTfile.rfind('/')+1:len(AOTfile)]
    project_number = project_number[0:14]

    codes = ['N/A', 'N/A']
    asdm = ['N/A']

    project_dict = project_info_dict(proj_type, project_path, project_number, codes, SBname, asdm, version)
    #print project_dict, OT_dict
    return project_dict, OT_dict
Exemplo n.º 4
0
def get_parameters(project_dict=False, OT_dict=False):
    """gets the parameter dictionary from list_imparameters_CASA.py """
    if project_dict == False:
        project_dict = pi.main() #will query the user for project details. Should never happen when running the generate() method, this is mainly for testing purposes
    if OT_dict == False:
	OT_dict = OT_info.getOTinfo(project_dict['SB_name'])
    XMLroots=OT_dict[1]
    science_root = XMLroots['science_root']
    namespaces = XMLroots['namespaces']
    nms = li.getnum_ms(project_dict['project_type'], project_dict['project_path'])
    listobs = li.getListobs()
    line = listobs[0]
    index = listobs[1]
    nspws = li.getNspw(line, index)
    cell = li.getCell(line)
    scifld = li.getScienceFields(line, index)
    #specinfo = li.getLines(index, int(nspws[0]))

    spwdict = li.getSpwInfo(science_root, namespaces, nspws[1])
    rfreqHz = li.getRestFreq(science_root, namespaces)
    vwidth = li.getVelWidth(science_root, namespaces, rfreqHz=rfreqHz)
    rframe = li.getRefFrame(science_root, namespaces)
    sg = OT_dict[0]
    AOT = OT_dict[0]['AOT']
    sName = li.sourceName(science_root, namespaces, project_dict['SB_name'])
    mosaic = li.mosaicBool(namespaces, XMLroots['science_root'], sName)
    if mosaic == 'true':
        pc = li.getPhasecenter(science_root, namespaces)
    else: 
        pc = 'N/A'

    # fill dictionary
    pc = li.getPhasecenter(science_root, namespaces)
    lastfield = scifld[scifld.rfind(',')+1:]

    parameters = {'project_number': project_dict['project_number'],'SB_name': project_dict['SB_name'],'nms':nms,'mosaic': mosaic, 'scifields': scifld,'scifield0': str(scifld[0]), 'scifield1': str(lastfield), 'cellsize': cell[0], 'imsize':cell[1], 'rframe':rframe, 'vwidth':vwidth[0], 'rwidth': vwidth[1], 'rwidthunit': vwidth[2], 'spw_dict': spwdict, 'rfreq':str(float(rfreqHz)*1e-9), 'plotcmd': '', 'sourceName': sName, 'phasecenter': pc, 'AOT': AOT}
    print parameters
    return parameters
Exemplo n.º 5
0
def get_parameters(project_dict=False, OT_dict=False):
    if project_dict == False:
        project_dict = pi.main()
    if OT_dict == False:
	OT_dict = OT_info.getOTinfo(project_dict['SB_name'])
    XMLroots=OT_dict[1]
    science_root = XMLroots['science_root']
    namespaces = XMLroots['namespaces']
    nms = li.getnum_ms(project_dict['project_type'], project_dict['project_path'])
    listobs = li.getListobs()
    line = listobs[0]
    index = listobs[1]
    nspws = li.getNspw(line, index)
    cell = li.getCell(line)
    scifld = li.getScienceFields(line, index)
    specinfo = li.getLines(index, int(nspws[0]))
    spwdict = li.getSpwInfo(science_root, namespaces, nspws[1])
    rfreqHz = li.getRestFreq(science_root, namespaces)
    vwidth = li.getVelWidth(science_root, namespaces, rfreqHz=rfreqHz)
    rframe = li.getRefFrame(science_root, namespaces)
    sg = OT_dict[0]
    AOT = OT_dict[0]['AOT']
    sName = li.sourceName(science_root, namespaces, project_dict['SB_name'])
    #mosaic = li.mosaicBool(namespaces, XMLroots['proj_root'], sg['science_goal'])
    mosaic = li.mosaicBool(namespaces, XMLroots['science_root'], sName)
    if mosaic == 'true':
        pc = li.getPhasecenter(science_root, namespaces)
    else: 
        pc = 'N/A'

    # fill dictionary
    pc = li.getPhasecenter(science_root, namespaces)
    lastfield = scifld[scifld.rfind(' ')-1:]

    parameters = {'project_number': project_dict['project_number'],'SB_name': project_dict['SB_name'],'nms':nms, 'specinfo':specinfo,'mosaic': mosaic, 'scifields': scifld,'scifield0': scifld[0], 'scifield1': lastfield, 'cellsize': cell[0], 'imsize':cell[1], 'rframe':rframe, 'vwidth':vwidth[0], 'rwidth': vwidth[1], 'rwidthunit': vwidth[2], 'spw_dict': spwdict, 'rfreq':str(float(rfreqHz)*1e-9), 'plotcmd': '', 'sourceName': sName, 'phasecenter': pc, 'AOT': AOT}
    return parameters