Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/exportfits.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
1##################### generated by xml-casa (v2) from exportfits.xml ################
2##################### 26c81b83025f4fbfa3801ec2ff525110 ##############################
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_exportfits import exportfits as _exportfits_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 _exportfits:
15 """
16 exportfits ---- Convert a CASA image to a FITS file
19 CASA-produced images can be exported as FITS files for transporting to
20 other software packages or publication.
21 No subimaging of the fits image can be made with this task.
22 The spectral reference frame can be changed prior to export using the
23 task imreframe.
25 --------- parameter descriptions ---------------------------------------------
27 imagename Name of input CASA image
28 Default: none
30 Example: fitsimage='3C273XC1.image'
31 fitsimage Name of output image FITS file
32 Default: none
34 Example: fitsimage='3C273XC1.fits'
35 velocity Use velocity (rather than frequency) as spectral axis
36 Default: False
37 Options: False|True
38 optical Use the optical (rather than radio) velocity convention
39 Default: False
40 Options: False|True
41 bitpix Bits per pixel
42 Default: -32
44 Example: bitpix=16
45 minpix Minimum pixel value (if minpix > maxpix, value is automatically determined)
46 maxpix Maximum pixel value (if minpix > maxpix, value is
47 automatically determined)
48 Default: -1
49 overwrite Overwrite output file if it exists?
50 Default: False
51 Options: False|True
52 dropstokes Drop the Stokes axis?
53 stokeslast Put Stokes axis last in header?
54 Default: True
55 Options: True|False
56 history Write history to the FITS image?
57 Default: True
58 Options: True|False
59 dropdeg Drop all degenerate axes (e.g. Stokes and/or Frequency)?
60 Default: False
61 Options: False|True
63 --------- examples -----------------------------------------------------------
66 FOR MORE INFORMATION, SEE THE TASK PAGES OF EXPORTFITS IN CASA DOCS:
67 https://casa.nrao.edu/casadocs/
70 """
72 _info_group_ = """import/export"""
73 _info_desc_ = """Convert a CASA image to a FITS file"""
75 def __call__( self, imagename='', fitsimage='', velocity=False, optical=False, bitpix=int(-32), minpix=int(0), maxpix=int(-1), overwrite=False, dropstokes=False, stokeslast=True, history=True, dropdeg=False ):
76 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'fitsimage': {'type': 'cStr', 'coerce': _coerce.to_str}, 'velocity': {'type': 'cBool'}, 'optical': {'type': 'cBool'}, 'bitpix': {'type': 'cInt', 'allowed': [ -32, 16 ]}, 'minpix': {'anyof': [{'type': 'cInt'}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'maxpix': {'anyof': [{'type': 'cInt'}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'overwrite': {'type': 'cBool'}, 'dropstokes': {'type': 'cBool'}, 'stokeslast': {'type': 'cBool'}, 'history': {'type': 'cBool'}, 'dropdeg': {'type': 'cBool'}}
77 doc = {'imagename': imagename, 'fitsimage': fitsimage, 'velocity': velocity, 'optical': optical, 'bitpix': bitpix, 'minpix': minpix, 'maxpix': maxpix, 'overwrite': overwrite, 'dropstokes': dropstokes, 'stokeslast': stokeslast, 'history': history, 'dropdeg': dropdeg}
78 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
79 _logging_state_ = _start_log( 'exportfits', [ 'imagename=' + repr(_pc.document['imagename']), 'fitsimage=' + repr(_pc.document['fitsimage']), 'velocity=' + repr(_pc.document['velocity']), 'optical=' + repr(_pc.document['optical']), 'bitpix=' + repr(_pc.document['bitpix']), 'minpix=' + repr(_pc.document['minpix']), 'maxpix=' + repr(_pc.document['maxpix']), 'overwrite=' + repr(_pc.document['overwrite']), 'dropstokes=' + repr(_pc.document['dropstokes']), 'stokeslast=' + repr(_pc.document['stokeslast']), 'history=' + repr(_pc.document['history']), 'dropdeg=' + repr(_pc.document['dropdeg']) ] )
80 task_result = None
81 try:
82 task_result = _exportfits_t( _pc.document['imagename'], _pc.document['fitsimage'], _pc.document['velocity'], _pc.document['optical'], _pc.document['bitpix'], _pc.document['minpix'], _pc.document['maxpix'], _pc.document['overwrite'], _pc.document['dropstokes'], _pc.document['stokeslast'], _pc.document['history'], _pc.document['dropdeg'] )
83 except Exception as exc:
84 _except_log('exportfits', exc)
85 raise
86 finally:
87 task_result = _end_log( _logging_state_, 'exportfits', task_result )
88 return task_result
90exportfits = _exportfits( )