Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/impbcor.py: 100%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1##################### generated by xml-casa (v2) from impbcor.xml ###################
2##################### 419c87f7061a211b6219fbd221c422c8 ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_impbcor import impbcor as _impbcor_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _impbcor:
15 """
16 impbcor ---- Construct a primary beam corrected image from an image and a primary beam pattern.
19 Correct an image for primary beam attenuation using an image of the
20 primary beam pattern. The primary beam pattern can be provided as an
21 image, in which case 1. it must have the same shape as the input image
22 and its coordinate system must be the same, or 2. it must be a 2-D
23 image in which case its coordinate system must consist of a (2-D)
24 direction coordinate which is the same as the direction coordinate in
25 the input image and its direction plane must be the same shape as that
26 of the input image. Alternatively, pbimage can be an array of pixel
27 values in which case the same dimensionality and shape constraints
28 apply.
30 One can choose between dividing the image by the primary beam pattern
31 (mode="divide") or multiplying the image by the primary beam pattern
32 (mode="multiply"). One can also choose to specify a cutoff limit for
33 the primary beam pattern. For mode="divide", for all pixels below this
34 cutoff in the primary beam pattern, the output image will be
35 masked. In the case of mode="multiply", all pixels in the output will
36 be masked corresponding to pixels with values greater than the cutoff
37 in the primary beam pattern. A negative value for cutoff means that no
38 cutoff will be applied, which is the default.
40 --------- parameter descriptions ---------------------------------------------
42 imagename Name of the input (CASA, FITS, MIRIAD) image
43 pbimage Name of the image (CASA, FITS, MIRIAD) of the primary
44 beam pattern or an array of pixel values.
45 Default: ''
46 outfile Name of output CASA image.
47 Default: none. Must be specified.
48 overwrite If output file is specified, controls if an already
49 existing file by the same name can be overwritten.
50 Default: True
51 Options: True|False
53 If true, the user is not prompted, the file if it
54 exists is automatically overwritten.
55 box Rectangular region to select in direction plane.
56 Default: '' (use the entire direction plane)
57 region Region selection.
58 Default: '' (use the full image)
59 chans Channels to use.
60 Default: '' (use all channels)
61 stokes Stokes planes to use.
62 Default: '' (use all Stokes planes)
63 mask Mask to use.
64 Default: none
65 mode Divide or multiply the image by the primary beam image.
66 Default: 'divide'
68 Minimal match supported.
69 cutoff Primary beam cutoff.
70 Default: -1.0 (no cutoff)
72 If mode is "d", all values less than this will be
73 masked. If "m", all values greater will be
74 masked. Less than 0, no cutoff (default)
75 stretch Stretch the mask if necessary and possible?
76 Default: False
77 Options: False|True
78 [1;42mRETURNS[1;m bool
80 --------- examples -----------------------------------------------------------
83 FOR MORE INFORMATION, SEE THE TASK PAGES OF IMPBCOR IN CASA DOCS:
84 https://casa.nrao.edu/casadocs/
88 """
90 _info_group_ = """imaging, analysis"""
91 _info_desc_ = """Construct a primary beam corrected image from an image and a primary beam pattern."""
93 def __call__( self, imagename='', pbimage=[ ], outfile='', overwrite=False, box='', region='', chans='', stokes='', mask='', mode='divide', cutoff=float(-1.0), stretch=False ):
94 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'pbimage': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}, 'box': {'type': 'cStr', 'coerce': _coerce.to_str}, 'region': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'chans': {'type': 'cStr', 'coerce': _coerce.to_str}, 'stokes': {'type': 'cStr', 'coerce': _coerce.to_str}, 'mask': {'type': 'cStr', 'coerce': _coerce.to_str}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str}, 'cutoff': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'stretch': {'type': 'cBool'}}
95 doc = {'imagename': imagename, 'pbimage': pbimage, 'outfile': outfile, 'overwrite': overwrite, 'box': box, 'region': region, 'chans': chans, 'stokes': stokes, 'mask': mask, 'mode': mode, 'cutoff': cutoff, 'stretch': stretch}
96 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
97 _logging_state_ = _start_log( 'impbcor', [ 'imagename=' + repr(_pc.document['imagename']), 'pbimage=' + repr(_pc.document['pbimage']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'box=' + repr(_pc.document['box']), 'region=' + repr(_pc.document['region']), 'chans=' + repr(_pc.document['chans']), 'stokes=' + repr(_pc.document['stokes']), 'mask=' + repr(_pc.document['mask']), 'mode=' + repr(_pc.document['mode']), 'cutoff=' + repr(_pc.document['cutoff']), 'stretch=' + repr(_pc.document['stretch']) ] )
98 task_result = None
99 try:
100 task_result = _impbcor_t( _pc.document['imagename'], _pc.document['pbimage'], _pc.document['outfile'], _pc.document['overwrite'], _pc.document['box'], _pc.document['region'], _pc.document['chans'], _pc.document['stokes'], _pc.document['mask'], _pc.document['mode'], _pc.document['cutoff'], _pc.document['stretch'] )
101 except Exception as exc:
102 _except_log('impbcor', exc)
103 raise
104 finally:
105 task_result = _end_log( _logging_state_, 'impbcor', task_result )
106 return task_result
108impbcor = _impbcor( )