Esempio n. 1
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
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