Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/imager.py: 61%
263 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 18:48 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 18:48 +0000
1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 3.0.12
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
7from sys import version_info as _swig_python_version_info
8if _swig_python_version_info >= (2, 7, 0):
9 def swig_import_helper():
10 import importlib
11 pkg = __name__.rpartition('.')[0]
12 mname = '.'.join((pkg, '_imager')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_imager')
17 _imager = swig_import_helper()
18 del swig_import_helper
19elif _swig_python_version_info >= (2, 6, 0):
20 def swig_import_helper():
21 from os.path import dirname
22 import imp
23 fp = None
24 try:
25 fp, pathname, description = imp.find_module('_imager', [dirname(__file__)])
26 except ImportError:
27 import _imager
28 return _imager
29 try:
30 _mod = imp.load_module('_imager', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _imager = swig_import_helper()
36 del swig_import_helper
37else:
38 import _imager
39del _swig_python_version_info
41try:
42 _swig_property = property
43except NameError:
44 pass # Python < 2.2 doesn't have 'property'.
46try:
47 import builtins as __builtin__
48except ImportError:
49 import __builtin__
51def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52 if (name == "thisown"):
53 return self.this.own(value)
54 if (name == "this"):
55 if type(value).__name__ == 'SwigPyObject':
56 self.__dict__[name] = value
57 return
58 method = class_type.__swig_setmethods__.get(name, None)
59 if method:
60 return method(self, value)
61 if (not static):
62 if _newclass:
63 object.__setattr__(self, name, value)
64 else:
65 self.__dict__[name] = value
66 else:
67 raise AttributeError("You cannot add attributes to %s" % self)
70def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
74def _swig_getattr(self, class_type, name):
75 if (name == "thisown"):
76 return self.this.own()
77 method = class_type.__swig_getmethods__.get(name, None)
78 if method:
79 return method(self)
80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
83def _swig_repr(self):
84 try:
85 strthis = "proxy of " + self.this.__repr__()
86 except __builtin__.Exception:
87 strthis = ""
88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
90try:
91 _object = object
92 _newclass = 1
93except __builtin__.Exception:
94 class _object:
95 pass
96 _newclass = 0
98class imager(_object):
99 """Proxy of C++ casac::imager class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, imager, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, imager, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> imager"""
109 this = _imager.new_imager()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def advise(self, *args, **kwargs):
116 """
117 advise(self, _takeadvice, _amplitudeloss, _fieldofview, _pixels, _cell, _facets, _phasecenter) -> bool
121 Summary:
122 Advise (and optionally use) parameter values
124 Description:
127 Advise on recommended values of certain parameters. Return these
128 values and optionally use them in Imager.
130 The calculations are performed as following:
132 begin{description}
133 item[cell] The maximum uv distance in wavelength is found and then half of the
134 inverse is taken as the maximum cellsize allowed.
135 item[pixels] The field of view is converted to a number of pixels
136 using the calculated cell size.
137 item[facets] The number of facets on an axis is calculated in two
138 different ways. The first method simply requires that the peeling of
139 facets away from the celestial sphere should not cause an amplitude
140 drop of more than the argument {tt amplitudeloss}. The positions may
141 be incorrect, but all the sources will be removed correctly. The
142 second method requires that the source positions be accurate to the
143 same fraction of the beam specified by {tt amplitudeloss}. The
144 second calculates the second moment in w and in uv distance and
145 chooses the number of facets correspondingly. The first method does
146 the same but after fitting a plane to the sampling: $w = a u + b v$.
147 For an approximately coplanar array, the positions may be wrong but
148 the removal of sidelobes will be accurate. The number of facets
149 returned is the second, usually smaller, number. The formula used
150 is:
151 begin{equation}
152 N_{facets} = N_{pixels} sqrt{{{Delta theta}over{sqrt{8 delta A}}}{w_{rms}}over{uv_{rms}}}
153 end{equation}
154 where $Delta theta$ is the cellsize in radians, and $delta A$ is
155 the amplitude loss. This formula can be derived from (a) the peeling
156 of facets from the celestial sphere, and (b) a quadratic approximation
157 for the beam size both in the plane of the sky and along the $w$ axis.
158 end{description}
160 Input Parameters:
161 takeadvice Use the advised values?
162 amplitudeloss Maximum fractional amplitude loss due to faceting
163 fieldofview Desired field of view
165 Output Parameters:
166 pixels Number of pixels on a side
167 cell Recommended maximum cellsize
168 facets Recommended number of facets on one axis
169 phasecenter Direction of phase center as a measure
171 --------------------------------------------------------------------------------
173 """
174 return _imager.imager_advise(self, *args, **kwargs)
177 def advisechansel(self, *args, **kwargs):
178 """
179 advisechansel(self, _freqstart, _freqend, _freqstep, _freqframe, _msname, _fieldid, _getfreqrange, _spwselection) -> record *
183 Summary:
184 Advise on spw and chan selection optimal for the image frequency range wanted
186 Description:
189 Basically tells you what channels of which spectral window need to be
190 selected for your image spectral parameters. The freqstep is used to
191 calulate the extra padding needed for data selection at the begining
192 and end of the range. The freqframe parameter is the frame in which
193 the frequency range is being given. It will be converted to the frame
194 of the data with time to locate which channel match.
195 A record will be returned with an element for each ms used in selectvis.
196 Each element of the record will have the spwids and channel start and nchan for each spwid.
197 if the parameter msname is used then the MSs associated associated with
198 this tool (that have been either 'open'ed or 'selectvis'ed) are ignored
199 In this mode it is a helper function to the general world ...no need to
200 open or selectvis. You need to specify the field_id for which this calculation is
201 being done for in the helper mode.
202 If you have already set MS's and selected data and msname='' then
203 the calulation is done for the field(s) selected in selectvis.
205 If the parameter {tt getfreqrange=True} then the reverse is requested. You set {tt spwselection} to be the range of data selection you want to use and you'll get the range of frequency covered in the frame you set.
207 Input Parameters:
208 freqstart Begining of frequency range in Hz
209 freqend End of frequency range in Hz
210 freqstep spectral channel resolution of intended image in Hz
211 freqframe frame in which frequency is being expressed in other parameters
212 msname name of an ms, if empty string it will use the ms's used in selectvis
213 fieldid fieldid to use when msname is not empty otherwise ignored and field selected in selectvis is used
214 getfreqrange if set then freqrange is returned in the frame requested for the data selected
215 spwselection if getfreqrange=True then this is needed to find the range of frequency in the frame requested
217 Example:
219 In this example, we are interested in an image cube which span 20.0682GHz to 20.1982 in LSRK which will have a channel resolution of 3.9MHz. The field we are interested is field 4 of each of the ms.
222 #######
223 im.selectvis(vis='test1.ms', field='4', spw='*')
224 im.selectvis(vis='test2.ms', field='4', spw='*')
225 selinfo=im.advisechansel(freqstart=2.00682e10, freqend=2.01982e10, freqstep=3.9e3, freqframe='LSRK')
226 ####The output 'selfinfo' will be a record which will look like thus
227 {'ms_0': {'nchan': array([109, 23], dtype=int32),
228 'spw': array([4, 5], dtype=int32),
229 'start': array([19, 0], dtype=int32)},
230 'ms_1': {'nchan': array([109, 23], dtype=int32),
231 'spw': array([4, 5], dtype=int32),
232 'start': array([19, 0], dtype=int32)}}
233 ###
234 Thus from the first ms a spw selection like '4:19~127, 5:0~22' is all that is needed.
235 Similarly from the second ms.
237 ###if you need this info without needing to change the state of the imager tool
238 then you can it as follows
240 im.advisechansel(freqstart=2.00682e10, freqend=2.01982e10, freqstep=3.9e3, freqframe='LSRK', msname='test1.ms', fieldid=4)
243 ####now if you want to see what frequency range is covered, in the frame
244 ####defined by freqframe, in spwselection you want to use
245 im.selectvis(vis='test3.ms', spw='0:20~210')
246 im.advisechansel(getfreqrange=True, freqframe='LSRK')
247 ### the output will be something
248 {'freqend': 346020345384.64178, 'freqstart': 345683852920.1723}
250 ###and if you just want to use it as a helper function without touching the state
251 ###of imager
253 im.advisechansel(msname='test3.ms', getfreqrange=True, spwselection='0:20~210')
255 --------------------------------------------------------------------------------
257 """
258 return _imager.imager_advisechansel(self, *args, **kwargs)
261 def approximatepsf(self, *args, **kwargs):
262 """
263 approximatepsf(self, _psf) -> bool
267 Summary:
268 Calculate approximate point spread functions
270 Description:
273 Calculate the approximate point spread function.
274 {em Note that the model visibilities are updated}.
276 Some types of imaging do not yield a well-defined point spread
277 function. For example, mosaicing or single dish imaging both yield
278 point spread functions that are position dependent. Nevertheless, one
279 can still usefully define an {em approximate} PSF that is of some
280 utility. This is calculated by doing the following calculation: a
281 point source is located at the center of the specified coordinate
282 system and the model data predicted. The approximate PSF is then formed from
283 those model data using the full sky equation. For regular sampling in
284 the image plane, this approximate PSF is actually quite good. It can
285 be used in a deconvolution. For a mosaic with similar uv sampling per
286 pointing, the approximate PSF is roughly the PSF per pointing
287 multiplied by the primary beam. For a single dish image, it is roughly
288 the telescope primary beam convolved with itself (if the
289 gridfunction='pb' was selected).
291 Input Parameters:
292 psf Name of output point spread function
294 Example:
296 Example of how to make the approximate psf for a mosaic:
298 im.open('orion.ms')
299 im.selectvis(spwid=[0, 1] ,field=range(2,11));
300 im.defineimage(nx=300, ny=300, cellx='2.0arcsec',celly='2.0arcsec' , stokes='I', phasecenter=6, spwid=[0,1])
301 im.weight('natural')
302 im.setvp(dovp=T, usedefaultvp=True)
303 im.setoptions(ftmachine='mosaic', padding=1.0)
304 im.approximatepsf(psf='LePSF.image')
306 --------------------------------------------------------------------------------
308 """
309 return _imager.imager_approximatepsf(self, *args, **kwargs)
312 def boxmask(self, *args, **kwargs):
313 """
314 boxmask(self, _mask, _blc, _trc, _value) -> bool
318 Summary:
319 Construct a mask image from blc, trc
321 Description:
324 A mask image is an image with the same shape as the other images but
325 with values between 0.0 and 1.0 as a pixel value. Mask images are used in
326 imager to control the region selected in a deconvolution.
328 In the Clark CLEAN, the mask image can usefully have any value between
329 0.0 and 1.0. Intermediate value discourage but do not rule out
330 selection of clean components in that region. This is accomplished by
331 multiplying the residual image by the mask prior to entering the minor
332 cycle. Note that if you do use a mask for the Clark or Hogbom Clean,
333 it must cover only a quarter of the image. boxmask does not enforce
334 this requirement.
336 Input Parameters:
337 mask name of mask image
338 blc Bottom left corner
339 trc Top right corner, should be image shape
340 value Value to fill in
342 Example:
344 im.boxmask(mask='bigmask', blc=[56,45,1,1], trc=[87,93,4,1])
345 im.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
349 Makes the image bigmask, and then sets it to unity for all points in
350 the region bounded by the blc and trc. Then cleans using it as the
351 mask.
353 --------------------------------------------------------------------------------
355 """
356 return _imager.imager_boxmask(self, *args, **kwargs)
359 def calcuvw(self, *args, **kwargs):
360 """
361 calcuvw(self, _fields, _refcode, _reuse) -> bool
365 Summary:
366 Calculates (u, v, w) coordinates for the ms.
368 Description:
371 This calculates (u, v, w) positions for the visibilities using the antenna
372 and feed positions and offsets, the time, and the phase tracking center(s).
375 Input Parameters:
376 fields Field IDs (numbered relative to 0) to operate on. Blank = all.
377 refcode Reference frame to use for the generated (u, v, w)s. WARNING: clean and the im tool ignore the reference frame claimed by the UVW column (it is often mislabelled as ITRF when it is really J2000) and instead assume the (u, v, w)s are in the same frame as the phase tracking center. calcuvw does not yet force the UVW column and field centers to use the same reference frame! Blank = use the phase tracking frame of vis.
378 reuse Start from the UVWs in vis (True) or calculate them from the antenna positions?
380 Example:
382 im.open('3C273XC1.MS')
383 im.calcuvw()
384 im.done()
386 --------------------------------------------------------------------------------
388 """
389 return _imager.imager_calcuvw(self, *args, **kwargs)
392 def clean(self, *args, **kwargs):
393 """
394 clean(self, _algorithm, _niter, _gain, _threshold, _displayprogress, _model, _keepfixed, _complist, _mask, _image, _residual, _psfimage, _interactive, _npercycle, _masktemplate) -> record *
398 Summary:
399 Calculate a deconvolved image with selected clean algorithm
401 Description:
404 Makes a clean image using either the Hogbom, Clark, multi-scale or multi-field
405 algorithms. The Clark algorithm is the default. The clean is performed
406 on the residual image calculated from the visibility data currently
407 selected. Hence the first step performed in clean is to transform the
408 current model or models (optionally including a componentlist) to fill
409 in the MODEL_DATA column, and then inverse transform the residual
410 visibilities to get a residual image. This residual image is then
411 cleaned using the corresponding point spread function. This means that
412 the initial model is used as the starting point for the
413 deconvolution. Thus if you want to restart a clean, simply set the
414 model to the model that was previously produced by clean.
416 Rather than explicit CLEAN boxes, mask images are used to constrain
417 the region that is to be deconvolved. To make mask images,
418 use either boxmask (to define a mask
419 via the corner locations blc and trc) or
420 mask (to define a mask via
421 thresholding an existing image) or regionmask (to make masks via regions using the regionmanager or interactively through the viewer) . The default mask is the inner quarter
422 of the image.
424 The CLEAN deconvolution is joint in whatever Stokes parameters are
425 present. Thus it searchs for peaks in either $I$ or $I+|V|$ or
426 $I+sqrt{Q^2+U^2+V^2}$, the rationale for the latter two forms being
427 to be biased towards finding strongly polarized pixels first (these
428 forms are also the maximum eigenvalue of the coherency matrix). The
429 PSF is constrained to be the same in all polarizations (a feature of
430 this implementation, not of the Hamaker-Bregman-Sault formalism). But the option of
431 searching peaks in the stokes planes independently is available via
432 the {tt clarkstokes} parameter
436 The clean algorithms possible are:
437 begin{description}
438 item[Hogbom] The classic algorithm: points are found iteratively
439 by searching for the peak. Each point is subtracted from the
440 full residual image using the shifted and scaled point spread
441 function.
442 item[Multiscale] An experimental multi-scale clean algorithm is invoked.
443 The algorithm is fully described in
444 deconvolver.
445 item[Clark] The faster algorithm: the cleaning is split into
446 minor and major cycles. In the minor cycles only the brightest
447 points are cleaned, using a subset of the point spread function.
448 In the major cycle, the points thus found are subtracted correctly
449 by using an FFT-based convolution.
450 item[Multi-field] Cleaning is split into minor and major
451 cycles. For each field, a Clark-style minor cycle is performed.
452 In the major cycle, the points thus found are subtracted
453 either from the original visibilities (for multiple fields)
454 or using a convolution (for only one field). The latter is
455 much faster. Multi-field imaging has been implemented for
456 Clark, Hogbom, and Multi-scale deconvolution algorithms.
457 item[Cotton-Schwab] Cleaning is split into minor and major
458 cycles. For each field, a Clark-style minor cycle is performed.
459 In the major cycle, the points thus found are subtracted
460 from the original visibilities. A fast variant does a convolution
461 using a FFT. This will be faster for large numbers of
462 visibilities. Double the image size from that used for Cotton-Schwab
463 and set a mask to clean only the inner quarter.
464 item[Wide-field] The user will need to use a wide-field algorithm to
465 deconvolve if the array is not coplanar over the field of view being
466 imaged . The technique used is to break the field being imaged into
467 smaller pieces (facets), over each of which the array appear
468 planar. We implement a rectangular facetting scheme. If the number of
469 facets specified in defineimage is
470 greater than one, Either wfhogbom or wfclark algorithm has to be
471 selected here to perform a wide-field decovolution. The function
472 advise can be used to calculate or
473 check if you need to use a wide-field deconvolution. Note that
474 aliasing can be reduced by using the {tt padding} argument in
475 setoptions. In practice the
476 previous sentence means that if you notice the clean to diverge at the
477 edges of the facets then you need to use a larger amount of padding
478 for the FT; the default being 1.2. Wide-field imaging has been
479 implemented for Clark and Hogbom algorithms.
480 end{description}
482 The multi-field clean should be used if either of two conditions
483 hold:
484 begin{enumerate}
485 item Multiple fields are to be cleaned simultaneously {bf OR}
486 item Primary beam correction is enabled. In this case, a
487 mosaiced clean is performed.
488 end{enumerate}
490 Note that for the single pointing algorithms, only a quarter of the
491 image may be cleaned. If no mask is set, then the cleaned region
492 defaults to the inner quarter. If a mask larger than a quarter of the
493 image is set, then only the inner quarter part of that mask is used.
494 However, for the wide-field and multi-field imaging (including the
495 Cotton-Schwab algorithm), the entire field may be imaged because the
496 major cycles either do an exact subtraction from the visibilities or
497 because PSF extent is more than twice the extent of the primary beam
498 support.
500 Before {tt clean} can be run, you must run {tt selectvis} and {tt defineimage}.
501 Before {tt clean} can be run with a multi-field algorithm (especially for mosaic), you should run
502 {tt setvp}. You may want to run {tt setmfcontrol} before running {tt clean}
503 with a multi-field or wide-field algorithm, though the default control values
504 may be acceptable. Before {tt clean} can be run with a multi-scale algorithm,
505 {tt setscales} must be run.
508 Interactive cleaning/masking: If the user wants to see what the clean
509 image looks like after npercycle iteration and mask or modify the mask
510 each time, he/she should set {tt interactive=True} and give npercycle to a
511 fraction of niter. A viewer with the last residual image along with an
512 overlayed mask appear after every npercycle iteration. The user can
513 add or delete regions (by clicking on the appropriate button) to the
514 mask using the region button and drawing regions and double clicking
515 inside the region. When satisfied and ready to continue cleaning press 'DONE
516 with masking' (if the user want to terminate the cleaning process use
517 the 'STOP' button). The button 'No more mask changes' should be used
518 if the user want clean to proceed without any further interruption.
519 Even if {tt interactive=False}, and if the parameter
520 'mask' is non-empty, it is still used in limiting the search area for
521 clean components. If the parameter 'masktemplate' is not empty this
522 means that the user want to use an apriori image to make the mask the
523 first time (e.g a previously cleaned image)
525 This function returns a record containing convergence, iterations used and threshold reached.
527 Input Parameters:
528 algorithm Algorithm to use
529 niter Number of Iterations, set to zero for no CLEANing
530 gain Loop Gain for CLEANing
531 threshold Flux level at which to stop CLEANing
532 displayprogress Display the progress of the cleaning?
533 model Names of clean model images
534 keepfixed Keep one or more models fixed
535 complist Name of component list
536 mask Names of mask images used for CLEANing
537 image Names of restored images
538 residual Names of residual images
539 psfimage Names of psfs if they are needed
540 interactive whether to stop clean and interactively mask
541 npercycle If interactive is 'T', then no of iter of clean before stopping, usually a fraction of niter
542 masktemplate If non empty then will use this image to make the mask the first time
544 Example:
546 im.clean(model='3C273XC1.clean.model',
547 mask='3C283XC1.mask', niter=1000, gain=0.25, threshold='0.03Jy')
550 A few points should be noted in this example:
552 begin{itemize}
553 item When the mask parameter is specified, the number of mask images
554 listed should be equal to the number of model images. They
555 should also have the same coordinate system as their
556 corresponding model images.
557 item If one or more model images are listed in the model parameter
558 but the image and residual parameters are empty, the restored
559 and residual images are automatically named as the model names
560 appended with '.restored' and '.residual', respectively.
561 item No restored or residual image is made if the respective image
562 string is explicitly unset.
563 end{itemize}
566 include 'imager.g';
567 msfile = 'vlac125K.ms';
568 im.open(msfile);
569 npix = 500; cell='5arcsec';
570 #
571 # CS on 500 by 500
572 #
573 im.defineimage(nx=npix, ny=npix, cellx=cell, celly=cell, stokes='I',
574 spw=[0,1]);
575 im.setoptions(padding=1.0);
576 im.selectvis(spwid=[0,1]);
577 im.clean('cs', model='vlac125K.cs', image='vlac125K.cs.restored',
578 niter=1000, gain=0.1);
579 #
580 # CSF on 1000 by 1000, cleaning a given box
581 #
583 im.defineimage(nx=2*npix, ny=2*npix, cellx=cell, celly=cell, stokes='I',
584 spwid=[1,2]);
585 reg=rg.box(blc=[400,500], trc=[450,550])
586 im.regionmask('vlac125K.mask', region=reg);
587 im.clean('csf', model='vlac125K.csf', image='vlac125K.csf.restored',
588 mask='vlac125K.mask', niter=1000, gain=0.1);
590 #
591 # CS on 1000 by 1000, cleaning entire image
592 #
594 im.defineimage(nx=2*npix, ny=2*npix, cellx=cell, celly=cell, stokes='I',
595 spwid=[1,2]);
596 im.clean('cs', model='vlac125K.csl', image='vlac125K.csl.restored',
597 mask='vlac125K.mask', niter=1000, gain=0.1);
599 im.done();
601 --------------------------------------------------------------------------------
603 """
604 return _imager.imager_clean(self, *args, **kwargs)
607 def clipimage(self, *args, **kwargs):
608 """
609 clipimage(self, _image, _threshold) -> bool
613 Summary:
614 Zero all pixels where Stokes I is below a threshold
616 Description:
619 All pixels in the image with Stokes I less than some threshold
620 are set to zero. This is useful prior to self-calibration where one
621 oftens wishes to remove negative pixels from the model. Note that
622 if the image has polarization information, then the polarized
623 part of a pixel is also set to zero if Stokes I is less than the
624 threshold.
626 Input Parameters:
627 image name of image
628 threshold Threshold
630 Example:
632 im.clipimage(image='clean', threshold='50mJy')
634 --------------------------------------------------------------------------------
636 """
637 return _imager.imager_clipimage(self, *args, **kwargs)
640 def clipvis(self, *args, **kwargs):
641 """
642 clipvis(self, _threshold) -> bool
646 Summary:
647 Flag visibilities where residual exceeds a threshold
649 Description:
652 All visibilities where the residual exceeds some threshold
653 are flagged. This provides a simple way of flagging bad
654 data.
656 Input Parameters:
657 threshold Threshold
659 Example:
661 im.plotvis('residual')
662 # determine threshold then apply it
663 im.clipvis(threshold='50mJy')
665 --------------------------------------------------------------------------------
667 """
668 return _imager.imager_clipvis(self, *args, **kwargs)
671 def close(self):
672 """
673 close(self) -> bool
677 Summary:
678 Close the imager tool, with data written on disk, keeping imager process running for future use
680 Description:
683 This is used to close {tt imager} tools. Note that the
684 data is written to disk. The {tt imager} process keeps running
685 until a done tool function call is performed.
687 Example:
689 im.open('3C273XC1.MS')
690 im.makeimage(image='3C273XC1.dirty',type='corrected')
691 im.close()
693 --------------------------------------------------------------------------------
695 """
696 return _imager.imager_close(self)
699 def defineimage(self, *args, **kwargs):
700 """
701 defineimage(self, _nx, _ny, _cellx, _celly, _stokes, _phasecenter, _mode, _nchan, _start, _step, _spw, _restfreq, _outframe, _veltype, _facets, _movingsource, _distance, _projection) -> bool
705 Summary:
706 Set the image parameters for subsequent processing
708 Description:
711 Define the default image parameters. If an image is to be
712 made, then these parameters are used in the construction
713 of the image. Thus, for example, the tool function make
714 makes an (empty) image using these parameters.
716 Note that some parameters can be specified either in canonical units
717 or via measures. To establish default values, the ids for the default
718 spectral window and default field id must be given.
720 The parameter {tt mode} can be one of the following:
721 begin{itemize}
722 item mfs
723 item channel
724 item velocity or opticalvelocity
725 item frequency
726 end{itemize}
728 {tt imager} can perform multi-frequency synthesis over several
729 spectral windows (mode='mfs'). To achieve this, you should set spwid
730 to an array of the required spectral windows ({em e.g.} {tt
731 spwid=[0,1]}). WARNING: For multifrequency synthesis, 'mfs', it is
732 important that the spwid's selected in selectvis be the SAME
733 as the one selected in {tt defineimage}. Otherwise the frequency at which
734 the image is made is not going to be the same as to the one as the one
735 used in gridding the visibility and can lead to image artifacts. For
736 {tt mode='velocity'} and {tt mode='frequency'} the {tt step}
737 parameter has to be a measure/quantity of velocity or frequency,
738 otherwise for {tt mode='channel'} step is the number of data
739 channels to be averaged to make one image channel( see examples
740 below).
743 The phase center of the image defaults to that of the specified
744 phasecenter (the first fieldid in the ms is taken if none is
745 specified), this parameter can be a fieldid or a measure string or the
746 record output from the direction function of the measures tool( direction ).
747 This is important if you have multiple pointings in the data. The user
748 would have used selectvis to select which pointings would be used in imaging. If the
749 conversion from the observed direction requires frame information then
750 this is taken as follows: begin{itemize} item Direction information,
751 including the coordinate system, is taken from the relevant entry in
752 the Field table of the MeasurementSet. item The epoch is taken from
753 the time of observation of each visibility. item A position is
754 specified via the {tt imager} tool function setoptions
755 end{itemize}
757 If the specified number of facets is greater than unity then the image
758 is split into facets (this number along the x and y axes) and
759 processed. This is necessary when using wide-field algorithm for
760 deconvolving the image, in cases of non-coplanar arrays (e.g the VLA
761 at low frequencies but can be safely left at 1 for the ATCA or WSRT).
762 This is now recommended only when memory or image size is of a problem,
763 otherwise for widefield issues, wprojection (ftmachine parameter in setoptions) is recommended with a single
764 facet.
766 For spectral imaging {tt defineimage} and {tt selectvis} defines the
767 spectral channels that are imaged. Examples are given in the selectvis section.
768 The parameter {tt restfreq} can be used to define what rest frequency
769 to use in the resulting images. If none is specified imager will try
770 to use the one that is defined in the ms. It will use the first one
771 defined in the first spectral window selected.
773 For wide-field or 3D imaging see setoptions
774 section for some examples.
776 If the telescope is observing moving source (e.g planet or moon) over
777 a period of time. One may wish to image in a frame where the source is
778 fixed. The parameter {tt movingsource} is for that. Setting it to a
779 source that {tt measures} is aware of will force the imaging to
780 realign (shift in SD imaging or phase rotation in interferometry
781 imaging) the data so that the source appears fixed in the
782 image. Obviously in doing so the background sources will be
783 blurred. The coordinate system used to fix the source on is the one where
784 the source is at the first time observed in the selected data.
786 Input Parameters:
787 nx Total number of spatial pixels in x
788 ny Total number of spatial pixels in y
789 cellx Cellsize in x (e.g. '1arcsec')
790 celly Cellsize in y (e.g. '1arcsec')
791 stokes Stokes parameters to image (e.g. 'IQUV')
792 phasecenter Direction of phase center as a diretion measure or a field id
793 mode Type of processing (velocity =radiovelocity)
794 nchan Number of channels; a -1 (default) means all the channels as selected in selectvis and combined into one continuum channel
795 start Start channel; A 0-relative channel number of the spwid or a frequency quantity or a velocity quantity or radial velocity measure
796 step Step in channel; integer for number of channels or frequency quantity or velocity quantity or radial velocity measure
797 spw Spectral Window Id (0 relative) that defines center of image
798 restfreq rest frequency to use; default =& use the one available in ms
799 outframe frequency frame of output image (default LSRK, '' => as input ms or LSRK in case of multiple ms's), options are LSRK, LSRD, BARY, GALACTO, LGROUP, CMB
800 veltype velocity definition ('radio' or 'optical' or 'relativistic')
801 facets Number of facets on each axis
802 movingsource Name of moving source, e.g planet or moon, to keep fixed in image
803 distance Distance to object: usually ignore this! (m)
804 projection map projection type
806 Example:
808 ## Example 1
809 im.defineimage(nx=1024,ny=1024, cellx='30marcsec',celly='30marcsec',
810 nchan=1, stokes='IV', phasecenter=me.direction('mars'));
811 ## Example 2
812 im.defineimage(nx=1024,ny=1024, cellx='30marcsec',celly='30marcsec',
813 nchan=1, stokes='IV', phasecenter=['J2000', '19:00:30.5', '-45d00m25.6']);
814 ## Example 3
815 im.selectvis(nchan=10, start=3, spw=[0,1], field=[3, 4, 5, 6, 7, 9, 10])
816 im.defineimage(nx=500, ny=500, mode='mfs', spwid=[0,1], fieldid=7)
817 im.clean(algorithm='mfclark', niter=1000, model='mosaic.model', image='mosaic.image')
819 ## Example 4
821 dir1=me.direction('J2000', '20h00m00', '21d00m00')
822 dir2=me.direction('J2000', '20h10m00', '21d00m00')
823 dir3=me.direction('J2000', '20h00m00', '21d03m00')
824 im.defineimage(nx=100, cellx='0.1arcsec', phasecenter=dir1)
825 im.make('box1')
826 im.defineimage(nx=100, cellx='0.1arcsec', phasecenter=dir2)
827 im.make('box2')
828 im.defineimage(nx=100, cellx='0.1arcsec', celly='0.1arsec', phasecenter=dir3)
829 im.make('box3')
830 im.clean(algorithm='mfclark', model=['box1', 'box2', 'box3'],
831 image=['box1.restored', 'box2.restored', 'box3.restored'],
832 residual=['box1.residual', 'box2.residual', 'box3.residual'])
836 In the first example, the image parameters are set for 1024 by 1024
837 pixels of 30milli arcsec, 1 channel will be made, Stokes I and V will be
838 imaged, and the phasecenter will be the direction of Mars as given by
839 the JPL DE-200 emphemeris. In the second, the phase center is taken
840 to be an absolute coordinate value.
842 The third example shows the use of selectvis and defineimage to setup a mosaic. In
843 the set data we have chosen 10 channels (for each spectral window) of data starting form
844 channel 3. We also have selected spectral windows 0 and 1. We have selected data from
845 fields 3 to 10. In the defineimage we decide to use the data to make a
846 multifrequency synthesis image. We center the image on the field 7 pointing.
848 The fourth example is use to clean regions where the user knows the
849 sources are and ignore all the other regions. This is very efficient
850 in large fields with few sources. Smaller outlier images are made and
851 deconvolved around known sources rather than making a big image
852 englobing all three fields.
855 Now here are some examples about defining cubes using different {tt mode}
856 parameters.
859 defining channels cubes use the channel as defined in the data
861 im.defineimage(cellx=1000, mode='channel', nchan=100, start=10,
862 step=1, spwid=range(0,10))
865 now using frequency and overiding the rest frequency defined in
866 the ms or if its not defined in the ms
868 im.defineimage(cellx=1000, mode='frequency', nchan=100, start='1GHz',
869 step='10kHz', restfrequency='1.421GHz')
872 in case you have a frame with the frequency
874 im.defineimage(cellx=1000, mode='frequency', nchan=100, start=['LSRK',
875 '1GHz'], step='10kHz', restfrequency='1.421GHz')
878 OR using measures
880 freqstart=me.frequency('LSRK', '1GHz')
881 im.defineimage(cellx=1000, mode='frequency', nchan=100,
882 start=freqstart, step='10kHz', restfrequency='1.421GHz')
885 similarly if you want to use velocity to define your cube
887 im.defineimage(cellx=1000, mode='velocity', nchan=100, start=['LSRK',
888 '10km/s'], step='1m/s', restfrequency='1.421GHz')
889 OR using measures
890 velstart=me.radialvelocity('LSRK', '10km/s')
891 im.defineimage(cellx=1000, mode='velocity', nchan=100, start=velstart,
892 step='1m/s')
895 Change mode to 'opticalvelocity' if your velocity values are using optical definition
897 --------------------------------------------------------------------------------
899 """
900 return _imager.imager_defineimage(self, *args, **kwargs)
903 def done(self):
904 """
905 done(self) -> bool
909 Summary:
910 Terminate the imager process
912 Description:
915 This is used to totally stop the {tt imager} process. It is a good idea
916 to conserve memory use on your machine by stopping the process once
917 you no longer need it.
919 Example:
921 im.open('3C273XC1.MS')
922 im.makeimage(image='3C273XC1.dirty',type='corrected')
923 im.done()
925 --------------------------------------------------------------------------------
927 """
928 return _imager.imager_done(self)
931 def drawmask(self, *args, **kwargs):
932 """
933 drawmask(self, _image, _mask, _niter, _npercycle, _threshold) -> record *
937 Summary:
938 Allows you do draw mask using the viewer
940 Description:
943 A mask image is an image with the same shape as the other images but
944 with values between 0.0 and 1.0 as a pixel value. Mask images are used in
945 imager to control the region selected in a deconvolution.
947 drawmask is used to interactively draw regions over a template image which you want to allow deconvolution to occur.
949 Input Parameters:
950 image name of template image
951 mask name of image to save mask in
952 niter Total number of iteration to display in box; just for display or python packaging
953 npercycle npercycle value to display in box; just for display or python packaging
954 threshold threshold to display in box ; just for display or python packaging
956 Example:
958 im.drawmask(image='mytemplate.image', mask='myregions.mask')
959 im.clean(mask='myregions.mask', model='3C273XC1.clean.masked', niter=1000)
963 Make mask image by drawing interactively over a given image 'mytemplate.image', then image and clean the visibilties using it as the
964 'clean regions'.
966 --------------------------------------------------------------------------------
968 """
969 return _imager.imager_drawmask(self, *args, **kwargs)
972 def exprmask(self, *args, **kwargs):
973 """
974 exprmask(self, _mask, _expr) -> bool
978 Summary:
979 Construct a mask image from a LEL expression
981 Description:
984 A mask image is an image with the same shape as the other images but
985 with values between 0.0 and 1.0 as a pixel value. Mask images are used in
986 imager to control the region selected in a deconvolution.
988 In the Clark CLEAN, the mask image can usefully have any value between
989 0.0 and 1.0. Intermediate value discourage but do not rule out
990 selection of clean components in that region. This is accomplished by
991 multiplying the residual image by the mask prior to entering the minor
992 cycle. Note that if you do use a mask for the Clark or Hogbom Clean,
993 it must cover only a quarter of the image. boxmask does not enforce
994 this requirement.
996 This function allows Lattice Express Language (LEL) expressions to
997 be used in defining a mask. See the documentation on
998 imagecalc for more details.
1000 Input Parameters:
1001 mask name of mask image
1002 expr Value to set the mask to. Any scalar or LEL expression
1004 Example:
1006 im.exprmask(mask='bigmask', expr='3C273XC1.clean>0.5')
1007 im.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
1010 Makes the image bigmask, and then sets it to unity for all points in
1011 the region where 3C273XC1.clean is greater than 0.5Jy.
1012 Then cleans using it as the mask.
1014 --------------------------------------------------------------------------------
1016 """
1017 return _imager.imager_exprmask(self, *args, **kwargs)
1020 def feather(self, *args, **kwargs):
1021 """
1022 feather(self, _image, _highres, _lowres, _lowpsf, _effdishdiam, _lowpassfiltersd) -> bool
1026 Summary:
1027 Feather together an interferometer and a single dish image in the Fourier plane
1029 Description:
1032 Basically the 'imerg' algorithm of AIPS and SDE, or the 'feather'
1033 algorithm of MIRIAD, we regrid the total power (or low resolution)
1034 image onto the interferometer (or high resolution) image, Fourier
1035 transform both the interferometer and single dish images, down weight
1036 the Fourier transform of the interferometer image by 1.0 - FT(low res psf),
1037 add the weighted interferometer Fourier plane to the single dish Fourier
1038 plane, and transform back into the image plane.
1040 The tapering is by the transform of a point spread function. If lowpsf
1041 is specified, that image is used, otherwise the appropriate telescope
1042 beam is used. The point spread function for a single dish image may be
1043 calculated using makeimage.
1045 {tt Advice:} Note that if you are feathering large images, you'd be advised to have
1046 the number of pixels along the X and Y axes to be composite numbers
1047 and definitely not prime numbers. In general FFTs work much faster on even
1048 and composite numbers. You may use subimage function of image
1049 tool to trim the number of pixels to something desirable.
1051 Input Parameters:
1052 image Name of output feathered image
1053 highres Name of high resolution (interferometer) image
1054 lowres Name of low resolution (single dish) image
1055 lowpsf Name of optional low resolution point spread function
1056 effdishdiam Optional new SD dish diameter in m to use in feathering; can be smaller than true dish size
1057 lowpassfiltersd Reject the high spatial frequency of the SD image
1059 Example:
1061 im.setvp(dovp=True, usedefaultvp=True)
1062 im.feather(image='feathered.image', highres='casa.vlaonly',
1063 lowres='casa.sd');
1065 In the above example its using the default beams and the observatory
1066 information is in the image header.
1068 But if you have a single dish image with a beam which is not defined
1069 in the casa database then the example below is a guide of how to do
1070 that, say you know the beam of the single dish as a gaussian.
1074 #create a beam pattern table using vpmanager
1075 include 'vpmanager.g'
1076 vpman=vpmanager();
1077 vpman.setpbgauss(telescope='OTHER', othertelescope='BONN',
1078 halfwidth='1arcmin', maxrad='20arcmin', reffreq='1.4GHz');
1079 vpman.saveastable('bonn.pb')
1080 vpman.done()
1082 ##....would have done your usual imager setup (defineimage etc) then before feathering
1083 im.setvp(dovp=True, usedefaultvp=false, vptable='bonn.pb')
1084 im.feather(image='feathered.image', highres='casa.vlaonly',
1085 lowres='casa.sd');
1087 ###
1089 --------------------------------------------------------------------------------
1091 """
1092 return _imager.imager_feather(self, *args, **kwargs)
1095 def filter(self, *args, **kwargs):
1096 """
1097 filter(self, _type, _bmaj, _bmin, _bpa) -> bool
1101 Summary:
1102 Apply additional weighting by filtering (u-v taper)
1104 Description:
1107 Apply visibility tapering to emphasize certain scale structures. The
1108 imaging tapers are applied to a Table column called IMAGING_WEIGHT,
1109 which may be plotted using
1110 tb and pl.
1111 plotweights.
1112 In addition, this column
1113 may be accessed directly using either the table
1114 or ms modules. Note that the taper is multiplicative and
1115 so the weights must be calculated first using
1116 weight. The points are not flagged!
1118 Note that the scale size to be emphasized is given in the image plane
1119 as the parameters of the corresponding Gaussian. Note also use of this
1120 function provides an optimum detection for the given scale size, which
1121 is not the same as requiring that the resulting dirty beam have the
1122 specified Gaussian fit. The resultant fitted beam size will {em very
1123 roughly} be the quadratic sum of the original beam and the specified
1124 beam. If you wish to obtain a specified beam, then the best approach
1125 is to perform this calculation and check the value obtained using
1126 imager.fitpsf.
1128 Input Parameters:
1129 type Type of filtering or u-v tapering
1130 bmaj Major axis of filter
1131 bmin Minor axis of filter
1132 bpa Position angle of filter
1134 Example:
1136 im.weight('uniform')
1137 im.filter(type='gaussian', bmaj='2.3arcsec', bmin='1.67arcsec',
1138 bpa='-34.5deg')
1140 --------------------------------------------------------------------------------
1142 """
1143 return _imager.imager_filter(self, *args, **kwargs)
1146 def fitpsf(self, *args, **kwargs):
1147 """
1148 fitpsf(self, _psf, _bmaj, _bmin, _bpa) -> bool
1152 Summary:
1153 Fit the point spread function, making psf image first if needed
1155 Description:
1158 This fits an elliptical Gaussian to the point spread function
1159 and returns the fitted beam parameters. If psf image is not specified
1160 then a psf is made and used. The values for the beam fit
1161 are saved internally and used whenever needed (for example in the functions restore or smooth) until invalidated. The values
1162 are invalidated by selectvis, defineimage or any tool function that changes
1163 the weights. Use the function summary to check if there is a valid fitted psf stored internally.
1166 Input Parameters:
1167 psf Name of input psf
1169 Output Parameters:
1170 bmaj Major axis of beam
1171 bmin Minor axis of beam
1172 bpa Position angle of beam
1174 Example:
1176 im.makeimage(type='psf', image='3C273XC1.psf')
1177 params=im.fitpsf('3C273XC1.psf')
1178 #This returns a python dict params here
1179 print params['bmaj'].value, params['bmin'].value, params['bpa']
1180 im.restore(model='bla' , complist='', image='bla.restored' , residual='bla2.residual' )
1183 Or if one wants to generate a psf from the uv coverage and use that subsequently as in the following example:
1186 - im.fitpsf(psf='')
1187 - im.restore(model='bla' , complist='', image='bla.restored' , residual='bla2.residual' )
1189 --------------------------------------------------------------------------------
1191 """
1192 return _imager.imager_fitpsf(self, *args, **kwargs)
1195 def fixvis(self, *args, **kwargs):
1196 """
1197 fixvis(self, _fields, _phasedirs, _refcode, _distances, _datacolumn) -> bool
1201 Summary:
1202 Performs visibility adjustments.
1204 Description:
1207 Corrects UVW coordinates and optionally the visibilities for various
1208 effects that can be calculated without fitting a model to the data.
1210 The effects include:
1211 begin{itemize}
1212 item changing the phase tracking center(s),
1213 item correcting for differential aberration, (Not yet implemented)
1214 item changing the equinox (i.e. B1950_VLA to J2000 or APP, etc.) of the UVW coordinates,
1215 item changing the projection, as in (-)NCP to SIN. (Not yet implemented),
1216 item refocusing.
1217 end{itemize}
1220 Input Parameters:
1221 fields Field IDs (numbered relative to 0) to operate on. Blank = all.
1222 phasedirs Phase tracking centers for each field in fields, in the same order.
1223 refcode Reference frame to use for the generated UVWs. WARNING: clean and the im tool ignore the reference frame claimed by the UVW column (it is often mislabelled as ITRF when it is really J2000) and instead assume the (u, v, w)s are in the same frame as the phase tracking center. calcuvw does not yet force the UVW column and field centers to use the same reference frame! Blank = use the phase tracking frame of vis.
1224 distances A list of distances (in m) for the fields listed in fields. 0 = infinity.
1225 datacolumn Which of DATA, MODEL_DATA, and/or CORRECTED_DATA to operate on. Default: 'all'.
1227 Example:
1229 im.open('3C273XC1.MS')
1230 im.fixvis()
1231 im.done()
1233 --------------------------------------------------------------------------------
1235 """
1236 return _imager.imager_fixvis(self, *args, **kwargs)
1239 def ft(self, *args, **kwargs):
1240 """
1241 ft(self, _model, _complist, _incremental, _phasecentertime) -> bool
1245 Summary:
1246 Fourier transform the specified model and componentlist
1248 Description:
1251 Fourier transform the specified model (and optionally componentlist)
1252 and insert into the MODEL_DATA column. The current contents of
1253 the MODEL_DATA column are replaced unless incremental is set to
1254 T (in which case the results are added to the column).
1255 phasecentertime is optional useful for field which is have time varying phasecenters (polynomials or ephemerides phasecenters). The default is to calculate the phasecenter at each time in the data but the time provided here can be used to calculate phasecenters.
1256 If the function setvp is run prior to running ft with a componentlist, then the spectral variation of each component in the componentlist will include the multiplicative term of the beam value for each channel frequency. So a flat spectrum component will show the frequency variation of the beam in the predicted visibilities..
1258 Input Parameters:
1259 model Name of image
1260 complist Name of component list
1261 incremental Add to the existing MODEL_DATA column?
1262 phasecentertime Time to use for time varying phasecenters
1264 Example:
1266 im.ft(model='3C273XC1.nnls.model')
1267 im.ft(model='3C273XC1.another.model', incremental=True)
1270 Fourier transforms the model in the image 3C273XC1.nnls.model
1271 and then adds the visibility due to 3C273XC1.another.model
1273 --------------------------------------------------------------------------------
1275 """
1276 return _imager.imager_ft(self, *args, **kwargs)
1279 def getweightgrid(self, *args, **kwargs):
1280 """
1281 getweightgrid(self, _type, _wgtimages) -> variant *
1285 Summary:
1286 get the requested weight grids
1288 Description:
1292 This is a utility function when running multi imager processes in parallel on subsection of an ms/data independently
1293 One would wish to weight the dirty image before averaging or set the imaging weight density (when using unform or
1294 Brigg's style weighting) to account for all the data being used. This is {bf NOT} for the general user but for people who
1295 are parallelizing at the scripting level.
1297 {bf imaging}: will return a the weight griddensity
1299 {bf ftweight}: will put the FT-machine weight images in the names given in wgtimage parameters..these may be needed to average residual images from different processes running seperately on different section of the data.
1301 Input Parameters:
1302 type Type of weight requested (imaging, ftweight)
1303 wgtimages names of weightimages to save
1305 Example:
1307 wght=im.getweightgrid('imaging')
1308 wght2=im2.getweightgrid('imaging')
1309 wght=wght+wght2
1311 im.setweightgrid(weight=wght, type='imaging')
1313 --------------------------------------------------------------------------------
1315 """
1316 return _imager.imager_getweightgrid(self, *args, **kwargs)
1319 def linearmosaic(self, *args, **kwargs):
1320 """
1321 linearmosaic(self, _images, _mosaic, _fluxscale, _sensitivity, _fieldids, _usedefaultvp, _vptable) -> bool
1325 Summary:
1326 Make a linear mosaic of several images
1328 Description:
1331 Make a linear mosaic of several images.
1332 Currently, the pointing center is not specified in the image, so
1333 we specify the pointing center in terms of the row numbers of the FIELD subtable.
1335 Input Parameters:
1336 images Input images to be mosaiced
1337 mosaic Output mosaic image
1338 fluxscale Fluxscale image
1339 sensitivity Sensitivity image
1340 fieldids List of field ids that correspond each of the images,used to center the PB of each image. (0-based list)
1341 usedefaultvp Use the default vp type?
1342 vptable Voltage pattern table from the vpmanager for detailed specification
1344 Example:
1346 im.linearmosaic(images=['orion.1.cln', 'orion.2.cln', 'orion.4.cln'], mosaic='orion.linmos',
1347 fluxscale='orion.linmos.fluxscale', fieldid=[1,2,4]);
1349 --------------------------------------------------------------------------------
1351 """
1352 return _imager.imager_linearmosaic(self, *args, **kwargs)
1355 def make(self, *args, **kwargs):
1356 """
1357 make(self, _image) -> bool
1361 Summary:
1362 Make an empty (i.e. blank) image
1364 Description:
1367 Make an empty image using the current image parameters. Often this is
1368 unnecessary, but you will typically need to use this if you wish to
1369 deconvolve a set of images. The steps are to make the empty images
1370 that you require to be deconvolved, and then pass them into clean as a
1371 vector of strings.
1373 Input Parameters:
1374 image name of output image
1376 Example:
1378 im.defineimage(nx=1024,ny=1024, cellx='30marcsec',celly='30marcsec',
1379 nchan=1, stokes='IV', phasecenter=me.direction('mars'));
1380 im.make('mars.moving');
1381 im.defineimage(nx=1024,ny=1024, cellx='30marcsec',celly='30marcsec',
1382 nchan=1, stokes='IV',
1383 phasecenter=me.direction('J2000', '12:23:48.7', '-15:56:32.9')
1384 im.make('mars.fixed');
1385 im.clean(algorithm='mf', model=['mars.moving', 'mars.fixed'],
1386 image=['mars.moving.restored', 'mars.fixed.restored'])
1389 This makes two empty images, one moving with mars and one fixed
1390 in J2000, and then deconvolves the two jointly using clean.
1391 Finally the images are restored.
1393 --------------------------------------------------------------------------------
1395 """
1396 return _imager.imager_make(self, *args, **kwargs)
1399 def predictcomp(self, *args, **kwargs):
1400 """
1401 predictcomp(self, _objname, _standard, _epoch, _freqs, _pfx) -> string
1405 Summary:
1406 Make a component list for a known object
1408 Description:
1411 Make a component list for an object recognized by standard, one of setjy's
1412 flux density standards.
1414 Input Parameters:
1415 objname Name of the object
1416 standard Name of the flux standard
1417 epoch Time to use, as an epoch measure, e.g. me.epoch('UTC', '55555d'), for Solar System objects
1418 freqs The frequencies to use, in Hz
1419 pfx Prefix for the name of the component list
1421 Example:
1423 clname = im.predictcomp('Ceres', 'Butler-JPL-Horizons 2010',
1424 '2012-02-14/13:33:00', [3.45e11, 6.90e11], 'vd_')
1426 This writes a component 'list' named vd_spw0_Ceres_345GHz55971.6d.cl to disk
1427 containing a uniform disk component for Ceres as it is expected to appear at
1428 345 and 690 GHz at 2012-02-14/13:33:00 UTC, and returns the name of the
1429 component list. Returns '' on error.
1431 --------------------------------------------------------------------------------
1433 """
1434 return _imager.imager_predictcomp(self, *args, **kwargs)
1437 def makeimage(self, *args, **kwargs):
1438 """
1439 makeimage(self, _type, _image, _compleximage, _verbose) -> bool
1443 Summary:
1444 Calculate images by gridding, etc.
1446 Description:
1449 This tool function actually does gridding (and Fourier inversion if
1450 needed) of visibility data to make an image. It allows calculation of
1451 various types of image:
1452 begin{description}
1453 item[observed] Make the dirty image from the DATA column ({em default})
1454 item[model] Make the dirty image from the MODEL_DATA column
1455 item[corrected] Make the dirty image from the CORRECTED_DATA column
1456 item[residual] Make the dirty image from the difference of the
1457 CORRECTED_DATA and MODEL_DATA columns
1458 item[psf] Make the point spread function
1459 item[singledish] Make a single dish image
1460 item[coverage] Make a single dish coverage image
1461 item[holography] Make a complex holography image
1462 item[pb] Make the primary beam as defined by setvp
1463 end{description}
1465 Note the full {tt imager} equation is not used and so, for example, the
1466 primary beam correction is not performed. Use
1467 restore to get a residual image
1468 using the full {tt imager} equation where primary beam correction is
1469 performed.
1471 A position shift can be applied when specifying the image parameters
1472 with defineimage. If a shift is specified then
1473 the uvw coordinates are reprojected prior to gridding, and a phase
1474 rotation is applied. If the image is a PSF then no phase shift is
1475 applied but the uvw are recomputed. To see the effects of the uvw
1476 reprojected, you can use the
1477 plotuv function.
1479 If desired, the full complex image (before conversion to stokes
1480 I,Q,U,V) may be retained. Note that the image
1481 tool cannot load a complex image directly. Instead, use the
1482 imagecalc constructor
1483 to take {em e.g.} the real and imaginary parts of the image.
1485 For making single dish and holography images, the data are convolved onto the
1486 grid using a one of a number of options:
1487 begin{description}
1488 item[gridfunction='SF'] Circularly symmetric prolate spheroidal wavefunction.
1489 This is always the same function in pixels. To get this to match to
1490 the antenna primary beam, the optimum cellsize to use in constructing
1491 the image is the antenna primary beam half-width-half-maximum times
1492 1.20192.
1493 item[gridfunction='BOX'] Nearest neighbor gridding.
1494 item[gridfunction='PB'] The telescope primary beam is used as the
1495 convolution function. This function is the same in arcseconds,
1496 independent of the cellsize. This choice is optimum in the least
1497 squares sense. To override the default choice of telescope primary beam
1498 for a given telescope, use the function
1499 setvp. Usually the default will be acceptable.
1500 end{description}
1502 To make a reasonable approximation to the sky, one should divide
1503 the type='singledish' image by the type='coverage' image, thresholding
1504 at some level. For example:
1506 begin{verbatim}
1508 ia.open('scanweight');
1509 ia.statistics(s);
1510 threshold = s.max / 10.0;
1511 #
1512 ia.imagecalc('sdimage',
1513 pixels=spaste('scanimage[scanweight>', threshold,
1514 ']/scanweight[scanweight>', threshold, ']'))
1515 ###ia.view(raster=True, axislabels=True);
1516 end{verbatim}
1518 Input Parameters:
1519 type Type of output image
1520 image Name of output image
1521 compleximage Name of output complex image
1522 verbose Report things like the center frequency to the logger
1524 Example:
1526 im.ft(model='3C273XC1.model', complist='3C273XC1.complist');
1527 im.makeimage(type='residual', image='3C273XC1.residual')
1528 im.makeimage(type='psf', image='3C273XC1.psf')
1531 Fill in the MODEL_DATA column from Fourier transforming the model and
1532 the componentlist. Make the residual image and write it to
1533 3C273XC1.residual.
1536 im.setvp(dovp=T, usedefaultvp=T, telescope='GBT');
1537 im.makeimage(type='pb', image='gbt.pb')
1541 In the above we may want to see what the primary beam we are using
1542 look like. May also be useful to deconvolve single dish images in the
1543 deconvolver tool.
1545 --------------------------------------------------------------------------------
1547 """
1548 return _imager.imager_makeimage(self, *args, **kwargs)
1551 def makemodelfromsd(self, *args, **kwargs):
1552 """
1553 makemodelfromsd(self, _sdimage, _modelimage, _sdpsf, _maskimage) -> bool
1557 Summary:
1558 Make an initial model image from a Single Dish image
1560 Description:
1563 This functions use an image from a single dish and make a model
1564 (clean component) image out of it. This allows one to use this as the
1565 starting model in a deconvoltion function e.g
1566 clean or mem
1567 This provides an alternative to
1568 feather.
1569 The difference between the two is that in {tt feather} the
1570 interferometer image is deconvolved first and the single dish image is
1571 put in at the end. Whereas if one starts with a model from the single
1572 dish image it will give a different starting point for the deconvolving
1573 algorithm to interpolate the missing short baseline.
1575 The function setsdoptions may be used to set
1576 a factor by which to scale the SD image, if necessary.
1578 The {tt sdpsf} parameter (optional) should be used if an external PSF image of the
1579 single dish is needed to calculate the beam parameters of the primary
1580 beam of the dish. This is usually needed if the dish image is from a
1581 non standard telescope or the beam is not in the {tt CASA} system.
1583 The {tt mask} is a mask image that may be needed to be used for
1584 clean. This is usually the case when the dish image does not fully
1585 cover the field defined by defineimage.
1587 Input Parameters:
1588 sdimage Single Dish image
1589 modelimage Name of output image to be used as model
1590 sdpsf PSF of Single Dish if needed
1591 maskimage mask image
1593 Example:
1595 im.open('orion_only.ms')
1596 im.selectvis(field=range(10), spw=range(2))
1597 im.defineimage(nx=1000, cellx='1arcsec', , phasecenter=4, spwid=[0,1])
1598 im.setvp(dovp=T)
1599 im.setoptions(ftmachine='mosaic')
1600 im.setscales(nscales=3)
1601 im.setsdoptions(scale=0.9);
1602 im.makemodelfromsd(sdimage='orion_gbt.im', modelimage='orion_model', maskimage='orion.mask')
1603 im.clean(algorithm='mfmultiscale', model='orion_model',
1604 residual='orion.residual', image='orion.restored', gain=0.2, niter=500, mask='orion.mask')
1607 In the above example we are making a mosaic with the fields 0 to 9. A
1608 single dish image {tt orion_gbt.im} is used scaled down by a factor 0.9 to
1609 make the initial model that is passed to multi-scale clean.
1611 --------------------------------------------------------------------------------
1613 """
1614 return _imager.imager_makemodelfromsd(self, *args, **kwargs)
1617 def mask(self, *args, **kwargs):
1618 """
1619 mask(self, _image, _mask, _threshold) -> bool
1623 Summary:
1624 Construct a mask image by thresholding an image
1626 Description:
1629 A mask image is an image with the same shape as the other images but
1630 with values between 0.0 and 1.0 as a pixel value. Mask images are used
1631 in {tt imager} to control the region selected in a deconvolution.
1632 One makes a mask image by clipping the I part of the restored image
1633 (this function) or via the boxmask,
1634 regionmask, and
1635 exprmask functions. In this
1636 function, all points greater than the threshold are set to unity. The
1637 mask is the same in I,Q,U, and V. Note that
1638 exprmask is the most powerful
1639 method for making mask images.
1641 In the Clark CLEAN, the mask image can usefully have any value between
1642 0.0 and 1.0. Intermediate value discourage but do not rule out
1643 selection of clean components in that region. This is accomplished by
1644 multiplying the residual image by the mask prior to entering the minor
1645 cycle.
1647 Note that if you do use a mask for the Clark or Hogbom Clean, it must
1648 cover only a quarter of the image. It is particularly important to
1649 check this when creating an image using a threshold. If it extends
1650 further, the easiest fix is to use
1651 getchunk and
1652 getchunk to set parts of it to zero.
1654 Input Parameters:
1655 image name of template image
1656 mask name of mask image
1657 threshold threshold for mask
1659 Example:
1661 im.mask( image='bigimage', mask='bigmask',threshold='0.07Jy')
1662 im.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
1665 Makes the image bigmask, and then sets it to unity
1666 for all points where the Stokes I in bigimage is
1667 greater than 0.07. Then clean using it as the mask.
1669 --------------------------------------------------------------------------------
1671 """
1672 return _imager.imager_mask(self, *args, **kwargs)
1675 def mem(self, *args, **kwargs):
1676 """
1677 mem(self, _algorithm, _niter, _sigma, _targetflux, _constrainflux, _displayprogress, _model, _keepfixed, _complist, _prior, _mask, _image, _residual) -> bool
1681 Summary:
1682 Calculate a deconvolved image with selected mem (maximum entropy) algorithm
1684 Description:
1687 Makes a mem image using either the Cornwell-Evans maximum entropy or
1688 maximum emptiness algorithms, using the single field or multi-field
1689 contexts. The maximum entropy algorithm is the default. The mem is performed
1690 on the residual image calculated from the visibility data currently
1691 selected. Hence the first step performed in mem is to transform the
1692 current model or models (optionally including a componentlist) to fill
1693 in the MODEL_DATA column, and then inverse transform the residual
1694 visibilities to get a residual image. This residual image is then
1695 deconvolved using the corresponding point spread function. This means that
1696 the initial model is used as the starting point for the
1697 deconvolution. Thus if you want to restart a mem, simply set the
1698 model to the model that was previously produced by clean.
1700 Mask images are used to constrain the region that is to be
1701 deconvolved. To make mask images, use either
1702 boxmask (to define a mask via the
1703 corner locations blc and trc) or mask (to
1704 define a mask via thresholding an existing image). The default mask is
1705 the inner quarter of the image.
1707 The MEM deconvolution only operates on one Stokes parameter at a time.
1708 Joint MEM deconvolution for multiple Stokes parameters will be
1709 implemented in the future.
1711 Some reference regarding MEM :
1712 Cornwell and Evans,
1713 Astronomy and Astrophysics (ISSN 0004-6361), vol. 143, no. 1, Feb. 1985,
1714 p. 77-83.
1716 Narayan and Nityananda,
1717 Annual review of astronomy and astrophysics. Volume 24 (A87-26730
1718 10-90). Palo Alto, CA, Annual Reviews, Inc., 1986, p. 127-170.
1720 The mem algorithms possible are:
1721 begin{description}
1722 item[Cornwell-Evans Maximum Entropy (entropy)] The classic 'vm' or 'vtess'
1723 deconvolution algorithm.
1724 item[Cornwell-Evans Maximum Emptiness (emptiness)] The historic, but
1725 largely undocumented, modification to the Cornwell-Evans algorithm
1726 which seeks a model image which is consistent with the data and
1727 simultaneously minimizes the number of pixels with no emission
1728 (meaning 'with pixel values below the noise level').
1729 item[Multi-field Maximum Entropy (mfentropy)] Deconvolution is split
1730 into minor and major cycles. For each field, the MEM analog of a Clark
1731 Clean minor cycle is performed. In the major cycle, the emission thus
1732 modelled is subtracted either from the original visibilities (for
1733 multiple fields) or using a convolution (for only one field). The
1734 latter is much faster.
1735 item[Multi-field Maximum Emptiness (mfemptiness)] Just like {tt mfentropy},
1736 but with emptiness.
1737 end{description}
1739 The multi-field mem ({tt mfentropy} or {tt mfemptiness}) should be
1740 used if either of two conditions hold:
1741 begin{enumerate}
1742 item Multiple fields are to be deconvolved simultaneously {bf OR}
1743 item Primary beam correction is enabled. In this case, a
1744 mosaiced mem is performed.
1745 end{enumerate}
1747 Note that for the single pointing algorithms, only a quarter of the
1748 image may be deconvolved. If no mask is set, then the deconvolved
1749 region defaults to the inner quarter. If a mask larger than a quarter
1750 of the image is set, then only the quarter starting at the bottom left
1751 corner is used. However, for the multi-field imaging, the entire
1752 field may be imaged because the major cycles either do an exact
1753 subtraction from the visibilities or because PSF extent is more than
1754 twice the extent of the primary beam support.
1756 Before {tt mem} can be run, you must run {tt selectvis} and {tt defineimage}.
1757 Before {tt mem} can be run with a multi-field algorithm, you should run
1758 {tt setvp}. You may want to run {tt setmfcontrol} before running {tt mem}
1759 with a multi-field algorithm, though the default control values
1760 may be acceptable.
1762 Input Parameters:
1763 algorithm Algorithm to use
1764 niter Number of Iterations
1765 sigma Image sigma to try to achieve
1766 targetflux Target flux for final image
1767 constrainflux Constrain image to match target flux? else targetflux used only to initialize model
1768 displayprogress Display the progress of the cleaning?
1769 model Names of model images
1770 keepfixed Keep model fixed
1771 complist Name of component list
1772 prior Names of mem prior images
1773 mask Names of mask images (0=>no emission, 1=>emission permitted
1774 image Names of restored images
1775 residual Names of residual images
1777 Example:
1779 im.mem(model='3C273XC1.mem.model',
1780 mask='3C283XC1.mask', niter=40, sigma='0.001Jy')
1782 --------------------------------------------------------------------------------
1784 """
1785 return _imager.imager_mem(self, *args, **kwargs)
1788 def nnls(self, *args, **kwargs):
1789 """
1790 nnls(self, _model, _keepfixed, _complist, _niter, _tolerance, _fluxmask, _datamask, _image, _residual) -> bool
1794 Summary:
1795 Calculate a deconvolved image using the NNLS algorithm
1797 Description:
1801 Solve for the model brightness using the Briggs' Non-Negative Least
1802 Squares algorithm. Since NNLS works only on the $I$ image, the $I$
1803 pixels in the current image is set to zero where the fluxmask is $> 0.0$,
1804 then NNLS is used to estimate the $I$-pixels for that region.
1805 The deconvolution is performed on the residual image calculated from
1806 the visibility data currently selected. Hence the first step performed
1807 in clean is to transform the current model to fill in the MODEL_DATA
1808 column, and then inverse transform the residual visibilities to get a
1809 residual image. This residual image is then deconvolved using the
1810 corresponding point spread function.
1812 Some other points to remember are that rather than explicit boxes,
1813 mask images are used to constrain the region that is to be
1814 deconvolved. For NNLS, there are two masks, the fluxmask specifying
1815 the region within which flux is allowed, and the datamask specifying
1816 the region of the dirty image to be used as constraints. Typically the
1817 datamask will be somewhat larger than the fluxmask. On a large
1818 machine, a practical limit to both will be about 5000-6000
1819 pixels. Hence NNLS is only useful for compact tools. (For more
1820 details, see the htmladdnormallink{Briggs thesis}{briggsURL}). To
1821 make mask images, use either boxmask (to
1822 define a mask via the corner locations blc and trc) or
1823 mask (to define a mask via
1824 thresholding an existing image).
1826 On the canonical aipspp machine with 64MBytes of physical memory,
1827 you should try to keep the product of the pixels in the fluxmask
1828 and the datamask below about 5-10 million. Otherwise the
1829 solution phase will swap badly.
1831 Input Parameters:
1832 model Name of image
1833 keepfixed Keep model fixed
1834 complist Name of component list
1835 niter Number of Iterations, set to zero for no NNLS
1836 tolerance Tolerance for solution
1837 fluxmask Name of mask for allowed flux
1838 datamask Name of mask for constraint pixels in dirty image
1839 image Names of restored images
1840 residual Names of restored images
1842 Example:
1844 im.nnls(image='3C273XC1.nnls.image', model='3C273XC1.nnls.model',
1845 fluxmask='3C283XC1.fluxmask', datamask='3C273XC1.datamask', niter=1000,
1846 tolerance=0.00001)
1848 --------------------------------------------------------------------------------
1850 """
1851 return _imager.imager_nnls(self, *args, **kwargs)
1854 def open(self, *args, **kwargs):
1855 """
1856 open(self, _thems, _compress, _usescratch) -> bool
1860 Summary:
1861 Open a new MeasurementSet, for processing, closing current MeasurementSet
1863 Description:
1866 Close the current MeasurementSet and open a new MeasurementSet
1867 instead. The current state of {tt imager} is retained, except for
1868 the data selection.
1870 Input Parameters:
1871 thems New MeasurementSet to be processed
1872 compress Compress calibration columns?
1873 usescratch If true: Imager will use corrected data column and make scratch columns of they donot exist
1875 --------------------------------------------------------------------------------
1877 """
1878 return _imager.imager_open(self, *args, **kwargs)
1881 def pb(self, *args, **kwargs):
1882 """
1883 pb(self, _inimage, _outimage, _incomps, _outcomps, _operation, _pointingcenter, _parangle, _pborvp) -> bool
1887 Summary:
1888 Applies or corrects for a primary beam
1890 Description:
1894 Multiply ({tt operation='apply'}) or divide ({tt operation='correct'})
1895 by the primary beam function. The primary beam can be applied to images and/or
1896 Componentlists.
1898 If {tt pointingcenter==false} then you must specify {tt inimage}
1899 and the pointing center is taken from its reference direction.
1900 Otherwise, {tt pointingcenter} must be a Direction measure.
1901 It cannot take on the value {tt True}.
1903 The applied primary beam function is deterimed as follows. If you used
1904 function Imager.setvp to set an external
1905 voltage pattern table, then this is where the applied primary beam will
1906 come from (regardless of whether you set {tt inimage} or not). If you
1907 did not run this function, then you must supply argument {tt inimage}.
1908 The telescope name embedded in its Coordinate System will be used to
1909 determine the primary beam function.
1911 Input Parameters:
1912 inimage Input image to apply beam to
1913 outimage Output image after beam is applied
1914 incomps Input Componentlist table name
1915 outcomps Output Componentlist table name
1916 operation Operation
1917 pointingcenter Pointing center for primary beam application: default N.Pole
1918 parangle Parallactic angle for calculation
1919 pborvp Primary Beam or Voltage Pattern
1921 Example:
1923 # make a flat image
1924 im.make('flat.image');
1925 ia.open('flat.image');
1926 arr=ia.getchunk();
1927 arr[0:len(arr), 0:len(arr[0])] = 1.0;
1928 ia.putchunk(arr);
1929 ia.done()
1930 arr = false;
1931 #
1932 # as we are using 'pointingcenter=F', it defaults to the image center
1933 im.pb(inimage='flat.image', outimage='pb.image', pointingcenter=F)
1935 --------------------------------------------------------------------------------
1937 """
1938 return _imager.imager_pb(self, *args, **kwargs)
1941 def plotsummary(self):
1942 """
1943 plotsummary(self) -> bool
1947 Summary:
1948 Plot a summary of field and spectral window ids
1950 Description:
1953 Performs a simple plot of the field and spectral window IDs
1954 versus time (after sorting).
1956 Example:
1958 m = fitstoms('3C273XC1.ms', '3C273XC1.fits'); m.close()
1959 im.open('3C273XC1.ms')
1960 im.plotsummary()
1962 --------------------------------------------------------------------------------
1964 """
1965 return _imager.imager_plotsummary(self)
1968 def plotuv(self, *args, **kwargs):
1969 """
1970 plotuv(self, _rotate) -> bool
1974 Summary:
1975 Plot the uv coverage
1977 Description:
1980 Performs a simple plot of the uv coverage of all selected data.
1982 Optionally, plotuv will rotate the uvw coordinates to the
1983 specified phase center (set via defineimage).
1985 Input Parameters:
1986 rotate Rotate uvw coordinates to specified phase center?
1988 Example:
1990 im.open('3C273XC1.ms')
1991 im.plotuv(false)
1993 --------------------------------------------------------------------------------
1995 """
1996 return _imager.imager_plotuv(self, *args, **kwargs)
1999 def plotvis(self, *args, **kwargs):
2000 """
2001 plotvis(self, _type, _increment) -> bool
2005 Summary:
2006 Plot the visibility amplitudes as a function of u-v radius (also, see visplot tool
2008 Description:
2011 Performs a simple plot of the visibility amplitudes of all selected data.
2013 Input Parameters:
2014 type Type of plot: can contain all, observed, corrected, model, residual
2015 increment Increment in points to plot
2017 Example:
2019 im.open('3C273XC1.ms')
2020 im.plotvis(increment=10)
2022 --------------------------------------------------------------------------------
2024 """
2025 return _imager.imager_plotvis(self, *args, **kwargs)
2028 def plotweights(self, *args, **kwargs):
2029 """
2030 plotweights(self, _gridded, _increment) -> bool
2034 Summary:
2035 Plot the visibility weights as a function of u-v radius
2037 Description:
2040 Performs a plot of the visibility weights of all selected data (stored in
2041 the IMAGING_WEIGHT column of the MeasurementSet).
2042 The plot can be of the gridded weights (type='gridded') or
2043 ungridded.
2047 Input Parameters:
2048 gridded Do gridded plot?
2049 increment Increment in points to plot
2051 Example:
2053 im.open('3C273XC1.ms')
2054 im.defineimage(cellx='0.7arcsec', celly='0.7arcsec')
2055 im.weight('briggs')
2056 im.plotweights(gridded=True,increment=10)
2058 --------------------------------------------------------------------------------
2060 """
2061 return _imager.imager_plotweights(self, *args, **kwargs)
2064 def regionmask(self, *args, **kwargs):
2065 """
2066 regionmask(self, _mask, _region, _boxes, _circles, _value) -> bool
2070 Summary:
2071 Construct a mask image from a region
2073 Description:
2076 A mask image is an image with the same shape as the other images but
2077 with values between 0.0 and 1.0 as a pixel value. Mask images are used in
2078 imager to control the region selected in a deconvolution.
2080 In the Clark CLEAN, the mask image can usefully have any value between
2081 0.0 and 1.0. Intermediate value is discouraged but do not rule out
2082 selection of clean components in that region. This is accomplished by
2083 multiplying the residual image by the mask prior to entering the minor
2084 cycle. Note that if you do use a mask for the Clark or Hogbom Clean,
2085 it must cover only a quarter of the image. {tt regionmask} does not enforce
2086 this requirement.
2088 The function regionmask also allows multiple regions to be used. A record of the regions can be made as in the example below.
2090 Regions can be made in many different ways using the
2091 regionmanager functions. An example
2092 using wbox function is given
2093 below. The default regionmanager tool 'rg' can be used for cases the user want to have flexibility in manipulating regions. The {tt region} parameter takes a record that comes from the regionmanager output.
2094 The parameter boxes allow the user to sent in a list of 4 elements numbers representing blc's and trc's
2096 If both the parameters, {tt regions} and {tt boxes} are used the a union is done with the two sets of region thus defined.
2102 Input Parameters:
2103 mask name of mask image
2104 region Region record usually from regionmanager
2105 boxes list of 4 elements lists e.g [[xblc1, yblc1, xtrc1, ytrc1], [[xblc2, yblc2, xtrc2, ytrc2]]
2106 circles list of 3 elements lists e.g [[rad0, xcen0, ycen0], [rad1,xcen1, ycen1], .....]
2107 value Value to set the mask to
2109 Example:
2111 Makes a mask then cleans using it.
2113 im.open('test.ms')
2114 im.selectvis(field=0, spw=0)
2115 im.defineimage(nx=400, cellx='0.001arcsec', phasecenter=0)
2116 a=[100.0, 100.0, 200, 200.0]
2117 b=[50, 50, 80, 80]
2118 im.regionmask(mask='bigmask', boxes=[a,b])
2119 im.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
2121 Another example using rg.wbox function:
2122 ia.open('dirty')
2123 cs = ia.coordsys()
2124 rg.setcoordinates(cs.record())
2125 r1 = dg.wbox(blc=['173pix', '347pix'], trc=['183pix', '370pix'])
2126 im.regionmask(mask='bigmask',region=r1)
2128 Or using a dict of regions:
2130 r2=rg.wbox(blc=['180pix', '344pix'], trc=['191pix', '369pix'])
2131 r3=rg.wbox(blc=['189pix', '341pix'], trc=['204pix', '364pix'])
2132 regs={'reg1'':r1, 'reg2':r2, 'reg3':r3}
2133 rec=rg.makeunion(regs)
2134 im.regionmask(mask='bigmask',region=rec)
2136 If quantities are to be used to define regions the following is a an example
2138 im.regionmask(mask='joetest',boxes=['15:23:32.902','+05.19.32.089','15:22:28.631','+05.28.52.474'])
2140 --------------------------------------------------------------------------------
2142 """
2143 return _imager.imager_regionmask(self, *args, **kwargs)
2146 def regiontoimagemask(self, *args, **kwargs):
2147 """
2148 regiontoimagemask(self, _mask, _region, _boxes, _circles, _value) -> bool
2152 Summary:
2153 union a mask image with various regions
2155 Description:
2160 This function is very similar to regionmask function
2161 except that the mask image has to be existant already and this is an
2162 independent helper function (i.e does not care about the state of the imager tool... e.g does not need imager to have an
2163 attached ms).
2169 Input Parameters:
2170 mask name of mask image
2171 region Region record usually from regionmanager
2172 boxes list of 4 elements lists e.g [[xblc1, yblc1, xtrc1, ytrc1], [[xblc2, yblc2, xtrc2, ytrc2]]
2173 circles list of 3 elements lists e.g [[rad0, xcen0, ycen0], [rad1,xcen1, ycen1], .....]
2174 value Value to set the mask to
2176 Example:
2178 Makes a mask then cleans using it.
2180 a=[100.0, 100.0, 200, 200.0]
2181 b=[50, 50, 80, 80]
2182 im.regiontoimagemask(mask='bigmask', boxes=[a,b])
2183 im.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
2185 Another example using rg.wbox function:
2186 ia.open('dirty')
2187 cs = ia.coordsys()
2188 rg.setcoordinates(cs.record())
2189 r1 = dg.wbox(blc=['173pix', '347pix'], trc=['183pix', '370pix'])
2190 im.regionmask(mask='bigmask',region=r1)
2192 Or using a dict of regions:
2194 r2=rg.wbox(blc=['180pix', '344pix'], trc=['191pix', '369pix'])
2195 r3=rg.wbox(blc=['189pix', '341pix'], trc=['204pix', '364pix'])
2196 regs={'reg1'':r1, 'reg2':r2, 'reg3':r3}
2197 rec=rg.makeunion(regs)
2198 im.regionmask(mask='bigmask',region=rec)
2200 If quantities are to be used to define regions the following is a an example
2202 im.regionmask(mask='joetest',boxes=['15:23:32.902','+05.19.32.089','15:22:28.631','+05.28.52.474'])
2204 --------------------------------------------------------------------------------
2206 """
2207 return _imager.imager_regiontoimagemask(self, *args, **kwargs)
2210 def residual(self, *args, **kwargs):
2211 """
2212 residual(self, _model, _complist, _image) -> bool
2216 Summary:
2217 Calculate the residual image with respect to current model and component list
2219 Description:
2222 Calculate the residuals corresponding to the model and
2223 componentlist. {em Note that the model visibilities are updated}.
2225 Input Parameters:
2226 model Names of input models
2227 complist Name of component list
2228 image Names of output residual images
2230 Example:
2232 - im.residual(model='3C273XC1.clean', complist='3C273XC1.cl',
2233 image='3C273XC1.clean.residual')
2235 --------------------------------------------------------------------------------
2237 """
2238 return _imager.imager_residual(self, *args, **kwargs)
2241 def restore(self, *args, **kwargs):
2242 """
2243 restore(self, _model, _complist, _image, _residual) -> bool
2247 Summary:
2248 Calculate the restored image with restored model, component list, and residuals
2250 Description:
2253 Restore the residuals to a smoothed version of the model. The model
2254 images are convolved with the specified Gaussian beam and then the
2255 residual images are added. {em Note that the model visibilities are
2256 updated and thus reflect the model and componentlist that was
2257 used.}. Use setbeam to set the beam
2258 parameters.
2260 Input Parameters:
2261 model Names of input model
2262 complist Name of component list
2263 image Names of output restored images
2264 residual Names of residual images
2266 Example:
2268 - im.setbeam(bmaj='2.0arcsec', bmin='2.0arcsec')
2269 - im.restore(model='3C273XC1.clean', image='3C273XC1.clean.restored',
2271 --------------------------------------------------------------------------------
2273 """
2274 return _imager.imager_restore(self, *args, **kwargs)
2277 def updateresidual(self, *args, **kwargs):
2278 """
2279 updateresidual(self, _model, _complist, _image, _residual) -> bool
2283 Summary:
2284 Calculate the residual and restored images with new modified model, component list,
2286 Description:
2289 This function is for efficiency and speed purpose only. Same as restore
2290 It is to be used after you have used clean or mem ...but you wish to tweak the model image, say by clipping unwanted components and it will avoid unnecessary recalculating of psf but will do a proper prediction of the new model visibilities and recalculate residual and restored images.
2292 Input Parameters:
2293 model Names of input model
2294 complist Name of component list
2295 image Names of output restored images
2296 residual Names of residual images
2298 Example:
2300 - im.setbeam(bmaj='2.0arcsec', bmin='2.0arcsec')
2301 - im.restore(model='3C273XC1.clean', image='3C273XC1.clean.restored',
2303 --------------------------------------------------------------------------------
2305 """
2306 return _imager.imager_updateresidual(self, *args, **kwargs)
2309 def sensitivity(self, *args, **kwargs):
2310 """
2311 sensitivity(self, _pointsource, _relative, _sumweights, _senrec) -> bool
2315 Summary:
2316 Calculate rms sensitivity
2318 Description:
2322 NB: The implementation in this function will be removed for CASA v4.5.
2323 We now recommend that the im.apparentsens() function be used instead
2324 of this one, especially if their weights are initialized and
2325 calibrated.
2327 Calculate the point source sensitivity for the selected data, both
2328 absolutely and relatively (to that for natural weighting).
2330 To do the calculation, we use the imaging weights (in the
2331 column called IMAGING_WEIGHT) as calculated from the WEIGHT column,
2332 and an estimate of the effective net bandwidth and integration time.
2333 The calculation therefore includes all the effects
2334 of weight and
2335 filter.
2337 The output is an array with mixed elements. Counting from zero, the
2338 second element (out[1]) is the net sensitivity, third element is the
2339 ratio of the reduction in sensitivity due to the chosen weighting
2340 scheme. This ratio is 1.0 for Natural weight and greater than one for
2341 all other weighting schemes. (NOTE: Further testing is required of
2342 this value and hence this is kept separate for now).
2344 The sensitivity calculations require Tsys and collecting area of
2345 the antenna. These quantities are not known from the MS. The
2346 sensitivity is therefore returned in units of Jy m^2/K. Multiplying the
2347 second elements with the ration of the Tsys and effective antenna
2348 collecting area will give the sensitivity in Jy/beam units.
2350 The fourth elements of the return value is a record with the following
2351 keys: 'nbaselines', 'effectiveintegration', 'effectivebandwidth',
2352 'sumwt' and 'spwid'. These can be used to get the number of baselines
2353 used, effective integration time (in sec), the effective bandwidth (in
2354 Hz), the sum of weights and the absolute spectral window IDs used.
2356 Output Parameters:
2357 pointsource Calculated point source sensitivity (Jy m^2 / (K beam))
2358 relative Calculated relative sensitivity
2359 sumweights Calculated sum of weights
2360 senrec Record per SPW per chan sensitivity calculations
2362 Example:
2364 a=im.sensitivity(false);
2365 print 'Sensitivity =', a[1];
2366 print 'Relative to Natural Weighting = ', a[2];
2368 --------------------------------------------------------------------------------
2370 """
2371 return _imager.imager_sensitivity(self, *args, **kwargs)
2374 def apparentsens(self, *args, **kwargs):
2375 """
2376 apparentsens(self, _pointsource, _relative) -> bool
2380 Summary:
2381 Calculate rms sensitivity directly from weights
2383 Description:
2387 This function calculates the point source sensitivity for the data
2388 selected by im.selectvis(...), and according to the imaging weighting
2389 parameters specified in im.weight(...) and im.defineimage(...). The
2390 calculation is performed solely using the weight information stored in
2391 the MS WEIGHT column (WEIGHT_SPECTRUM tbd), and as adjusted by the net
2392 imaging weighting function (natural, uniform, robust, taper, etc.).
2393 Therefore, it is assumed that the MS WEIGHTs have been properly
2394 initialized and calibrated along with the visibility data. As long as
2395 the WEIGHTs are in the inverse square units of the visibilities (i.e.,
2396 inverse variance weights), the calculation should yield the real
2397 theoretical imaging sensitivity for data at any stage of the
2398 calibration (though data at early and intermediate stages of
2399 calibration may not be sufficiently coherent for imaging at high--or
2400 even modest--fidelity).
2402 Two values are reported in the logger and returned (see example
2403 below). First, the apparent sensitivity (in the units implied by the
2404 WEIGHTs' units), for the specified imaging weighting scheme. Second,
2405 a unitless factor describing the ratio of the apparent sensitivity to
2406 that obtained with pure 'natural' weighting (the nominal peak
2407 sensitivity). When 'natural' weighting is selected, this ratio factor
2408 will be 1.0; all other weighting choices will yield an apparent
2409 sensitivity ratio greater than 1.0.
2411 Currently, this function reports only the continuum sensitivity for
2412 the selected data, and in particular, for the aggregate bandwidth
2413 indicated by the spectral window selection. The calculation further
2414 assumes that the visibility samples are each entirely independent
2415 (i.e., no redundant samples such as would occur for overlapping
2416 spectral windows).
2418 A future version of this function will support reporting a sensitivity
2419 spectrum for the spectral line case (including support for
2420 WEIGHT_SPECTRUM). For now, spectral line sensitivity may be
2421 reasonably estimated by dividing the reported sensitivity by the
2422 square root of the fractional bandwidth of a single image channel, or
2423 by selecting a bandwidth matching the width of a single image channel.
2425 Output Parameters:
2426 pointsource Calculated apparent point source sensitivity (in units implied by the MS weights)
2427 relative Ratio of apparent sensitivity relative to natural weighting
2429 Example:
2431 # open and set up selection and image plane parameters
2432 im.open('mydata.ms')
2433 im.selectvis(field='2',spw='0')
2434 im.defineimage(mode='mfs',spw=0,stokes='I',cellx='15arcsec',celly='15arcsec',nx=256,ny=256)
2436 # report natural weighting sensitivity
2437 im.weight(type='natural')
2438 nat=im.apparentsens();
2439 print 'Natural Sensitivity =', nat[1];
2440 print 'Relative to Natural Weighting = ', nat[2];
2442 # switch to uniform weighting
2443 im.weight(type='uniform')
2444 uni=im.apparentsens();
2445 print 'Uniform Sensitivity =', uni[1];
2446 print 'Relative to Natural Weighting = ', uni[2];
2448 # switch to briggs weighting
2449 im.weight(type='briggs',robust=0.0)
2450 rob=im.apparentsens();
2451 print 'Briggs Sensitivity =', rob[1];
2452 print 'Relative to Natural Weighting = ', rob[2];
2454 im.close()
2456 --------------------------------------------------------------------------------
2458 """
2459 return _imager.imager_apparentsens(self, *args, **kwargs)
2462 def setbeam(self, *args, **kwargs):
2463 """
2464 setbeam(self, _bmaj, _bmin, _bpa) -> bool
2468 Summary:
2469 Set the beam parameters for clean restoration
2471 Description:
2474 This sets the clean beam that will be used in all restoration
2475 operations.
2477 Input Parameters:
2478 bmaj Major axis of beam
2479 bmin Minor axis of beam
2480 bpa Position angle of beam
2482 --------------------------------------------------------------------------------
2484 """
2485 return _imager.imager_setbeam(self, *args, **kwargs)
2488 def selectvis(self, *args, **kwargs):
2489 """
2490 selectvis(self, _vis, _nchan, _start, _step, _spw, _field, _baseline, _time, _scan, _intent, _observation, _uvrange, _taql, _usescratch, _datainmemory, _writeaccess) -> bool
2494 Summary:
2495 Select visibilities for subsequent processing
2497 Description:
2500 This setup tool function selects which data are to be used
2501 subsequently. After invocation of selectvis, only the selected
2502 data are operated on. Thus, for example, in imaging, only the selected
2503 data are gridded into an image, and in plotting, only the
2504 selected data are plotted.
2506 Data can be selected by field and spectral window ids. Note that
2507 all data thus selected are passed to imaging, and may or
2508 may not be imaged, depending on how the image was constructed
2509 using defineimage. For example,
2510 in mosaicing, use fieldid in defineimage to control what pointing
2511 is used to define the field center, and use fieldid in selectvis
2512 to control what pointings are used in the imaging.
2514 For spectral processing, it is possible to make cubes out
2515 multi-spectral window selections but the selection and combination can
2516 be a bit confusing (any hint at how to make it clearer is welcome).
2518 If the default values are not used, then data to be used can be selected channel wise. The
2520 begin{description}
2521 item[nchan] is the number of data channels selected. It
2522 defaults to -1 (interpreted as all channels).
2523 item[start] is the first channel from input dataset that is to be used.
2524 It defaults to 0 (i.e. first channel).
2525 item[step] gives the increment between selected input channels. It defaults to 1 channel. A value of {tt n} means that {tt n-1} data channels will not not be used.
2526 end{description}
2530 By choosing the parameters for selectvis and defineimage correctly,
2531 one may obtain various mappings of visibility channels to image
2532 channels. For example, to average 512 visibility channels into 64
2533 image channels (producing image channels consisting of 8
2534 visibility channels):
2537 im.defineimage(mode='channel', spw=0, nchan=64, start=1, step=8);
2538 im.selectvis(spw=0, nchan=512, start=1, step=1)
2539 im.clean(.....);
2542 This averages the spectral channels during the gridding process. If
2543 one wanted to only include every 8th channel in the
2544 deconvolution, one would do:
2547 im.selectvis(nchan=64, start=1, step=8)
2548 im.defineimage(mode='channel', nchan=64, start=1, step=8);
2549 im.clean(....);
2552 For velocity and opticalvelocity modes, the mstart and mstep
2553 are the start and step velocities as strings.
2556 im.defineimage(mode='velocity', nchan=64, start='20 km/s', step='-100m/s');
2557 im.selectvis(spwid=[-1]); ###selecting all data spectral windows
2558 im.clean(...);
2561 If the image and data selections differ, then averaging is done during
2562 the gridding and degridding process in the image deconvolution.
2565 im.defineimage(mode='channel', nchan=64, start=1, step=8);
2566 im.selectvis(nchan=512, start=1, step=1)
2567 im.clean()
2570 Note: The channels numbers used in {tt defineimage}
2571 and {tt selectvis} refers to the same channel. So if a channel is not
2572 selected in {tt selectvis} but is selected in {tt defineimage}, then
2573 blank channels image are made. The example below will result in the
2574 having the first 6 (0-5) channels in the image to be blank.
2577 im.selectvis(nchan=50, start=6, step=1) #selected chan 6-55
2578 im.defineimage(mode='channel', nchan=50, start=0, step=1);
2580 # will try to image channel 1-50. But as previously only channel 6-55
2581 # was selected only channel 6-50 will have data; images of channels
2582 # 1-5 are blank
2583 im.clean(....)
2586 For multi-spectral window cube imaging the selection of the data can
2587 be done as follows
2590 im.selectvis(nchan=[50,60], start=[0,0], step=[1,1],
2591 spw=[0,1])
2592 im.defineimage(mode='channel', nchan=110, start=0, step=1, spw=[0,1]);
2596 The above means that you would make a data selection of 50 channels
2597 (starting from 0 steping 1) from the first spectral window and 60
2598 channels (starting from 1 steping 1). The defineimage defines the image
2599 to be a cube of 110 channels. The caveat is the step size in the
2600 frequency direction is the step size of the first spectral window. If
2601 the step size of channels of the two spectral windows are different
2602 then one is better off defining the image cube in velocities (e.g. as below).
2606 im.selectvis(nchan=[50,60], start=[0,0], step=[1,1],
2607 spw=[1,2])
2608 im.defineimage(mode='velocity', nchan=200, mstart='20km/s',
2609 mstep='-100m/s');
2612 Input Parameters:
2613 vis Measurementset for which this selection applies; an empty string '' implies that it is to be applied in ms used in open
2614 nchan Number of channels to select
2615 start Start channels (0-relative)
2616 step Step in channel number
2617 spw Spectral Window Ids (0 relative) to select; -1 interpreted as all
2618 field Field Ids (0 relative) or Field names (msselection syntax and wilcards are used) to select
2619 baseline Antenna Ids (0 relative) or Antenna names (msselection syntax and wilcards are used) to select
2620 time Limit data selected to be within a given time range. The syntax is defined in the msselection link
2621 scan Limit data selected on scan numbers. The syntax is defined in the msselection link
2622 intent Limit data selected on observation intent. The syntax is defined in the msselection link
2623 observation Limit data using observation IDs. The syntax is defined in the msselection link
2624 uvrange Limit data selected on uv distance. The syntax is defined in the msselection link
2625 taql For the TAQL experts, flexible data selection using the TAQL syntax
2626 usescratch If True: imager will use CORRECTED_DATA column and will make scratch columns and store Model visibilities after deconvolution
2627 datainmemory If True: imager will load the selected ms memory; useful if imaging a few channels that fit in memory
2628 writeaccess If False: imager will open the ms in readmode; useful for multiple process access to the MS
2630 Example:
2632 im.open('3C273XC1.MS');
2633 im.selectvis(nchan=512,start=1,step=1, taql='SCAN_NUMBER > 10 && FIELD_ID==2')
2636 Time range selection
2638 im.selectvis(field=range(0,10), time='> 2000/09/21/12:00:00')
2641 select some antennas, for all fields that begins with {tt 'ngc'}
2643 im.selectvis(field='ngc*', baseline=[0, 10, 20])
2646 And for those that the standard parameters are not flexible enough
2647 there is the taql parameter. This for people who knows the different
2648 columns of the MeasurementSet
2650 im.selectvis(taql='ANTENNA1==0 && ANTENNA2==3')
2653 Imager allows the user to make an image from multiple ms, without the
2654 need to concatenate them. To do this then the im.open method should
2655 {bf not} be used at all but multiple calls of selectvis with the
2656 parameter vis pointing to each ms should be used. The other
2657 parameters can be used to make selection on each ms
2660 im.selectvis(vis='myms1.ms', field=0, spw=[0,1], nchan=[40, 50], start=[5,10])
2661 im.selectvis(vis='myms2.ms', field=10, spw=[2], nchan=[40], start=[5])
2662 im.selectvis(vis='myms3.ms', field=range(0,10), time='> 2002/10/15/20:30:45')
2664 --------------------------------------------------------------------------------
2666 """
2667 return _imager.imager_selectvis(self, *args, **kwargs)
2670 def setjy(self, *args, **kwargs):
2671 """
2672 setjy(self, _field, _spw, _modimage, _fluxdensity, _standard, _scalebychan, _spix, _reffreq, _polindex, _polangle, _rotmeas, _time, _scan, _intent, _observation, _interpolation) -> record *
2676 Summary:
2677 Compute the model visibility for a specified source flux density
2679 Description:
2682 Compute the model visibility for a specified source flux density, and
2683 insert into the MODEL_DATA column. The source flux density for
2684 a set of standard flux density reference sources may optionally
2685 be pre-computed, by setting the input flux density to -1 (the default).
2686 At present, these include 3C286, 3C48, 3C147, 3C138, and 1934-638.
2687 In this case, if the source is not in this set, an unpolarized
2688 flux density of 1 Jy will be assumed. Users may also specify
2689 {tt standard='SOURCE'} to use the model(s) in the SOURCE_MODEL column of the
2690 SOURCE subtable.
2692 Users may also specify a model image that will be scaled to the
2693 specified total flux density (or that computed for reference sources).
2694 When a model image is specified, setjy will only permit processing
2695 one field, and will currently only process Stokes I.
2697 Input Parameters:
2698 field Field Id (0-relative) or name
2699 spw Spectral Window Id. (0-relative)
2700 modimage A model image
2701 fluxdensity Specified flux density (I,Q,U,V) in Jy (lookup the value; use 1.0 if not found)
2702 standard Flux density standard
2703 scalebychan Do the flux scaling on a per channel basis else on a spw basis. Effectively True if fluxdensity is specified.
2704 spix Spectral index for fluxdensity. S = fluxdensity * (freq/reffreq)**spix
2705 reffreq Reference frequency for spix.
2706 polindex Coefficients for Taylor expansion of Polarization index
2707 polangle Coefficients for Taylor expansion of Polarization angle in radians
2708 rotmeas rotation measure (rad/lambda**2)
2709 time Time range to operate on
2710 scan Scan(s) to operate on
2711 intent Observation intent
2712 observation Observation ID(s) to operate on
2713 interpolation interpolation method in the case of time variable calibrator
2715 Example:
2717 im.setjy(fieldid=2, spwid=-1, fluxdensity=[2.6,0.2,0.3,0.5],standard='Baars')
2720 Compute the model visibility for field id. 2 to the specified
2721 point-source (I,Q,U,V) for all spectral windows id.'s on the
2722 Baars flux density scale.
2724 --------------------------------------------------------------------------------
2726 """
2727 return _imager.imager_setjy(self, *args, **kwargs)
2730 def ssoflux(self):
2731 """
2732 ssoflux(self) -> bool
2736 Summary:
2737 Use setjy instead.
2739 Description:
2742 *This was an experimental clone of setjy while flux calibration with Solar
2743 System objects was being tested. It has been merged back into setjy.*
2745 --------------------------------------------------------------------------------
2747 """
2748 return _imager.imager_ssoflux(self)
2751 def setmfcontrol(self, *args, **kwargs):
2752 """
2753 setmfcontrol(self, _cyclefactor, _cyclespeedup, _cyclemaxpsffraction, _stoplargenegatives, _stoppointmode, _minpb, _scaletype, _constpb, _fluxscale, _flatnoise) -> bool
2757 Summary:
2758 Set various cycle control parameters for multi-field and wide-field imageing.
2760 Description:
2763 Control parameters for mosaicing or wide-field imaging which are not
2764 required in single field deconvolution are set here to streamline the
2765 user interface. As multifield and widefield imaging is accomplished
2766 by deconvolution in cycles, many of these parameters control how the
2767 deconvolution cycles are ended.
2769 begin{description}
2770 item cyclefactor: this parameter helps in lowering or increasing the
2771 threshold at which the deconvolution cycle will stop and degrid and
2772 subtract from the visibilities. For very bad PSFs you may want to
2773 reconcile with the visibilties often, thus a larger number is
2774 required here...(4 to 5). For very well behaved data you may want to
2775 deconvolve deep before reconciling: a lower number is used (1.5 to 2.0).
2776 item cyclespeedup: this is used if the PSF is not well behaved and
2777 you want clean to raise by 2 the threshold if it has not reached the
2778 threshold in this number of iteration
2779 item cyclemaxpsffraction: similar to cyclefactor, but this is an
2780 explicit fraction of the PSF peak. The final threshold is computed
2781 using min( cyclemaxpsffraction, cyclefactor * maxPSFsidelobe).
2782 Valid values are between 0.0 and 1.0.
2783 item stoplargenegatives: This parameter is exclusively for when using
2784 multiscale clean. This is used to stop the component
2785 search when the largest scale has found this number of negative
2786 components. -1 here means that continue component search even if the
2787 largest component is negative.
2788 item stoppointmode: Again exclusively for when using multiscale
2789 clean. The clean will stop if the smallest scale receives this
2790 number of consecutive components.
2791 item minpb: This is to defined up to what level the voltage pattern
2792 is going to applied when using
2793 setvp. The default is 0.1 of the
2794 primary beam or the voltage pattern defined for the antenna.
2795 item scaletype: This parameter cab be NONE or SAULT. If NONE the
2796 image is not scaled, if SAULT is used the image is weighted so that
2797 the noise is kept uniform across the image. The next two parameters
2798 defines how the SAULT weighting is limited. Obviously then the flux
2799 scale is not uniform across the image. To get the right flux
2800 multiply the image with the fluxscale image.
2801 item constpb: this parameter defines up to what amplitude of the
2802 Primary beam the noise floor is kept uniform, when using SAULT as scaletype.
2803 item fluxscale: use this to give a filename to store the factor image
2804 to apply to the image to get the fluxscale right.
2805 item flatnoise: (default true) Set to false if you want clean components for mosaic to be searched in the residual image that is effectively multiplied by the $beam^2$. This means when the noise is determined after the antenna, searching in the optimum domain of $signal/(sigma^2)$. For meter wavelengths where noise is determined by the sky, it is no longer optimal.
2806 end{description}
2808 Input Parameters:
2809 cyclefactor Cycle threshold = max_resid * min(cyclemaxpsffraction, this * max_sidelobe)
2810 cyclespeedup Cycle threshold doubles in this number of iterations
2811 cyclemaxpsffraction Cycle threshold = max_resid * min(this, cyclefactor * max_sidelobe)
2812 stoplargenegatives Stop the multiscale cycle for the first n cycles when a negative comp is found on the largest scale
2813 stoppointmode Stop multiscale altogether if the smallest scale recieves this many consecutive components
2814 minpb Minimum PB level to use
2815 scaletype Image plane flux scale type
2816 constpb In Sault weighting the flux scale is constant above this PB level
2817 fluxscale Names of flux scale images for mosaicing
2818 flatnoise Set to false if clean component search is to be done in an optimal signal/noise residual image if true will clean in a constant noise image
2820 Example:
2822 im.setmfcontrol(cyclefactor=2.0, cyclespeedup=niter/10, cyclemaxpsffraction=0.8,
2823 stoplargenegatives=T, stoppointmode=10, fluxscale='image.fluxscale');
2825 --------------------------------------------------------------------------------
2827 """
2828 return _imager.imager_setmfcontrol(self, *args, **kwargs)
2831 def setoptions(self, *args, **kwargs):
2832 """
2833 setoptions(self, _ftmachine, _cache, _tile, _gridfunction, _location, _padding, _freqinterp, _wprojplanes, _epjtablename, _applypointingoffsets, _dopbgriddingcorrections, _cfcachedirname, _rotpastep, _pastep, _pblimit, _imagetilevol, _singleprecisiononly, _numthreads, _psterm, _aterm, _mterm, _wbawp, _conjbeams) -> bool
2837 Summary:
2838 Set some general options for subsequent processing
2840 Description:
2843 This function is for setting different gridding and memory options
2845 begin{description}
2846 item[ftmachine] The options for ftmachine are:
2847 begin{description}
2848 item[ft] Standard interferometric gridding
2849 item[sd] Standard single dish gridding
2850 item[both] ft and sd as appropriate.
2851 item[wproject] option for using the wproject algorithm for wide-field
2852 imaging; when this option is used the parameter {tt wprojplanes}
2853 define the number of convolution functions to be used
2854 item[mosaic] option to use the gridder that uses the primary beam as
2855 the convolution function in gridding
2857 end{description}
2858 item[cache] The size of the cache used (in complex pixels) during the
2859 gridding process. The default is to use half the physical memory of
2860 the machine as specified by the aipsrc variable system.resources.memory.
2861 item[tile] The side of the tile (in complex pixels) during the
2862 gridding process.
2863 item[gridfunction] The gridding function used. Currently only
2864 Box-car ('BOX') and Prolate Spheriodal Wave Function ('SF')
2865 are supported. In the case of Single-Dish imaging the Primary Beam ('PB'),
2866 Gaussian ('GAUSS'), and Gaussian * Jinc ('GJINC') also can be used.
2867 item[location] For some unusual types of image, one needs to know the
2868 location to be used in calculating phase rotations. For example,
2869 one can specify images to be constructed in azel, in which
2870 case, an antenna position must be chosen. One can use functions of
2871 measures: either
2872 observatory to
2873 get the position of a named observatory ({em e.g.}
2874 me.observatory('ATCA')) or
2875 position to set
2876 the position ({em e.g.}me.position('wgs84','30deg','40deg','10m')).
2877 Although this information is available from the MeasurementSet, what
2878 location is ambiguous in some cases {em e.g.} VLBI.
2879 item[padding] When gridding and transforming, the array may be
2880 padded by this factor in the image plane. This reduces aliasing,
2881 especially in wide-field cleaning.
2882 item[usemodelcol] if this is false it tells imager to create and use the model
2883 visibility on the fly and in memory as far as possible...otherwise
2884 if it is True then imager will use the MODEL_DATA column to do this.
2885 item[wprojplanes] this parameter is is used only of {tt ftmachine}
2886 is set to {tt wproject}. This defines how many convolution functions
2887 is used in the Wprojection gridder (a -1 implies an automatic determination).
2888 end{description}
2890 Input Parameters:
2891 ftmachine Fourier transform machine
2892 cache Size of gridding cache in complex pixels; default use half the memory available on computer
2893 tile Size of a gridding tile in pixels (in 1 dimension)
2894 gridfunction Gridding function
2895 location Location used in phase rotations
2896 padding Padding factor in image plane (>=1.0)
2897 freqinterp interpolation mode in frequency;options:- nearest, linear, cubic, spline
2898 wprojplanes No of gridding convolution functions used in wproject-ft machine (-1 means let the code decide this number)
2899 epjtablename E-Jones table name. This is used if applypointingoffsets is set to True.
2900 applypointingoffsets Apply pointing offset corrections during deconvolution.
2901 dopbgriddingcorrections Correct for PB gridding before prediction of visibilities. This should be True when doing deconvolution. This should be False when predicting visibilities for model sky with no primary beam attenuation in the model.
2902 cfcachedirname Directory where convolution functions are to be (or are being ) cached on the disk.
2903 rotpastep The PA increment in degree used for on-the-fly (OTF) rotation of the A-term in A-Projection.
2904 pastep The PA increment in degree used to compute the PA-rotated A-term in A-Projection.
2905 pblimit Primary beam limit when using PBWProjection
2906 imagetilevol Tile size on for image on disk (in pixel, multiply by 4 to get the byte size). It is safe to leave this as default, meant for usage on filesystem like Lustre, the default (0) implies 32x32x4x32 tile shape. Setting it explicitly to a negative number will also try to avoid using disk templattices when possible.
2907 singleprecisiononly Set this value to True to force single precision all the time. Otherwise imager may use double precision gridding (ft and wproject only for now) when it can and deems it fit. Setting to True can be handy on low memory machines
2908 numthreads Limit the number of threads used in this run (openmp enabled only)
2909 psterm Switch-on the PS-Term?
2910 aterm Switch-on the A-Term?
2911 mterm Switch-on the M-Term?
2912 wbawp Trigger the WB A-Projection algorithm?
2913 conjbeams Use frequency conjugate beams in WB A-Projection algorithm?
2915 Example:
2917 - im.setoptions(cache=10000000, tile=32, gridfunction='BOX',
2918 location=me.location('vla'))
2920 The above example is to tell imager to use memory to fit 10000000
2921 complex numbers and tile the image with tiles of 32 pixels on a side.
2922 Also it tells imager to use a box function as gridding function. The
2923 location parameter will make imager overide the position of the
2924 telescope to use (the default is the one it gets from the ms).
2927 im.open('n1333.ms')
2928 im.selectvis(fieldid=[2:6, 8:12], spwid=[1:2])
2929 im.defineimage(nx=800, ny=800, cellx='0.5arcsec', celly='0.5arcsec', mode='velocity', nchan=30, mstart='-10km/s', mstep='1.8km/s', spwid=[1,2],fieldid=3)
2930 im.setoptions(ftmachine='mosaic')
2931 im.setvp(dovp=T)
2932 im.setoptions(ftmachine='mosaic')
2933 im.clean(algorithm='mfclark', model='try1', niter=200)
2937 In the above example we are making a mosaic using the fields
2938 2,3,4,5,6,8,9,10,11,12 and we use the mosaic ftmachine. This uses the
2939 primary beam of the telescope as the gridding function.
2942 im.open('coma.ms')
2943 im.selectvis(spwid=1, fieldid=1);
2944 mydir=me.direction('J2000', '12h30m48', '12d24m0')
2945 im.defineimage(nx=200, cellx='30arcsec', phasecenter=mydir);
2946 im.make('outlier1');
2947 im.defineimage(nx=1800, cellx='30arcsec');
2948 im.setoptions(ftmachine='wproject',wprojplanes=512, padding=1.0)
2949 im.make('main')
2950 im.clean(algorithm='mfclark',model=['main', 'outlier1'], niter=10000, image=['coma.image', 'outlier1.image'])
2951 im.done()
2955 In the above example we are using the Wprojection algorithm for 3-D
2956 imaging. We are using 512 gridding functions. Sometimes if there is a
2957 memory issue (very large images and many griding functions) we suggest
2958 the use of facetting of the image with wprojection. So the example
2959 above would be something like below. Note that when using facets only
2960 the {tt wfclark} and {tt wfhogbom} can be used for now. Note on how
2961 an outlier field (or flanking) field is set on an interfering source
2962 outside of the field of interest.
2965 im.open('coma.ms')
2967 im.selectvis(spwid=1, fieldid=1);
2968 mydir = me.direction('J2000', '12h30m48', '12d24m0')
2969 im.defineimage(nx=200, ny=200, cellx='30arcsec', celly='30arcsec', phasecenter=mydir);
2970 im.make('outlier1');
2971 im.defineimage(nx=3000, ny=3000, cellx='30arcsec',celly='30arcsec',facets=3);
2972 im.setoptions(ftmachine='wproject',wprojplanes=200, padding=1.2)
2973 im.make('main')
2974 im.clean(algorithm='wfclark',model=['main', 'outlier1'], niter=10000)
2975 im.done()
2977 --------------------------------------------------------------------------------
2979 """
2980 return _imager.imager_setoptions(self, *args, **kwargs)
2983 def setscales(self, *args, **kwargs):
2984 """
2985 setscales(self, _scalemethod, _nscales, _uservector) -> bool
2989 Summary:
2990 Set the scale sizes for MultiScale Clean
2992 Description:
2996 The multiscale clean algorithm cleans an image on a number of
2997 different scales, decomposing the image into Gaussians of these scale sizes.
2998 This function allows the user to set the number
2999 of scales used (using the nscales method), or to directly control the
3000 sizes of the scales in pixels (using the uservector method). When using the
3001 nscales method, the scales are calculated using the following formula:
3002 begin{equation}
3003 theta_{minor} 10.0 ^{(i- N_{scales}/2)/2.0}
3004 end{equation}
3005 where $theta_{min}$ is the fitted minor axis of the clean beam. The
3006 first value is zero.
3008 Input Parameters:
3009 scalemethod Method by which scales are set
3010 nscales Number of scales
3011 uservector Vector of scale sizes in pixels to use, defaults should be 0,3,10
3013 Example:
3015 - im.setscales(scalemethod='nscales', nscales=6);
3017 Here we make six scales automatically using the method described
3018 above.
3019 Or we could manually choose the scales in pixel numbers as follows:
3021 - im.setscales(scalemethod='uservector', uservector=[0,3,10,30]);
3024 Note: 0 pixel is the delta function, so if one were to select scale 0 only
3025 it would be equivalent to a Hogbom clean.
3027 --------------------------------------------------------------------------------
3029 """
3030 return _imager.imager_setscales(self, *args, **kwargs)
3033 def setsmallscalebias(self, *args, **kwargs):
3034 """
3035 setsmallscalebias(self, _inbias) -> bool
3039 Summary:
3040 Set bias toward smaller scales for MultiScale Clean
3042 Input Parameters:
3043 inbias small scale bias
3045 Example:
3047 - im.setsmallscalebias(inbias=0.6);
3049 --------------------------------------------------------------------------------
3051 """
3052 return _imager.imager_setsmallscalebias(self, *args, **kwargs)
3055 def settaylorterms(self, *args, **kwargs):
3056 """
3057 settaylorterms(self, _ntaylorterms, _reffreq) -> bool
3061 Summary:
3062 Set the number of Taylor series terms for Multi-Frequency Clean
3064 Description:
3068 The multi-frequency clean algorithm cleans an image by approximating its spectra
3069 by a Taylor series expansion. This function allows the user to set the number of
3070 Taylor terms to be used. Options are 1,2,3.
3072 Input Parameters:
3073 ntaylorterms Number of Taylor terms
3074 reffreq Reference Frequency
3076 Example:
3078 - im.settaylorterms(ntaylorterms=3);
3080 --------------------------------------------------------------------------------
3082 """
3083 return _imager.imager_settaylorterms(self, *args, **kwargs)
3086 def setsdoptions(self, *args, **kwargs):
3087 """
3088 setsdoptions(self, _scale, _weight, _convsupport, _pointingcolumntouse, _truncate, _gwidth, _jwidth, _minweight, _clipminmax, _enablecache, _convertfirst) -> bool
3092 Summary:
3093 Set some options for single dish processing
3095 Description:
3098 Various less-often-used options for single dish processing can be set.
3100 begin{description}
3101 item[scale] The overall scale of the single dish data is multiplied by this
3102 factor.
3103 item[weight] The weight given to the single dish data in the imaging
3104 is multiplied by this factor.
3105 item[convsupport] This parameter can be used to change the support used in gridding single dish data in imaging. If 'PB' or 'pb' is used as the 'convtype' in
3106 setoptions this parameter is ignored as the support is defined by the primary beam. The deafult of -1 mans 1 as convsupport is used for 'box' convolution function and 3 is used for 'SF' convolution function.
3107 item[pointingcolumntouse] This parameter is NOT to be changed under normal circumstances. This is to be used by those who know what they are doing and want to try to use different columns in the POINTING table especially if they believe their dish direction is wrong. And if any of the {tt _OFFSET} columns is used do not expect to be able to use a different frame in the image setup in defineimage. Possible values are {tt DIRECTION, TARGET, ENCODER, POINTING_OFFSET, SOURCE_OFFSET}
3108 item[truncate] The truncation radius as a quantity or a float value. This parameter is effective only when 'GAUSS' or 'GJINC' is used as the 'convtype' in setoptions. You can use an unit 'pixel' to specify truncation radius as pixel value. If float value is set, or quantity without unit is set, its unit will be 'pixel'.
3109 item[gwidth] The width of the gaussian beam as a radius of half maximum. This parameter is effective only when 'GAUSS' or 'GJINC' is used as the 'convtype' in setoptions. You can use an unit 'pixel' to specify truncation radius as pixel value. If float value is set, or quantity without unit is set, its unit will be 'pixel'. Note that, when 'GJINC' is used as the 'convtype', gwidth doesn't directry specify width of the convolution function.
3110 item[jwidth] The witdh of the jinc beam as a parameter c, where jinc = J_1(pi*x/c)/(pi*x/c). This parameter is effective only when 'GJINC' is used as the 'convtype' in setoptions. You can use an unit 'pixel' to specify truncation radius as pixel value. If float value is set, or quantity without unit is set, its unit will be 'pixel'. Note that jwidth doesn't directly specify width of the convolution function.
3111 end{description}
3113 Input Parameters:
3114 scale Scaling applied to single dish data
3115 weight Weights applied to single dish data
3116 convsupport number of pixel for convolution support
3117 pointingcolumntouse Which Pointing Table column to use to get direction
3118 truncate truncation radius (effective only for 'GAUSS' or 'GJINC')
3119 gwidth radius of half maximum for gaussian (effective only for 'GAUSS' or 'GJINC')
3120 jwidth c-parameter for jinc function (effective only for 'GJINC')
3121 minweight Minimum weight level to use for weight correction and weight based masking.
3122 clipminmax Clip minimum and maximum values from each grid
3123 enablecache Cache spectra pixel coordinates for later re-use
3124 convertfirst Interpolation-Conversion scheme to use: convert pointingcolumntouse before performing interpolation at data-taking time
3126 Example:
3128 - im.setsdoptions(scale=1.0, weight=1.0, convsupport=5)
3130 --------------------------------------------------------------------------------
3132 """
3133 return _imager.imager_setsdoptions(self, *args, **kwargs)
3136 def setvp(self, *args, **kwargs):
3137 """
3138 setvp(self, _dovp, _usedefaultvp, _vptable, _dosquint, _parangleinc, _skyposthreshold, _telescope, _verbose) -> bool
3142 Summary:
3143 Set the voltage pattern model for subsequent processing
3145 Description:
3148 Set the voltage pattern model (and hence, the primary beam) used for a
3149 telescope. There are currently two ways to set the voltage pattern: by using
3150 the extensive list of defaults which the system knows about, or by creating a
3151 voltage pattern description with the vpmanager. The default voltage patterns
3152 include both a high and a low frequency VP for the WSRT, a VP for each
3153 observing band at the AT, several VP's for the VLA, including the appropriate
3154 beam squint for each observing band, and Gaussian for the BIMA dishes. Due to
3155 temporary limitations in the internal structure of the visibility buffer, only
3156 one telescope's voltage pattern can be applied to a particular MeasurementSet.
3157 This will be corrected shortly.
3159 Input Parameters:
3160 dovp Do voltage pattern (ie, primary beam) correction
3161 usedefaultvp Look up the default VP for this telescope and frequency?
3162 vptable If usedefaultvp is False, provide a VP Table made with vpmanager
3163 dosquint Activate the beam squint in the VP model
3164 parangleinc Parallactice angle increment for squint application
3165 skyposthreshold Sky position threshold
3166 telescope Which default telescope to use; if empty use the one in encoded in MS
3167 verbose If false, suppress some messages from being sent to the logger.
3169 Example:
3171 im.setvp(dovp=True, usedefaultvp=True, dosquint=False)
3173 --------------------------------------------------------------------------------
3175 """
3176 return _imager.imager_setvp(self, *args, **kwargs)
3179 def setweightgrid(self, *args, **kwargs):
3180 """
3181 setweightgrid(self, _weight, _type) -> bool
3185 Summary:
3186 set the requested weight grids
3188 Description:
3192 This is a utility function when running multi imager processes in parallel on subsection of an ms/data independently
3193 One would wish to weight the dirty image before averaging or set the imaging weight density (when using unform or
3194 Brigg's style weighting) to account for all the data being used. This is {bf NOT} for the general user but for people who
3195 are parallelizing at the scripting level.
3197 Input Parameters:
3198 weight Numeric array. Required input.
3199 type Type of weight requested
3201 Example:
3203 wght=im.getweightgrid('imaging')
3204 wght2=im2.getweightgrid('imaging')
3205 wght=wght+wght2
3207 im.setweightgrid(weight=wght, type='imaging')
3208 im2.setweightgrid(weight=wght, type='imaging')
3210 --------------------------------------------------------------------------------
3212 """
3213 return _imager.imager_setweightgrid(self, *args, **kwargs)
3216 def smooth(self, *args, **kwargs):
3217 """
3218 smooth(self, _model, _image, _usefit, _bmaj, _bmin, _bpa, _normalize) -> bool
3222 Summary:
3223 Calculate an image smoothed with a Gaussian beam
3225 Description:
3228 The model images are convolved with the specified Gaussian beam. By
3229 default (normalize=T), the beam volume is normalized to unity so that
3230 the smoothing is flux preserving. The smoothing used in restoration is
3231 not normalized.
3233 Input Parameters:
3234 model Name of input model
3235 image Name of output smoothed images
3236 usefit Use the fitted value (rather than that specified
3237 bmaj Major axis of beam
3238 bmin Minor axis of beam
3239 bpa Position angle of beam
3240 normalize Normalize volume of psf to unity
3242 Example:
3244 - im.smooth(model='3C273XC1.clean', image='3C273XC1.clean.restored',
3245 bmaj='2.0arcsec', bmin='2.0arcsec')
3247 --------------------------------------------------------------------------------
3249 """
3250 return _imager.imager_smooth(self, *args, **kwargs)
3253 def stop(self):
3254 """
3255 stop(self) -> bool
3259 Summary:
3260 stop the currently executing function asap
3262 Description:
3265 Stop the currently executing function as soon as possible. Note that
3266 it is not always possible to stop a function.
3268 --------------------------------------------------------------------------------
3270 """
3271 return _imager.imager_stop(self)
3274 def summary(self):
3275 """
3276 summary(self) -> bool
3280 Summary:
3281 Summarize the current state of the imager tool
3283 Description:
3286 Writes a summary of the properties of the imager to the
3287 default logger. This includes:
3288 begin{itemize}
3289 item The name of the MeasurementSet (set in construction or via the
3290 open function.
3291 item The parameters of the image (set via defineimage)
3292 item The current beam (set by fitpsf
3293 or setbeam.
3294 item The selection of an ms (set via selectvis)
3295 item The general processing options (set via setoptions)
3296 end{itemize}
3298 Example:
3300 - im.open('3C273XC1.MS');
3301 - im.defineimage(nx=256, ny=256)
3302 - im.summary()
3304 --------------------------------------------------------------------------------
3306 """
3307 return _imager.imager_summary(self)
3310 def uvrange(self, *args, **kwargs):
3311 """
3312 uvrange(self, _uvmin, _uvmax) -> bool
3316 Summary:
3317 Select data within the limit of a given range
3319 Description:
3322 Apply a uvrange so that only points within a given uvrange are selected for further usage. To be noted selectvis if used after uvrange will reset the selected range. So selectvis should be used prior to uvrange or can be used
3324 to reset it if one changes one's mind. The points are not flagged! Further point to be noted for spectral line data the uv distance is calculated using the mean of the wavelengths of the different spectral channels selected.
3326 Input Parameters:
3327 uvmin Minimum uv distance allowed (wavelengths)
3328 uvmax Maximum uv distance allowed (wavelengths)
3330 Example:
3332 im.weight('uniform')
3333 im.uvrange(0, 4000.0)
3335 --------------------------------------------------------------------------------
3337 """
3338 return _imager.imager_uvrange(self, *args, **kwargs)
3341 def weight(self, *args, **kwargs):
3342 """
3343 weight(self, _type, _rmode, _noise, _robust, _fieldofview, _npixels, _mosaic) -> bool
3347 Summary:
3348 Apply additional weighting to the visibility weights
3350 Description:
3353 Apply visibility weighting to correct for the local density of
3354 sampling in the uv plane. The imaging weights are calculated on the fly
3355 when processing the data and can be viewed by
3356 plotweights.
3358 To correct for visibility sampling effects, natural, uniform, radial, and Briggs weighting are supported. These work as
3359 follows. Then:
3360 begin{description}
3361 item[natural]: minimizes the noise in the dirty image. The weight of
3362 the $i$-th sample is set to the inverse variance:
3363 begin{equation}
3364 w_i={1over{sigma_i^2}}
3365 end{equation}
3366 where $sigma_i$ is the noise of the $i$'th sample.
3367 item[radial]: approximately minimizes rms sidelobes for an east-west synthesis
3368 array. The weight of the $i$-th sample is multiplied
3369 by the radial distance from the center of the $u,v$ plane:
3370 begin{equation}
3371 w_i=w_i sqrt{u_i^2+v_i^2}
3372 end{equation}
3373 item[uniform]: For Briggs and uniform weighting, we first grid the inverse
3374 variance $w_i$ for all selected data onto a grid of size given by the
3375 argument npixels (default to nx) and u,v cell-size given by
3376 $2/$fieldofview where fieldofview is the specified field of view
3377 (defaults to the image field of view). This forms the gridded weights
3378 $W_k$. The weight of the $i$-th sample is then changed:
3379 begin{equation}
3380 w_i={w_iover{W_k}}
3381 end{equation}
3382 where $W_k$ is the gridded weight of the relevant cell.
3383 It may be shown that this minimizes rms sidelobes over
3384 the field of view. By changing the field of view, one may suppress
3385 the sidelobes over a region different (usually smaller) than the
3386 image size.
3387 item[briggs: rmode='norm']: The weights are changed:
3388 begin{equation}
3389 w_i={w_iover{1 + W_k f^2}}
3390 end{equation}
3391 where:
3392 begin{equation}
3393 f^2={{(5*10^{-R})^2}over{{sum_k W_k^2}over{sum_i w_i}}}
3394 end{equation}
3395 and $R$ is the robust parameter. The scaling of $R$ is such that
3396 $R=0$ gives a good tradeoff between resolution and sensitivity.
3397 $R$ takes value between -2.0 (close to uniform weighting) to 2.0
3398 (close to natural).
3399 item[briggs: rmode='abs']: The weights are changed:
3400 begin{equation}
3401 w_i={w_iover{W_k*R^2+2*sigma_R^2}}
3402 end{equation}
3403 where $R$ is the robust parameter and $sigma_R$ is the noise
3404 parameter.
3405 end{description}
3406 For more details about Briggs (aka robust) weighting, see the htmladdnormallink{Briggs thesis}
3407 {briggsURL}.
3409 Note that this weighting is {em not} cumulative since the imaging weights are
3410 calculated from the specified weight (function of noise; usually $1/sigma^2$) per visibility
3411 (actually stored in the WEIGHT column).
3413 Input Parameters:
3414 type Type of weighting
3415 rmode Mode of briggs weighting
3416 noise Noise used in absolute briggs weighting
3417 robust Parameter in briggs weighting
3418 fieldofview Field of view for uniform weighting
3419 npixels Number of pixels in the u and v directions
3420 mosaic Individually weight the fields of a mosaic
3422 Example:
3424 im.weight(type='briggs', rmode='norm', robust=0.5)
3427 Applies Briggs (robust) weighting.
3429 --------------------------------------------------------------------------------
3431 """
3432 return _imager.imager_weight(self, *args, **kwargs)
3435 def mapextent(self, *args, **kwargs):
3436 """
3437 mapextent(self, _ref, _movingsource, _pointingcolumntouse) -> record *
3441 Summary:
3442 Compute map extent from given set of MSs
3444 Description:
3447 TODO: description must be filled
3449 Input Parameters:
3450 ref direction reference
3451 movingsource moving source name
3452 pointingcolumntouse POINTING table column to be used for computation
3454 Example:
3456 TODO: example must be filled.
3458 --------------------------------------------------------------------------------
3460 """
3461 return _imager.imager_mapextent(self, *args, **kwargs)
3464 def pointingsampling(self, *args, **kwargs):
3465 """
3466 pointingsampling(self, _pattern, _ref, _movingsource, _pointingcolumntouse, _antenna) -> record *
3470 Summary:
3471 Calculate Sampling interval of an MS
3473 Description:
3476 Calculate sampling interval of an MS.
3478 Input Parameters:
3479 pattern scan pattern (NOTE: only raster is supported so far)
3480 ref direction reference
3481 movingsource moving source name
3482 pointingcolumntouse POINTING table column to be used for computation
3483 antenna Additional antenna selection
3485 Example:
3487 im.open(msname)
3488 im.selectvis(spw='17', field='M100', intent='OBSERVE_TARGET#ON_SOURCE')
3489 im.pointingsampling(pattern='raster', ref='J2000', antenna='PM03&&&')
3490 # returns a dictionary of sampling and angle, e.g.,
3491 # {'angle': {'unit': 'rad', 'value': -0.00014148390015604565},
3492 # 'sampling': {'unit': 'rad',
3493 # 'value': array([ 1.23216297e-05, 0.00000000e+00])}}
3494 im.close()
3496 --------------------------------------------------------------------------------
3498 """
3499 return _imager.imager_pointingsampling(self, *args, **kwargs)
3501 __swig_destroy__ = _imager.delete_imager
3502 __del__ = lambda self: None
3503 __swig_setmethods__["_pixels_advise"] = _imager.imager__pixels_advise_set
3504 __swig_getmethods__["_pixels_advise"] = _imager.imager__pixels_advise_get
3505 if _newclass:
3506 _pixels_advise = _swig_property(_imager.imager__pixels_advise_get, _imager.imager__pixels_advise_set)
3507 __swig_setmethods__["_cell_advise"] = _imager.imager__cell_advise_set
3508 __swig_getmethods__["_cell_advise"] = _imager.imager__cell_advise_get
3509 if _newclass:
3510 _cell_advise = _swig_property(_imager.imager__cell_advise_get, _imager.imager__cell_advise_set)
3511 __swig_setmethods__["_facets_advise"] = _imager.imager__facets_advise_set
3512 __swig_getmethods__["_facets_advise"] = _imager.imager__facets_advise_get
3513 if _newclass:
3514 _facets_advise = _swig_property(_imager.imager__facets_advise_get, _imager.imager__facets_advise_set)
3515 __swig_setmethods__["_phasecenter_advise"] = _imager.imager__phasecenter_advise_set
3516 __swig_getmethods__["_phasecenter_advise"] = _imager.imager__phasecenter_advise_get
3517 if _newclass:
3518 _phasecenter_advise = _swig_property(_imager.imager__phasecenter_advise_get, _imager.imager__phasecenter_advise_set)
3519 __swig_setmethods__["_bmaj_fitpsf"] = _imager.imager__bmaj_fitpsf_set
3520 __swig_getmethods__["_bmaj_fitpsf"] = _imager.imager__bmaj_fitpsf_get
3521 if _newclass:
3522 _bmaj_fitpsf = _swig_property(_imager.imager__bmaj_fitpsf_get, _imager.imager__bmaj_fitpsf_set)
3523 __swig_setmethods__["_bmin_fitpsf"] = _imager.imager__bmin_fitpsf_set
3524 __swig_getmethods__["_bmin_fitpsf"] = _imager.imager__bmin_fitpsf_get
3525 if _newclass:
3526 _bmin_fitpsf = _swig_property(_imager.imager__bmin_fitpsf_get, _imager.imager__bmin_fitpsf_set)
3527 __swig_setmethods__["_bpa_fitpsf"] = _imager.imager__bpa_fitpsf_set
3528 __swig_getmethods__["_bpa_fitpsf"] = _imager.imager__bpa_fitpsf_get
3529 if _newclass:
3530 _bpa_fitpsf = _swig_property(_imager.imager__bpa_fitpsf_get, _imager.imager__bpa_fitpsf_set)
3531 __swig_setmethods__["_pointsource_sensitivity"] = _imager.imager__pointsource_sensitivity_set
3532 __swig_getmethods__["_pointsource_sensitivity"] = _imager.imager__pointsource_sensitivity_get
3533 if _newclass:
3534 _pointsource_sensitivity = _swig_property(_imager.imager__pointsource_sensitivity_get, _imager.imager__pointsource_sensitivity_set)
3535 __swig_setmethods__["_relative_sensitivity"] = _imager.imager__relative_sensitivity_set
3536 __swig_getmethods__["_relative_sensitivity"] = _imager.imager__relative_sensitivity_get
3537 if _newclass:
3538 _relative_sensitivity = _swig_property(_imager.imager__relative_sensitivity_get, _imager.imager__relative_sensitivity_set)
3539 __swig_setmethods__["_sumweights_sensitivity"] = _imager.imager__sumweights_sensitivity_set
3540 __swig_getmethods__["_sumweights_sensitivity"] = _imager.imager__sumweights_sensitivity_get
3541 if _newclass:
3542 _sumweights_sensitivity = _swig_property(_imager.imager__sumweights_sensitivity_get, _imager.imager__sumweights_sensitivity_set)
3543 __swig_setmethods__["_senrec_sensitivity"] = _imager.imager__senrec_sensitivity_set
3544 __swig_getmethods__["_senrec_sensitivity"] = _imager.imager__senrec_sensitivity_get
3545 if _newclass:
3546 _senrec_sensitivity = _swig_property(_imager.imager__senrec_sensitivity_get, _imager.imager__senrec_sensitivity_set)
3547 __swig_setmethods__["_pointsource_apparentsens"] = _imager.imager__pointsource_apparentsens_set
3548 __swig_getmethods__["_pointsource_apparentsens"] = _imager.imager__pointsource_apparentsens_get
3549 if _newclass:
3550 _pointsource_apparentsens = _swig_property(_imager.imager__pointsource_apparentsens_get, _imager.imager__pointsource_apparentsens_set)
3551 __swig_setmethods__["_relative_apparentsens"] = _imager.imager__relative_apparentsens_set
3552 __swig_getmethods__["_relative_apparentsens"] = _imager.imager__relative_apparentsens_get
3553 if _newclass:
3554 _relative_apparentsens = _swig_property(_imager.imager__relative_apparentsens_get, _imager.imager__relative_apparentsens_set)
3555imager_swigregister = _imager.imager_swigregister
3556imager_swigregister(imager)
3557cvar = _imager.cvar
3559# This file is compatible with both classic and new-style classes.