Source code for pipeline.hif.cli.gotasks.hif_setjy

##################### generated by xml-casa (v2) from hif_setjy.xml #################
##################### 4d5ce1c54d2fcf000e52e608b1c3e070 ##############################
from __future__ import absolute_import
from casashell.private.stack_manip import find_local as __sf__
from casashell.private.stack_manip import find_frame as _find_frame
from casatools.typecheck import validator as _pc
from casatools.coercetype import coerce as _coerce
from pipeline.hif.cli import hif_setjy as _hif_setjy_t
from collections import OrderedDict
import numpy
import sys
import os

import shutil

[docs]def static_var(varname, value): def decorate(func): setattr(func, varname, value) return func return decorate
class _hif_setjy: """ hif_setjy ---- Fill the model column with calibrated visibilities Fills the model column with the model visibilities. Issues Support for the setjy spix parameter needs to be added. Output results -- If pipeline mode is 'getinputs' then None is returned. Otherwise the results object for the pipeline task is returned. --------- parameter descriptions --------------------------------------------- vis The list of input MeasurementSets. Defaults to the list of MeasurementSets defined in the pipeline context. field The list of field names or field ids for which the models are to be set. Defaults to all fields with intent '*AMPLITUDE*'. example: field='3C279', field='3C279, M82' intent A string containing a comma delimited list of intents against which the selected fields are matched. Defaults to all data with amplitude intent. example: intent='*AMPLITUDE*' spw The list of spectral windows and channels for which bandpasses are computed. Defaults to all science spectral windows. example: spw='11,13,15,17' model Model image for setting model visibilities. Not fully supported. example: see details in help for CASA setjy task reffile Path to a file containing flux densities for calibrators unknown to CASA. Values given in this file take precedence over the CASA-derived values for all calibrators except solar system calibrators. By default the path is set to the CSV file created by h_importdata, consisting of catalogue fluxes extracted from the ASDM. example: reffile='', reffile='working/flux.csv' normfluxes Normalize lookup fluxes. reffreq The reference frequency for spix, given with units. Provided to avoid division by zero. If the flux density is being scaled by spectral index, then reffreq must be set to whatever reference frequency is correct for the given fluxdensity and spix. It cannot be determined from vis. On the other hand, if spix is 0, then any positive frequency can be used and will be ignored. example: reffreq='86.0GHz', reffreq='4.65e9Hz' fluxdensity Specified flux density [I,Q,U,V] in Jy. Uses [1,0,0,0] flux density for unrecognized sources, and standard flux densities for ones recognized by 'standard', including 3C286, 3C48, 3C147, and several planets, moons, and asteroids. example: [3.06,0.0,0.0,0.0] spix Spectral index for fluxdensity S = fluxdensity * (freq/reffreq)**spix Only used if fluxdensity is being used. If fluxdensity is positive, and spix is nonzero, then reffreq must be set too. It is applied in the same way to all polarizations, and does not account for Faraday rotation or depolarization. scalebychan This determines whether the fluxdensity set in the model is calculated on a per channel basis. If False then only one fluxdensity value is calculated per spw. standard Flux density standard, used if fluxdensity[0] less than 0.0. The options are: 'Baars','Perley 90','Perley-Taylor 95', 'Perley-Taylor 99', 'Perley-Butler 2010' and 'Butler-JPL-Horizons 2010'. default: 'Butler-JPL-Horizons 2012' for solar system object 'Perley-Butler 2010' otherwise pipelinemode The pipeline operating mode. In 'automatic' mode the pipeline determines the values of all context defined pipeline inputs automatically. In interactive mode the user can set the pipeline context defined parameters manually. In 'getinputs' mode the user can check the settings of all pipeline parameters without running the task. default: 'automatic'. dryrun Run the commands (True) or generate the commands to be run but do not execute (False). acceptresults Add the results of the task to the pipeline context (True) or reject them (False). --------- examples ----------------------------------------------------------- 1. Set the model flux densities for all the amplitude calibrators: hif_setjy() """ _info_group_ = """pipeline""" _info_desc_ = """Fill the model column with calibrated visibilities""" __schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'model': {'type': 'cStr', 'coerce': _coerce.to_str}, 'reffile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'normfluxes': {'type': 'cBool'}, 'reffreq': {'type': 'cStr', 'coerce': _coerce.to_str}, 'fluxdensity': {'anyof': [{'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'spix': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'scalebychan': {'type': 'cBool'}, 'standard': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}} def __init__(self): self.__stdout = None self.__stderr = None self.__root_frame_ = None def __globals_(self): if self.__root_frame_ is None: self.__root_frame_ = _find_frame( ) assert self.__root_frame_ is not None, "could not find CASAshell global frame" return self.__root_frame_ def __to_string_(self,value): if type(value) is str: return "'%s'" % value else: return str(value) def __validate_(self,doc,schema): return _pc.validate(doc,schema) def __do_inp_output(self,param_prefix,description_str,formatting_chars): out = self.__stdout or sys.stdout description = description_str.split( ) prefix_width = 23 + 16 + 4 output = [ ] addon = '' first_addon = True while len(description) > 0: ## starting a new line..................................................................... if len(output) == 0: ## for first line add parameter information............................................ if len(param_prefix)-formatting_chars > prefix_width - 1: output.append(param_prefix) continue addon = param_prefix + ' #' first_addon = True addon_formatting = formatting_chars else: ## for subsequent lines space over prefix width........................................ addon = (' ' * prefix_width) + '#' first_addon = False addon_formatting = 0 ## if first word of description puts us over the screen width, bail........................ if len(addon + description[0]) - addon_formatting + 1 > self.term_width: ## if we're doing the first line make sure it's output................................. if first_addon: output.append(addon) break while len(description) > 0: ## if the next description word puts us over break for the next line................... if len(addon + description[0]) - addon_formatting + 1 > self.term_width: break addon = addon + ' ' + description[0] description.pop(0) output.append(addon) out.write('\n'.join(output) + '\n') #--------- return nonsubparam values ---------------------------------------------- def __scalebychan_dflt( self, glb ): return True def __scalebychan( self, glb ): if 'scalebychan' in glb: return glb['scalebychan'] return True def __fluxdensity_dflt( self, glb ): return int(-1) def __fluxdensity( self, glb ): if 'fluxdensity' in glb: return glb['fluxdensity'] return int(-1) def __standard_dflt( self, glb ): return '' def __standard( self, glb ): if 'standard' in glb: return glb['standard'] return '' def __pipelinemode_dflt( self, glb ): return 'automatic' def __pipelinemode( self, glb ): if 'pipelinemode' in glb: return glb['pipelinemode'] return 'automatic' #--------- return inp/go default -------------------------------------------------- def __dryrun_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return bool(False) return None def __field_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return "" if self.__pipelinemode( glb ) == "getinputs": return "" return None def __model_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return "" if self.__pipelinemode( glb ) == "getinputs": return "" return None def __intent_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return "" if self.__pipelinemode( glb ) == "getinputs": return "" return None def __reffreq_dflt( self, glb ): if self.__fluxdensity( glb ) != int(-1): return "1GHz" return None def __vis_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return [] if self.__pipelinemode( glb ) == "getinputs": return [] return None def __acceptresults_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return bool(True) return None def __spix_dflt( self, glb ): if self.__fluxdensity( glb ) != int(-1): return float(0) return None def __normfluxes_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return bool(False) if self.__pipelinemode( glb ) == "getinputs": return bool(False) return None def __reffile_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return "" if self.__pipelinemode( glb ) == "getinputs": return "" return None def __spw_dflt( self, glb ): if self.__pipelinemode( glb ) == "interactive": return "" if self.__pipelinemode( glb ) == "getinputs": return "" return None #--------- return subparam values ------------------------------------------------- def __vis( self, glb ): if 'vis' in glb: return glb['vis'] dflt = self.__vis_dflt( glb ) if dflt is not None: return dflt return [ ] def __field( self, glb ): if 'field' in glb: return glb['field'] dflt = self.__field_dflt( glb ) if dflt is not None: return dflt return '' def __intent( self, glb ): if 'intent' in glb: return glb['intent'] dflt = self.__intent_dflt( glb ) if dflt is not None: return dflt return '' def __spw( self, glb ): if 'spw' in glb: return glb['spw'] dflt = self.__spw_dflt( glb ) if dflt is not None: return dflt return '' def __model( self, glb ): if 'model' in glb: return glb['model'] dflt = self.__model_dflt( glb ) if dflt is not None: return dflt return '' def __reffile( self, glb ): if 'reffile' in glb: return glb['reffile'] dflt = self.__reffile_dflt( glb ) if dflt is not None: return dflt return '' def __normfluxes( self, glb ): if 'normfluxes' in glb: return glb['normfluxes'] dflt = self.__normfluxes_dflt( glb ) if dflt is not None: return dflt return False def __reffreq( self, glb ): if 'reffreq' in glb: return glb['reffreq'] dflt = self.__reffreq_dflt( glb ) if dflt is not None: return dflt return '1GHz' def __spix( self, glb ): if 'spix' in glb: return glb['spix'] dflt = self.__spix_dflt( glb ) if dflt is not None: return dflt return float(0.0) def __dryrun( self, glb ): if 'dryrun' in glb: return glb['dryrun'] dflt = self.__dryrun_dflt( glb ) if dflt is not None: return dflt return False def __acceptresults( self, glb ): if 'acceptresults' in glb: return glb['acceptresults'] dflt = self.__acceptresults_dflt( glb ) if dflt is not None: return dflt return True #--------- subparam inp output ---------------------------------------------------- def __vis_inp(self): if self.__vis_dflt( self.__globals_( ) ) is not None: description = 'List of input MeasurementSets' value = self.__vis( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'vis': value},{'vis': self.__schema['vis']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('vis',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __field_inp(self): if self.__field_dflt( self.__globals_( ) ) is not None: description = 'List of field names or ids' value = self.__field( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'field': value},{'field': self.__schema['field']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('field',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __intent_inp(self): if self.__intent_dflt( self.__globals_( ) ) is not None: description = 'Observing intent of flux calibrators' value = self.__intent( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'intent': value},{'intent': self.__schema['intent']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('intent',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __spw_inp(self): if self.__spw_dflt( self.__globals_( ) ) is not None: description = 'List of spectral window ids' value = self.__spw( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'spw': value},{'spw': self.__schema['spw']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('spw',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __model_inp(self): if self.__model_dflt( self.__globals_( ) ) is not None: description = 'File location for field model' value = self.__model( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'model': value},{'model': self.__schema['model']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('model',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __reffile_inp(self): if self.__reffile_dflt( self.__globals_( ) ) is not None: description = 'Path to file with fluxes for non-solar system calibrators' value = self.__reffile( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'reffile': value},{'reffile': self.__schema['reffile']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('reffile',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __normfluxes_inp(self): if self.__normfluxes_dflt( self.__globals_( ) ) is not None: description = 'Normalize lookup fluxes' value = self.__normfluxes( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'normfluxes': value},{'normfluxes': self.__schema['normfluxes']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('normfluxes',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __reffreq_inp(self): if self.__reffreq_dflt( self.__globals_( ) ) is not None: description = 'Reference frequency for spix' value = self.__reffreq( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'reffreq': value},{'reffreq': self.__schema['reffreq']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('reffreq',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __fluxdensity_inp(self): description = 'Specified flux density [I,Q,U,V]; -1 will lookup values' value = self.__fluxdensity( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'fluxdensity': value},{'fluxdensity': self.__schema['fluxdensity']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output('\x1B[1m\x1B[47m%-16.16s =\x1B[0m %s%-23s%s' % ('fluxdensity',pre,self.__to_string_(value),post),description,13+len(pre)+len(post)) def __spix_inp(self): if self.__spix_dflt( self.__globals_( ) ) is not None: description = 'Spectral index of fluxdensity' value = self.__spix( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'spix': value},{'spix': self.__schema['spix']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('spix',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __scalebychan_inp(self): description = 'Scale the flux density on a per channel basis or else on a per spw basis' value = self.__scalebychan( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'scalebychan': value},{'scalebychan': self.__schema['scalebychan']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output('%-16.16s = %s%-23s%s' % ('scalebychan',pre,self.__to_string_(value),post),description,0+len(pre)+len(post)) def __standard_inp(self): description = 'Flux density standard' value = self.__standard( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'standard': value},{'standard': self.__schema['standard']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output('%-16.16s = %s%-23s%s' % ('standard',pre,self.__to_string_(value),post),description,0+len(pre)+len(post)) def __pipelinemode_inp(self): description = 'The pipeline operating mode' value = self.__pipelinemode( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'pipelinemode': value},{'pipelinemode': self.__schema['pipelinemode']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output('\x1B[1m\x1B[47m%-16.16s =\x1B[0m %s%-23s%s' % ('pipelinemode',pre,self.__to_string_(value),post),description,13+len(pre)+len(post)) def __dryrun_inp(self): if self.__dryrun_dflt( self.__globals_( ) ) is not None: description = 'Run the task (False) or display the commands (True)' value = self.__dryrun( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'dryrun': value},{'dryrun': self.__schema['dryrun']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('dryrun',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) def __acceptresults_inp(self): if self.__acceptresults_dflt( self.__globals_( ) ) is not None: description = 'Automatically accept results into the context' value = self.__acceptresults( self.__globals_( ) ) (pre,post) = ('','') if self.__validate_({'acceptresults': value},{'acceptresults': self.__schema['acceptresults']}) else ('\x1B[91m','\x1B[0m') self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('acceptresults',pre,self.__to_string_(value),post),description,9+len(pre)+len(post)) #--------- global default implementation------------------------------------------- @static_var('state', __sf__('casa_inp_go_state')) def set_global_defaults(self): self.set_global_defaults.state['last'] = self glb = self.__globals_( ) if 'dryrun' in glb: del glb['dryrun'] if 'field' in glb: del glb['field'] if 'model' in glb: del glb['model'] if 'standard' in glb: del glb['standard'] if 'pipelinemode' in glb: del glb['pipelinemode'] if 'intent' in glb: del glb['intent'] if 'reffreq' in glb: del glb['reffreq'] if 'vis' in glb: del glb['vis'] if 'acceptresults' in glb: del glb['acceptresults'] if 'spix' in glb: del glb['spix'] if 'scalebychan' in glb: del glb['scalebychan'] if 'fluxdensity' in glb: del glb['fluxdensity'] if 'normfluxes' in glb: del glb['normfluxes'] if 'reffile' in glb: del glb['reffile'] if 'spw' in glb: del glb['spw'] #--------- inp function ----------------------------------------------------------- def inp(self): print("# hif_setjy -- %s" % self._info_desc_) self.term_width, self.term_height = shutil.get_terminal_size(fallback=(80, 24)) self.__vis_inp( ) self.__field_inp( ) self.__intent_inp( ) self.__spw_inp( ) self.__model_inp( ) self.__reffile_inp( ) self.__normfluxes_inp( ) self.__reffreq_inp( ) self.__fluxdensity_inp( ) self.__spix_inp( ) self.__scalebychan_inp( ) self.__standard_inp( ) self.__pipelinemode_inp( ) self.__dryrun_inp( ) self.__acceptresults_inp( ) #--------- tget function ---------------------------------------------------------- @static_var('state', __sf__('casa_inp_go_state')) def tget(self,file=None): from casashell.private.stack_manip import find_frame from runpy import run_path filename = None if file is None: if os.path.isfile("hif_setjy.last"): filename = "hif_setjy.last" elif isinstance(file, str): if os.path.isfile(file): filename = file if filename is not None: glob = find_frame( ) newglob = run_path( filename, init_globals={ } ) for i in newglob: glob[i] = newglob[i] self.tget.state['last'] = self else: print("could not find last file, setting defaults instead...") self.set_global_defaults( ) def __call__( self, vis=None, field=None, intent=None, spw=None, model=None, reffile=None, normfluxes=None, reffreq=None, fluxdensity=None, spix=None, scalebychan=None, standard=None, pipelinemode=None, dryrun=None, acceptresults=None ): def noobj(s): if s.startswith('<') and s.endswith('>'): return "None" else: return s _prefile = os.path.realpath('hif_setjy.pre') _postfile = os.path.realpath('hif_setjy.last') _return_result_ = None _arguments = [vis,field,intent,spw,model,reffile,normfluxes,reffreq,fluxdensity,spix,scalebychan,standard,pipelinemode,dryrun,acceptresults] _invocation_parameters = OrderedDict( ) if any(map(lambda x: x is not None,_arguments)): # invoke python style # set the non sub-parameters that are not None local_global = { } if fluxdensity is not None: local_global['fluxdensity'] = fluxdensity if scalebychan is not None: local_global['scalebychan'] = scalebychan if standard is not None: local_global['standard'] = standard if pipelinemode is not None: local_global['pipelinemode'] = pipelinemode # the invocation parameters for the non-subparameters can now be set - this picks up those defaults _invocation_parameters['fluxdensity'] = self.__fluxdensity( local_global ) _invocation_parameters['scalebychan'] = self.__scalebychan( local_global ) _invocation_parameters['standard'] = self.__standard( local_global ) _invocation_parameters['pipelinemode'] = self.__pipelinemode( local_global ) # the sub-parameters can then be set. Use the supplied value if not None, else the function, which gets the appropriate default _invocation_parameters['vis'] = self.__vis( _invocation_parameters ) if vis is None else vis _invocation_parameters['field'] = self.__field( _invocation_parameters ) if field is None else field _invocation_parameters['intent'] = self.__intent( _invocation_parameters ) if intent is None else intent _invocation_parameters['spw'] = self.__spw( _invocation_parameters ) if spw is None else spw _invocation_parameters['model'] = self.__model( _invocation_parameters ) if model is None else model _invocation_parameters['reffile'] = self.__reffile( _invocation_parameters ) if reffile is None else reffile _invocation_parameters['normfluxes'] = self.__normfluxes( _invocation_parameters ) if normfluxes is None else normfluxes _invocation_parameters['reffreq'] = self.__reffreq( _invocation_parameters ) if reffreq is None else reffreq _invocation_parameters['spix'] = self.__spix( _invocation_parameters ) if spix is None else spix _invocation_parameters['dryrun'] = self.__dryrun( _invocation_parameters ) if dryrun is None else dryrun _invocation_parameters['acceptresults'] = self.__acceptresults( _invocation_parameters ) if acceptresults is None else acceptresults else: # invoke with inp/go semantics _invocation_parameters['vis'] = self.__vis( self.__globals_( ) ) _invocation_parameters['field'] = self.__field( self.__globals_( ) ) _invocation_parameters['intent'] = self.__intent( self.__globals_( ) ) _invocation_parameters['spw'] = self.__spw( self.__globals_( ) ) _invocation_parameters['model'] = self.__model( self.__globals_( ) ) _invocation_parameters['reffile'] = self.__reffile( self.__globals_( ) ) _invocation_parameters['normfluxes'] = self.__normfluxes( self.__globals_( ) ) _invocation_parameters['reffreq'] = self.__reffreq( self.__globals_( ) ) _invocation_parameters['fluxdensity'] = self.__fluxdensity( self.__globals_( ) ) _invocation_parameters['spix'] = self.__spix( self.__globals_( ) ) _invocation_parameters['scalebychan'] = self.__scalebychan( self.__globals_( ) ) _invocation_parameters['standard'] = self.__standard( self.__globals_( ) ) _invocation_parameters['pipelinemode'] = self.__pipelinemode( self.__globals_( ) ) _invocation_parameters['dryrun'] = self.__dryrun( self.__globals_( ) ) _invocation_parameters['acceptresults'] = self.__acceptresults( self.__globals_( ) ) try: with open(_prefile,'w') as _f: for _i in _invocation_parameters: _f.write("%-13s = %s\n" % (_i,noobj(repr(_invocation_parameters[_i])))) _f.write("#hif_setjy( ") count = 0 for _i in _invocation_parameters: _f.write("%s=%s" % (_i,noobj(repr(_invocation_parameters[_i])))) count += 1 if count < len(_invocation_parameters): _f.write(",") _f.write(" )\n") except: pass try: _return_result_ = _hif_setjy_t( _invocation_parameters['vis'],_invocation_parameters['field'],_invocation_parameters['intent'],_invocation_parameters['spw'],_invocation_parameters['model'],_invocation_parameters['reffile'],_invocation_parameters['normfluxes'],_invocation_parameters['reffreq'],_invocation_parameters['fluxdensity'],_invocation_parameters['spix'],_invocation_parameters['scalebychan'],_invocation_parameters['standard'],_invocation_parameters['pipelinemode'],_invocation_parameters['dryrun'],_invocation_parameters['acceptresults'] ) except Exception as e: from traceback import format_exc from casatasks import casalog casalog.origin('hif_setjy') casalog.post("Exception Reported: Error in hif_setjy: %s" % str(e),'SEVERE') casalog.post(format_exc( )) _return_result_ = False try: os.rename(_prefile,_postfile) except: pass return _return_result_ hif_setjy = _hif_setjy( )