Package: pyoifits
Brief introPurposeRead and manipulate Optical Interferometry FITS files version 1 and 2.For a definition of the standardsversion 2: Duvert at al. (2017), A&A 597, A8 (abstract) (pre-print)version 1: Pauls et al. (2005), PASP 117, 1255 (abstract) (pre-print)InstallationIt is packaged aspyoifits.Site-wide installation will be performed withsudo -H pip3 install pyoifitson unix-like systems. At a user level, within avirtual environment,pip3 install pyoifits.Short exampleRead and merge to OIFITS datasets and tranform to a standardastropytable.importpyoifitsasoifitsdata=oifits.openlist(['file1.fits','file2.fits'])tab,corr=data.to_table(correlations='numpy')obs=tab['observable']x=tab['value']dx=tab['error']cov=corr*np.outer(dx,dx)There is also a shortdemo.Classes and functionsClassesClasses are inastropy.io.fitstree, they derive either fromHDUList(FITS file) orBinTableHDU(FITS table).  The end user shouldn't need to manipulate them explicitly as helper functions are provided.AnOIFITS1object (OIFITS standard version 1, <_OIFITS<astropy.io.fits.HDUList) containsonePrimaryHDU1object (<astropy.io.fits.PrimaryHDU)several_OITableHDU1objects (abstract OI table class, <_OITableHDU<astropy.io.fits.BinTableHDU) which can be of the derived typesTargetHDU1(OI_TARGETextrension)ArrayHDU1(OI_ARRAYextension)WavelengthHDU1(OI_WAVELENGTHextension, <astropy.io.fits.BinTableHDU)_DataHDU1(abstract data class, <astropy.io.fits.BinTableHDU)VisHDU1(OI_VISextension)Vis2HDU1(OI_VIS2extension)T3HDU1(OI_T3extension)any other FITS extensionAnOIFITS2object (OIFITS standard version 2, <_OIFITS<astropy.io.fits.HDUList) containsonePrimaryHDU2object (<astropy.io.fits.PrimaryHDU)several_OITableHDU2(abstract OI table class, <_OITableHDU<astropy.io.fits.BinTableHDU) which can be of the derived typesTargetHDU2(OI_TARGETextension)ArrayHDU2(OI_ARRAYextension)WavelengthHDU2(OI_WAVELENGTHextension)_DataHDU2(abstract data class)VisHDU2(OI_VISextension)Vis2HDU2(OI_VIS2extension)T3HDU2(OI_T3extension)FluxHDU1(OI_FLUXextension)CorrHDU1(OI_CORRextension)InspolHDU1(OI_INSPOLextension)any other FITS extensionFunctionsReading and manipulating OIFITSopen(open an OIFITS file)openlist(open a list of files and merge them)merge(merge several OIFITS)set_merge_settings(determine how duplicate targets/stations are merged)Creating OI tables from scratchnew_target_hdu(create anOI_TARGETextension)new_target_hdu_from_simbadnew_array_hdu(create anOI_ARRAYextension)new_wavelength_hdu(create anOI_WAVELENGTHextension)new_vis_hdu(create anOI_VISextension)new_vis2_hdu(create anOI_VIS2extension)new_t3_hdu(create anOI_T3extension)new_flux_hdu(create anOI_FLUXextension)Methods_OIFITS(OIFITS1andOIFITS2)manipulationbin_spectral_channels(downgrade spectral resolution)trim(keep only wavelengths, targets, instruments, ... of interest)to_table(transform to a table with one scalar observable per line)to_version(transform between versions of the OIFITS standard)visualisationvisualize(quick plot)data updatingverify(check standard compliance and mend if possible)update_primary_header(update primary header using the info in other tables)update_uv(compute spatial frequencies using array data)contents listingget_OITableHDUsget_targetHDUget_arrayHDUs&get_arrayHDUget_wavelengthHDUs&get_wavelengthHDUget_dataHDUsget_visHDUsget_vis2HDUsget_t3HDUs(OIFITS2only)get_corrHDUs&get_corrHDU(OIFITS2only)get_fluxHDUs(OIFITS2only)get_inspolHDUs&get_inspolHDU_DataHDU(all classes containing OI data)target informationget_targetget_decget_raget_equinoxget_parallaxget_pmraget_pmdecget_rvget_skycoordget_spectypewavelength and spatial frequency informationget_waveget_bandget_uvget_uvwarray informationget_locationget_sta_nameget_staenuget_stauvwget_staxyzget_sta_configget_tel_nameget_tel_configpolarisation information(_DataHDU2only)get_jones_matrixDirect data accessEach column of the OI FITS standard can be directly accessed via its standard
name, for instance,h.UCOORDorh.VIS2DATAare synonyms toh.data['UCOORD']andh.data['VIS2DATA'], respectively.Related projectsoifitsreads an OIFITS file into a table, geared towards the Event Horizon Telescopeoifitsreads and write OIFITS v. 1, mostly geared towards VLTI/MATISSEpyhdusthas a read/write module for OIFITS version 1Release notes0.4New features:Methodto_table()optionally returns a correlation matrix
GG0.4.1Bug fixes:WAVELMIN&WAVELMAXFITS keywords have a correct number of significant digitsEQUINOXFITS keyword now passes verificationNo runtime error when a duplicateINSNAMEhas to be renamedOI data (OI_VIS,OI_VIS2,OI_T3,OI_FLUX) tables merge correctlyOI_VIStables with differentPHITYP,AMPTYP,AMPORDER, orPHIORDERcan no longer be mergedOI_FLUXtables with differentFOVorFOVTYPEcan not longer be mergedNew features:OIFITS1&OIFITS2classes haveget_visHDUs,get_vis2HDUs,get_T3HDUsmethods0.4.2New features:Methodto_table()allows the user to restrict to a subset of target names,
instrument setup names, arrays, wavelength range, and/or date rangeOIFITS classes have new methodvisualize()to plot an interferometric
observable as a function of time, baseline length, or spatial frequency.0.4.3Bug fixes:Successive column renamings no longer lead toKeyErrorfixget_uvTypos in this docNew features:Methodbin_spectral_channels(R)allows the user to rebin to a given spectral resolution.0.4.4DocumentationFixed numerous bugs inget_jones_matrixandInspolHDU10.4.5Bug fixesFixed error in creation ofFluxHDUandT3HDUusingfrom_dataFixed error in creation of OI tables with non-standard columns usingfrom_dataTypos in documentationNew featuresNew functiontrim()to keep only wavelengths, instruments, instrumental setups, arrays, targets of interest0.4.6.Bug fixesFixedTDIM=1 keyword error whentrim()yields N×1 dataFixed an issue withastroqueryreturningstrinstead ofbytes0.4.7Bug fixesFixed float format forSTAXYZcolumn inArrayHDUextensionverify()can now fix strictly negative errorsduplicate fits warnings inverify()are now printedTestingA quick test ofverify()on a set of JMMC/aspro-generated OIFITS0.4.8Bug fixesto_version()now runsverify()to produce valid OIFITS if possibleA quick test ofto_version()0.4.9Bug fixesOIFITS version 2 verification
**verify()now replaces zero and negativeTARGET_IDinstead of throwing an error
**verify()now masks values and errors (with NULL=NaN) when errors are strictly negative or NULL
** primary header of single-target observations deduces more keywords from data HDUs (BASE_MIN,VIS2ERR,NUM_CHAN, etc.)0.4.10New functions
**new_primary_headerto create a primary headerBug fixes
**verify()now replaces zero and negativeSTA_INDEXfor OITITS2.