FITS-IDI utilities#
Reading, inspecting, validating, splitting, and updating FITS-IDI files.
Public interface#
|
|
|
read the table data using chunk, by default reads 1 row for the specified column. |
|
_summary_ |
|
|
|
|
|
|
|
To deal with all the ANTAB related tasks. |
|
|
|
Read standard keyin headers and TSYS rows, including fractional minutes. |
|
Calibration tables and ANTAB bands#
Preserve FITS-IDI calibration when replacing only part of an observation.
- avica.fitsidiutil.calibration.merge_calibration(old, new, reference_date=None)#
Replace matching gain rows or TSYS time spans, retaining other rows.
Keys include antenna, array and frequency ID. TSYS spans are computed from rows actually written by the importer, separately for each key. Incompatible schemas fail before the staged file can replace the working FITS file.
- avica.fitsidiutil.calibration.preserve_calibration(original, staged, has_gain)#
Validate and merge appended tables on a staging copy only.
Band-correct GAIN_CURVE from ANTABs that carry one GAIN line per band.
The vendored JIVE append_gc ignores FREQ= on GAIN lines: every GAIN line
becomes its own GAIN_CURVE row and its DPFU/POLY is copied to all IFs. KVN (and
avica’s own multi-band VLBA ANTAB) list one GAIN line per receiver band, so a
FITS-IDI file ends up with several conflicting rows per antenna.
band_gain_curve keeps append_gc unchanged: it runs it once per distinct IF
selection on a small copy of the FITS-IDI file (FITSIDI.save_as with one
UV_DATA row), feeding only the GAIN lines whose FREQ range contains those
IFs, then splices each IF slot from the matching run into one row per antenna.
Whenever the selection is not unique it returns None and the caller keeps the
plain append_gc result.
All FITS access here goes through avica.fitsidiutil (CFITSIO); only the vendored JIVE code uses astropy.
- class avica.fitsidiutil.antab_bands.AntabGroup(kind, antenna, text)#
Bases:
NamedTuple
- class avica.fitsidiutil.antab_bands.CalTable(name, columns, formats, units=<factory>, header=<factory>)#
Bases:
objectA binary table independent of any FITS library; vectors are rows-first 2-D arrays.
- Parameters:
- columns: Dict[str, numpy.ndarray]#
- property nrows#
- get(key, default=None)#
- avica.fitsidiutil.antab_bands.antab_groups(text)#
Split ANTAB text into keyin groups; a TSYS group keeps its rows up to the closing ‘/’.
- avica.fitsidiutil.antab_bands.if_centres_mhz(fitsfile, hdul=None)#
IF centre frequencies of FREQID 1, or None if the file has several FREQIDs.
- avica.fitsidiutil.antab_bands.make_skeleton(fitsfile, out)#
Copy of fitsfile with every HDU but a single UV_DATA row; enough for JIVE append_gc.
- avica.fitsidiutil.antab_bands.read_cal_table(fitsfile, name)#
Read one binary table into a CalTable, restoring integer columns from TFORM.
- avica.fitsidiutil.antab_bands.write_gain_curve(fitsfile, table)#
Replace (or append) GAIN_CURVE in place via fitsidiutil; later HDUs are shifted, not the file.
- avica.fitsidiutil.antab_bands.band_gain_curve(antabfile, fitsfile, append_gc, workdir=None)#
Return a band-correct GAIN_CURVE CalTable for fitsfile, or None.
None means the plain append_gc result is already right (at most one GAIN line per antenna) or the per-IF selection is not unique; the caller then keeps the existing behaviour. Unexpected failures also fall back.