def getInfo(project_dict, OT_dict): """Gets PI name, project title, and proposed rms from the XML""" XMLroots = OT_dict[1] prop_root = XMLroots['prop_root'] proj_root = XMLroots['proj_root'] science_root = XMLroots['science_root'] namespaces = XMLroots['namespaces'] # get PI name PI_name = prop_root.find('prp:PrincipalInvestigator', namespaces) # get project title title = proj_root.find('prj:projectName', namespaces) #test this ''' # get configuration (may have to get this from the weblog, Observation Summary table) htmldir = '../qa/pipewhatever/html/' html=open(htmldir+ 'index.html') ''' # get rms (line) -> this might depend on which science goal, be careful! rms = science_root.find('.//sbl:ScienceParameters/sbl:sensitivityGoal', namespaces) unit = rms.attrib # get beam size scigoal = prop_root.findall('.//prj:ScienceGoal', namespaces) beam_size = scigoal[int(OT_dict[0]['science_goal'])].find('prj:PerformanceParameters/prj:desiredAngularResolution', namespaces) beam_unit = beam_size.attrib['unit'] beam = beam_size.text + beam_unit # get number of EBs nms = li.getnum_ms(project_dict['project_type'], project_dict['project_path']) project_info = {'project_number': project_dict['project_number'], 'SB_name': project_dict['SB_name'], 'PI_name': PI_name[0].text, 'title': title.text, 'rms': rms.text, 'rms_unit': unit['unit'], 'beam_size': beam,'nms':str(nms)} return project_info
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