Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_exportfits.py: 40%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 17:39 +0000

1import os 

2 

3from casatools import image 

4from casatasks import casalog 

5 

6def exportfits( imagename, fitsimage, velocity, optical, bitpix, 

7 minpix, maxpix, overwrite, dropstokes, stokeslast, 

8 history, dropdeg ): 

9 """Convert a CASA image to a FITS file: 

10 CASA-produced images can be written to disk for transporting 

11 to other software packages. No subimaging of the fits image 

12 can be made with this task. 

13 

14 Keyword arguments: 

15 imagename -- Name of input CASA image 

16 default: none; example: imagename='3C273XC1.image' 

17 fitsimage -- Name of input image FITS file 

18 default: none; example='3C273XC1.fits' 

19 velocity -- Prefer velocity (rather than frequency) as spectral axis 

20 default: False 

21 optical -- Use the optical (rather than radio) velocity convention 

22 default: True; 

23 bitpix -- Bits per pixel 

24 default: -32 (floating point) 

25 <Options: -32 (floating point), 16 (integer)> 

26 minpix -- Minimum pixel value 

27 default: 0 (if minpix > maxpix, value is automatically determined) 

28 maxpix -- Maximum pixel value 

29 default: -1 (if minpix > maxpix, value is automatically determined) 

30 overwrite -- Overwrite pre-existing imagename 

31 default=False; example: overwrite=True 

32 dropstokes -- Drop the Stokes axis? 

33 default: False; example: dropstokes=True 

34 stokeslast -- Put the stokes axis last in header? 

35 default: True; example: stokeslast=False 

36 history -- write the image history into the FITS file? 

37 default: True 

38 dropdeg -- drop all degenerate axes (e.g. Stokes and/or Frequency)? 

39 default: False 

40 

41 """ 

42 

43 #Python script 

44 casalog.origin('exportfits') 

45 _myia = image( ) 

46 try: 

47 _myia.open(imagename) 

48 _myia.tofits( outfile=fitsimage, velocity=velocity, optical=optical, 

49 bitpix=bitpix, minpix=minpix, maxpix=maxpix, 

50 overwrite=overwrite, dropstokes=dropstokes, stokeslast=stokeslast, 

51 history=history, dropdeg=dropdeg ) 

52 finally: 

53 _myia.close( )