def generate_script(project_dict, OT_dict, comments=False, split=True, template=False): """Generates a custom imaging script. Only used for imaging.""" os.chdir(project_dict['project_path']) parameters = sg.get_parameters(project_dict = project_dict, OT_dict = OT_dict) script = sg.script_data_prep(parameters, project_dict, comments, template) if split == True: prep_script = script script = '' spws = sg.sort_spws(parameters) continfo = spws[0] lineinfo = spws[1] linespws = spws[2] script = sg.make_continuum(script,parameters, project_dict, continfo, comments, template,flagchannels=False) script = sg.image_setup(script,parameters, comments, template) script = sg.cont_image(script,parameters, comments, template) if lineinfo != []: script = sg.contsub(script,parameters, continfo, linespws, comments) script = sg.line_image(script,parameters, lineinfo, comments) script = sg.pbcor_fits(script) if split == True: sg.write_script(prep_script,project_dict, template, filename = 'scriptForImaging_Prep.py') sg.write_script(script,project_dict, template, filename = 'scriptForImaging.py') #sg.write_script(script,project_dict, filename = 'scriptForImaging.py') # cleanup temp files OT_info.cleanup(parameters['AOT'])
def generate(SB_name, project_path = False, comments = True, template=False, split=True): #template to get template, split for generating 2 scripts instead of 1 """Main method. Options are: project_path ='directory_where_project_lives', comments=True/False ie verbose or non-verbose, template = True/False, split = True/False ie two scripts or one""" if (SB_name == 'Template' or SB_name == 'template'): template = True if project_path == False: project_path = os.getcwd() if template == True: parameters = template_parameters() project_dict = {'project_path': project_path, 'project_type': 'Imaging', 'casa_version': '4.4.0'} flagchannels = '2:1201~2199,3:1201~2199' #whatever is in the example print 'this option not completely ready yet!' else: dictionaries = pi.most_info(SB_name, project_path=project_path) project_dict = dictionaries[0] OT_dict = dictionaries[1] os.chdir(project_path) flagchannels=False parameters = get_parameters(project_dict = project_dict, OT_dict = OT_dict) #skip up to here #print parameters['vwidth'] script = script_data_prep(parameters, project_dict, comments, template) if split == True: prep_script = script script = '' #print prep_script spws = sort_spws(parameters) #skip this? continfo = spws[0] #and this lineinfo = spws[1] #and this linespws = spws[2] # and this ... but check first script = make_continuum(script,parameters, project_dict, continfo, comments, template, flagchannels) script = image_setup(script,parameters, comments, template) script = cont_image(script,parameters, comments, template) if lineinfo != []: script = contsub(script,parameters, continfo, linespws, comments) script = line_image(script,parameters, lineinfo, comments) print parameters['vwidth'] script = pbcor_fits(script) if split == True: write_script(prep_script,project_dict, template, filename = 'scriptForImaging_Prep.py') write_script(script,project_dict, template, filename = 'scriptForImaging.py') else: write_script(script,project_dict, template) #, filename = 'scriptForImaging_test.py') #diff filename for template # cleanup temp files if template == False: OT_info.cleanup(parameters['AOT']) # don't need this for template
def generate(SB_name, project_path = False, comments = True): if project_path == False: project_path = os.getcwd() dictionaries = pi.most_info(SB_name, project_path=project_path) project_dict = dictionaries[0] OT_dict = dictionaries[1] os.chdir(project_path) parameters = get_parameters(project_dict = project_dict, OT_dict = OT_dict) script = script_data_prep(parameters, project_dict, comments) spws = sort_spws(parameters) continfo = spws[0] lineinfo = spws[1] linespws = spws[2] script = make_continuum(script,parameters, project_dict, continfo, comments, flagchannels=False) script = image_setup(script,parameters, comments) script = cont_image(script,parameters, comments) if lineinfo != []: script = contsub(script,parameters, continfo, linespws, comments) script = line_image(script,parameters, lineinfo, comments) script = pbcor_fits(script) write_script(script,project_dict, filename = 'scriptForImaging_test.py') # cleanup temp files OT_info.cleanup(parameters['AOT'])