Hi Guys,

   As part of the ALMA pipeline test, I used exportuvfits in order to
move the data into casa and aips for comparison with the pipeline.   It
is the old favorite spectral line data set for NGC7538.  Here are my
comments concerning exportuvfits.  The main problem is how much source
selection to put in exportuvfits.  It clearly is not doing the source
selection properly.  FITTP in AIPS does absolutely no selection: All
data selection is done before hand.  This might be a good model to use
to simplify exportuvfits.   Anyway, below are my comments and
suggestions.  I have suggested revisions to the help file for
exportuvfits which I hope are useful.

Cheers,  Ed

------------------------------------------------------------------------------------------
exportuvfits comments:

--Suggestion: The interaction of fieldid and field is unclear, at
least in this task.  Fieldid can take only one number.  Hence, this
parameter can not be used to write out more than one source.
Fieldid=-1 was invalid.  This seems like a logical choice to write out
all sources, but is not available.  Field='' in the above examples.
As far as I can tell, the only way to write out all sources is to set
in field all of the source names explicitly.  I don't know how field
and fieldid are treated in other tasks, but a simple scheme would be.

if field is not equal to '', then use fieldid with
  fieldid=-1  all fields
  fieldid=[0,1,2] fields 0,1,2 as an example.

if field is not blank, then ignore fieldid and use field

--BUG: If I try to limit writing the uvfits data for a source
subsection (either using fieldid or field), the writing seems to go
okay, but importuvfit and aips cannot read the data.  The relevant
error messages are:

FitsInput error:  File s11.uvfits Physical record 2215 logical record
22146 --
   [FitsInput::read_header_rec()]Error computing size of data.
Cannot find an AN Table. This is required.
BlockIO:  File s11.uvfits Physical record 2215 logical record 22146 --
   [~BlockIO()] Error closing file.

I think that the length of the uvfits file is not properly determined.

IF YOU WANT TO EMULATE FITTP IN AIPS (WHICH DOES NOT ALLOW SELECTION OF
SOURCES), THEN YOU MUST NOT HAVE FIELDID AND FIELD IN THIS TASK.  THIS
DATA SELECTION MUST BE MADE USING SPLIT.  IN FACT, FITTP ALSO DOES NOT
USE SP_ID and NCHAN, START, STEP.  ALL DATA SUB-SELECTION MUST BE DONE
BY SPLIT (UVCOP).  YOU MIGHT CONSIDER THIS FOR SIMPLICITY.

--BUG: The exportuvfits file header contains the position of fieldid=0
for a multi-source data set.  It should be set to 0 for ra and dec.

--BUG: If the source string in field is incorrect, it still writes out
the entire data set instead of reporting the syntax error.

-- I am writing uvfits files for the NGC7538 data used in the ALMA
pipeline tests.  Because SP0 has RR only and SP1 has LL only, SpwID
must be written out separately.  This make sense since UVFITS
definition does not include spectral windows with different
polarization products.  The data can be imported from the ALMA
pipeline data set for TST1, NGC7538

--BUG?: importuvfits seems to be a big memory hog.  Is this necessary?


====================================================================================

Below are suggest modifications for the exportuvfits 'help' file.
Numbers in parenthesis
refer to comments at the end


exportuvfits(vis=None, fitsfile=None, datacolumn=None, fieldid=None,
field=None, spwid=None, nchan=None, start=None, width=None,
writesyscal=None, multisource=None, combinespw=None, writestation=None)
(1)
   Convert a CASA visibility data set (MS) to a UVFITS file:
   The FITS file is always written in floating point format.
   Combinespw=True may be needed for the data to be read
   into AIPS.  Source selection is not included, but must be
   made using SPLIT. (think about this)
(2)

   Keyword arguments:
   vis -- Name of input visibility file (MS):
           default: None; example: vis='3C273XC1.ms'
   fitsfile -- Name of output UV FITS file:
           default: None; example='3C273XC1.fits'
   datacolumn -- Data column to write;
           default: 'corrected'; example: datacolumn='data'
           
   fieldid -- Field index number(s);
           default=-1; example: fieldid=[1,2].  fieldid=-1 means all
           Ignored with field is not ''.
(3)
   field -- Field name(s);
           default: '' means used fieldid
           To input multiple strings, enter a single string
           with spaces separating the field names.
           example: field='133',field='133 N5921'
           Minimum match can be made, and field names with
           blanks cannot be used.
   spwid -- Spectral window index identifier;
           default=-1; example: spwid=[1,2], spwid=-1 means all
(4)
   nchan -- Number of channels to select
           default: -1; example: nchan=45, nchan=-1 means all
   start -- Start channel;
           default=0; example: start=5
   width -- Channel width; (value > 1 indicates channel averaging)
           default=1; example: width=5
           example: nchan=5; start=6; width=3 means produce
           5 new channels, starting with channel with width 3
           new chan 1 = 6,7,8 averaged, new chan 2 = 9,10,11 averaged
(5)
   writesyscal -- Write GC and TY tables
           default=False; example: writesyscal=True
(6)
   multisource -- Write in multi-source format
           default=False; example: multisource=True
(7)
   combinespw -- Handle spectral window as IF
           default=False; example: combinespw=True
           AIPS may require this to be true
(8)
   writestation -- Write station name instead of antenna name
           default=False; example: writestation=True
(9)

Comments:

(1) The calling statement can be made more useful.  'None' gives
absolutely no information.  What about

exportuvfits(vis='S', fitsfile='S', datacolumn='S', fieldid=[N,M]
field='S T', spwid=[N,M}, nchan=N start=N, width=N, writesyscal=L,
multisource=L, combinespw=L, writestation=L)

'S' means a string
'S T' means an array of strings
 N  means an integer
 [N,M] means an array of integers
 L means a logical

I assume that this line is a simple string so that anything can be put
in it.  The above convention tells the user immediately what kind of
input parameters are accepted.

(2) I have assumed that we will get rid of source selection in this
task.  Isn't the data always the primary array in the FITS file?  Why
mention this?

(3) As mentioned above, fieldid needs expanding.  I have listed what I
think is a reasonable convention.  However, in this task it should be
removed, as well as field.

(4) Also suggested extended definition of spwid.  Or maybe, remove

(5) The use of nchan, start and width are unclear.  Added an example.
You could remove this as in FITTP.

(6) Is this necessary?  How will this be used.  Where are the tables in
casa?

(7) Can you write several single source files from a measurement set
with many sources?
If not, I'm not sure this option is necessary.  Automatically do single
source file
for one source, multisource file for more than one source.

(8) This is important if you want to read multi-IF data into AIPS.
Hence, it is mentioned
in the preamble also.

(9) Why is this needed?  exportuvfits should make the AN file that is
complete.

-- JosephMcMullin - 26 Jan 2007

This topic: Software > WebHome > LegacyCASA > 2007-Jan-26 > ExportuvfitsImprovements
Topic revision: 2007-01-26, JosephMcMullin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback