from __future__ import absolute_import
from casatasks.private.casa_transition import *
from casatools import ms, table
from casatasks import casalog
from .mstools import write_history
from taskinit import casalog
from taskinit import mstool as ms
from taskinit import tbtool as table
from mstools import write_history
def importfitsidi(fitsidifile,vis,constobsid=None,scanreindexgap_s=None,specframe=None):
"""Convert FITS-IDI visibility file into a CASA visibility file (MS).
fitsidifile -- Name(s) of input FITS IDI file(s)
default: None; example='3C273XC1.IDI' or ['3C273XC1.IDI1', '3C273XC1.IDI2']
vis -- Name of output visibility file (MS)
default: None; example: vis='3C273XC1.ms'
constobsid -- If True a constant obs id == 0 of is given to all input files
default = False (new obs id for each input file)
scanreindexgap_s -- if > 0., a new scan is started whenever the gap between two
integrations is > the given value (seconds) or when a new field starts
or when the ARRAY_ID changes.
default = 0. (no reindexing)
specframe -- this frame will be used to set the spectral reference frame
for all spectral windows in the output MS
default = GEO (geocentric), other options: TOPO, LSRK, BARY
NOTE: if specframe is set to TOPO, the reference location will be taken from
the Observatories table in the CASA data repository for the given name of
the observatory. You can edit that table and add new rows.
casalog.origin('importfitsidi')
if type(specframe)==str and not specframe=='':
myspecframe=specframe.upper()
refframes = {'REST': 0, 'LSRK': 1, 'LSRD': 2, 'BARY': 3, 'GEO': 4, 'TOPO': 5}
if myspecframe not in refframes:
raise ValueError('Value '+myspecframe+' of parameter specframe invalid. Possible values are REST, LSRK, LSRD, BARY, GEO, TOPO')
if(type(fitsidifile)==str):
casalog.post('### Reading file '+fitsidifile, 'INFO')
myms.fromfitsidi(vis,fitsidifile)