Commits

Darrell Schiebel authored 19d126facd8
add history_filter argument to gclean to allow for abbreviated masks in tclean command history (CAS-6692)

casatasks/src/private/imagerhelpers/_gclean.py

Modified
52 52 print(rec)
53 53
54 54
55 55 See also: __next__(...) for a description of the returned rec
56 56
57 57 TODO: do we need to preserve any hidden state between tclean calls for the iterbotsink and/or synthesisimager tools?
58 58 '''
59 59
60 60 def _tclean( self, *args, **kwargs ):
61 61 from casatasks import tclean
62 - arg_s = ', '.join(map( lambda a: repr(a), args ))
63 - kw_s = ', '.join( map( lambda kv: "%s=%s" % (kv[0],repr(kv[1])), kwargs.items()) )
62 + arg_s = ', '.join( map( lambda a: self._history_filter(len(self._exe_cmds), None, repr(a)), args ) )
63 + kw_s = ', '.join( map( lambda kv: self._history_filter(len(self._exe_cmds), kv[0], "%s=%s" % (kv[0],repr(kv[1]))), kwargs.items()) )
64 64 if len(arg_s) > 0 and len(ks_s) > 0:
65 65 parameters = arg_s + ", " + kw_s
66 66 else:
67 67 parameters = arg_s + kw_s
68 68 self._exe_cmds.append( "tclean( %s )" % parameters )
69 69 return tclean( *args, **kwargs )
70 70
71 71 def cmds( self ):
72 72 return self._exe_cmds
73 73
91 91 if 'cyclefactor' in msg:
92 92 try:
93 93 self._cyclefactor = int(msg['cyclefactor'])
94 94 except ValueError:
95 95 pass
96 96 if 'mask' in msg:
97 97 self._mask = msg['mask']
98 98
99 99 def __init__( self, vis, imagename, imsize=[100], cell="1arcsec", specmode='cube', nchan=-1, start='',
100 100 width='', interpolation='linear', gridder='standard', pblimit=0.2, deconvolver='hogbom',
101 - niter=0, threshold='0.1Jy', cycleniter=-1, cyclefactor=1.0, scales=[] ):
101 + niter=0, threshold='0.1Jy', cycleniter=-1, cyclefactor=1.0, scales=[],
102 + history_filter=lambda index, arg, history_value: history_value ):
102 103 self._vis = vis
103 104 self._imagename = imagename
104 105 self._imsize = imsize
105 106 self._cell = cell
106 107 self._specmode = specmode
107 108 self._nchan = nchan
108 109 self._start = start
109 110 self._width = width
110 111 self._interpolation = interpolation
111 112 self._gridder = gridder
112 113 self._pblimit = pblimit
113 114 self._deconvolver = deconvolver
114 115 self._niter = niter
115 116 self._threshold = threshold
116 117 self._cycleniter = cycleniter
117 118 self._cyclefactor = cyclefactor
118 119 self._mask = ''
119 120 self._scales = scales
120 121 self._exe_cmds = [ ]
122 + self._history_filter = history_filter
121 123
122 124 if len(list(filter(lambda f: os.path.isdir(f) and f.startswith(self._imagename + '.'), os.listdir( os.curdir )))) > 0:
123 125 raise RuntimeError("image files already exist")
124 126 self._convergence_result = (None,None)
125 127
126 128 def __filter_convergence( raw ):
127 129 ###
128 130 ### this function filters out the pieces of the `raw` tclean 'summaryminor'
129 131 ### return dictionary that we care about
130 132 ###

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut