Skip to content

virgil.legacy

Legacy OIFITS tools derived from ImPlaneIA, working on its dictionary layout (phases in degrees). They are not imported by import virgil. New code should use virgil.oifits and OIData.

GetWavelength, Format_STAINDEX_V2, Format_STAINDEX_T3, rad2mas and the cp_indices re-export are deprecated: nothing in virgil uses them, and they warn with a FutureWarning and will be removed in virgil 0.6 (cp_indices lives in virgil.oidata).

Legacy OIFITS helpers from ImPlaneIA, for its dictionary layout.

:func:load reads an OIFITS file into an ImPlaneIA dictionary (info, OI_VIS, OI_VIS2, OI_T3, ...) and :func:save writes one, on top of virgil.oifits.write_oifits. Phases in these dictionaries are in degrees, as in OIFITS. New code should read files with OIData and plot them with plot_oidata_overview.

save(dic, filename=None, datadir=None, verbose=False)

Save an ImPlaneIA dictionary as an OIFITS2 file.

This is virgil.oifits.write_oifits plus the ImPlaneIA extras: the CTRS_EQT column and PSCALE/ISZ keywords in OI_ARRAY, a filename built from info, and target coordinates queried from SIMBAD.

Parameters:

Name Type Description Default
dic dict

ImPlaneIA dictionary with the tables OI_WAVELENGTH, OI_VIS, OI_VIS2 and OI_T3 and an info dict holding TARGET, INSTRUME, MASK, FILT and MJD, plus PSCALE (mas/pixel), ISZ and STAXY/CTRS_EQT (in info or an OI_ARRAY table). Phases are in degrees. dic is not modified.

required
filename str or PathLike

Output filename. If omitted, the name is built from TARGET, INSTRUME, MASK, FILT and MJD.

None
datadir str or PathLike

Destination directory (default "Saveoifits/"), created if needed.

None
verbose bool

If True, print the path written.

False
Notes

Unless info["TARGET"] is "UNKNOWN", the target's coordinates, proper motion, parallax and spectral type are queried from SIMBAD over the network (this needs astroquery).

load(filename, target=None, ins=None, mask=None, include_vis=True)

Load an OIFITS file into an internal dictionary representation.

Parameters:

Name Type Description Default
filename str

Name of the OIFITS file.

required
target str

Fallback target name if not present in headers.

None
ins str

Fallback instrument name if not present in headers.

None
mask str

Fallback mask name if not present in headers.

None
include_vis bool

If True (default), include the OI_VIS (visibility amplitude and phase) table when available.

True

Returns:

Type Description
dict

ImPlaneIA dictionary of the tables and metadata. Only the last table of each type is kept, and phases stay in degrees. To fit the data, use virgil.oidata.OIData on the file instead.

GetWavelength(ins, filt)

Return (wavelength, bandwidth) in metres for an instrument filter.

Only JWST NIRISS AMI filters (ins="JWST") are tabulated.

Deprecated: nothing in virgil uses this table.

Format_STAINDEX_V2(tab)

Return baseline station pairs as 1-based (n, 2) integers.

Zero-based indices (any 0 present) are shifted up by one.

Deprecated: nothing in virgil uses this helper.

Format_STAINDEX_T3(tab)

Return triangle station triplets as 1-based (n, 3) integers.

Zero-based indices (any 0 present) are shifted up by one.

Deprecated: nothing in virgil uses this helper.

rad2mas(rad)

Convert radians to milliarcseconds.

Deprecated: multiply by virgil._utils.rad2mas, or use astropy.units.