Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_importuvfits.py: 90%
20 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
1import os
4from casatools import ms
5from casatasks import casalog
6from .mstools import write_history
8def importuvfits(fitsfile, vis, antnamescheme=None):
9 """
11 Convert a UVFITS file to a CASA visibility data set (MS):
13 Keyword arguments:
14 fitsfile -- Name of input UV FITS file
15 default = none; example='3C273XC1.fits'
16 vis -- Name of output visibility file (MS)
17 default = none; example: vis='3C273XC1.ms'
18 antnamescheme -- Naming scheme for VLA/JVLA/CARMA antennas
19 default = old;
20 old: Antenna name is a number, '04'
21 This option exists for backwards compatibility
22 but can lead to ambiguous results when antenna
23 indices are used for data selection.
24 new: Antenna name is not a number, 'VA04' or 'EA04'
25 With this scheme, data selection via
26 antenna names and indices is non-ambiguous.
27 default = false; do not run asychronously
30 """
31 myms = ms()
32 try:
33 casalog.origin('importuvfits')
34 casalog.post("")
35 myms.fromfits(vis, fitsfile, antnamescheme=antnamescheme)
36 myms.close()
38 # Write the args to HISTORY.
39 try:
40 param_names = importuvfits.__code__.co_varnames[:importuvfits.__code__.co_argcount]
41 vars = locals( )
42 param_vals = [vars[p] for p in param_names]
44 write_history(
45 myms, vis, 'importuvfits', param_names,
46 param_vals, casalog
47 )
48 except Exception:
49 casalog.post("Failed to updated HISTORY table", 'WARN')
51 finally:
52 if (myms):
53 #myms.close()
54 del myms