Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/importfits.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 importfits.xml ################
2##################### e8fdf1ac06c4c663eca53aef832d20ef ##############################
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_importfits import importfits as _importfits_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 _importfits:
15 """
16 importfits ---- Convert an image FITS file into a CASA image
19 Convert an image FITS file into a CASA image
21 --------- parameter descriptions ---------------------------------------------
23 fitsimage Name of input image FITS file
24 Default: none
26 Example: fitsimage='3C273XC1.fits'
27 imagename Name of output CASA image
28 Default: none
30 Example: fitsimage='3C273XC1.image'
31 whichrep If fits image has multiple coordinate reps, choose one.
32 Default: 0 (means first)
34 Example: whichrep=1
35 whichhdu If fits file contains multiple images, choose one
36 Default: -1 (use the first valid one)
38 NOTE: 0 = first HDU, -1 = first valid image
40 Example: whichhdu=1
41 zeroblanks Set blanked pixels to zero (not NaN)
42 Default: True
43 Options: True|False
44 overwrite Overwrite output file if it exists?
45 Default: False
46 Options: False|True
47 defaultaxes Add the default 4D coordinate axes where they are
48 missing
49 Default: False
50 Options: False|True
52 IMPORTANT: value True requires setting defaultaxesvalues
53 defaultaxesvalues List of values to assign to added degenerate axes when
54 defaultaxes==True (ra,dec,freq,stokes)
55 Default: []
57 For existing axes, empty strings can be given as
58 values. For the directions and spectral values,
59 any valid angle/frequency expressions can be
60 given.
62 Example: defaultaxesvalues=['19h30m00',
63 '-02d30m00', '88.5GHz', 'Q']
64 beam List of values to be used to define the synthesized beam
65 [BMAJ,BMIN,BPA] (as in the FITS keywords)
66 Default: [] (i.e.take from FITS file)
68 Example: beam=['0.35arcsec', '0.24arcsec',
69 '25deg']
71 --------- examples -----------------------------------------------------------
74 FOR MORE INFORMATION, SEE THE TASK PAGES OF IMPORTFITS IN CASA DOCS:
75 https://casa.nrao.edu/casadocs/
79 """
81 _info_group_ = """import/export"""
82 _info_desc_ = """Convert an image FITS file into a CASA image"""
84 def __call__( self, fitsimage='', imagename='', whichrep=int(0), whichhdu=int(-1), zeroblanks=True, overwrite=False, defaultaxes=False, defaultaxesvalues=[ ], beam=[ ] ):
85 schema = {'fitsimage': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'imagename': {'type': 'cStr', 'coerce': _coerce.to_str}, 'whichrep': {'type': 'cInt'}, 'whichhdu': {'type': 'cInt'}, 'zeroblanks': {'type': 'cBool'}, 'overwrite': {'type': 'cBool'}, 'defaultaxes': {'type': 'cBool'}, 'defaultaxesvalues': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'beam': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}}
86 doc = {'fitsimage': fitsimage, 'imagename': imagename, 'whichrep': whichrep, 'whichhdu': whichhdu, 'zeroblanks': zeroblanks, 'overwrite': overwrite, 'defaultaxes': defaultaxes, 'defaultaxesvalues': defaultaxesvalues, 'beam': beam}
87 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
88 _logging_state_ = _start_log( 'importfits', [ 'fitsimage=' + repr(_pc.document['fitsimage']), 'imagename=' + repr(_pc.document['imagename']), 'whichrep=' + repr(_pc.document['whichrep']), 'whichhdu=' + repr(_pc.document['whichhdu']), 'zeroblanks=' + repr(_pc.document['zeroblanks']), 'overwrite=' + repr(_pc.document['overwrite']), 'defaultaxes=' + repr(_pc.document['defaultaxes']), 'defaultaxesvalues=' + repr(_pc.document['defaultaxesvalues']), 'beam=' + repr(_pc.document['beam']) ] )
89 task_result = None
90 try:
91 task_result = _importfits_t( _pc.document['fitsimage'], _pc.document['imagename'], _pc.document['whichrep'], _pc.document['whichhdu'], _pc.document['zeroblanks'], _pc.document['overwrite'], _pc.document['defaultaxes'], _pc.document['defaultaxesvalues'], _pc.document['beam'] )
92 except Exception as exc:
93 _except_log('importfits', exc)
94 raise
95 finally:
96 task_result = _end_log( _logging_state_, 'importfits', task_result )
97 return task_result
99importfits = _importfits( )