Skip to content

drpangloss.oifits_implaneia

Functions

OIFITS helper utilities for reading, plotting, and writing AMI products.

rad2mas(rad)

Convert radians to milliarcseconds.

GetWavelength(ins, filt)

Get wavelengths information from using instrument and filter informations.

Format_STAINDEX_V2(tab)

Converts sta_index to save oifits in the appropriate format.

Format_STAINDEX_T3(tab)

Converts sta_index to save oifits in the appropriate format.

ApplyFlag(data, unit='arcsec')

Apply flag and convert to the appropriate units.

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

Save dictionary formatted data into a proper OIFITS (version 2) format file.

Parameters:

Name Type Description Default
dic dict

Dictionary containing extracted OIFITS-compatible tables with keys such as OI_VIS2, OI_VIS, OI_T3, OI_WAVELENGTH, and info.

required
filename str

Output filename. If omitted, the name is derived from entries in dic["info"].

None
datadir str

Destination directory for the output file.

None
verbose bool

If True, print progress while writing tables.

False

Returns:

Type Description
None

Writes an OIFITS file to disk.

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, include visibility-amplitude and visibility-phase tables when available.

True

Returns:

Type Description
dict

Dictionary containing parsed OIFITS tables and metadata.

show(inputList, diffWl=False, vmin=0, vmax=1.05, cmax=180, setlog=False, unit='arcsec', unit_cp='deg')

Display visibility and closure-phase diagnostics for one or more datasets.

Parameters:

Name Type Description Default
inputList list or str or dict

Single input or list of inputs, where each item is either an OIFITS filename or a dictionary produced by load.

required
diffWl bool

If True, color-code points by wavelength/filter.

False
vmin float

Lower y-axis limit for visibility panel.

0
vmax float

Upper y-axis limit for visibility panel.

1.05
cmax float

Maximum absolute closure phase for plotting.

180
setlog bool

If True, use logarithmic scaling for visibility values.

False
unit str

Unit for spatial frequencies.

'arcsec'
unit_cp str

Unit label for closure phases.

'deg'

Returns:

Type Description
Figure

Figure containing UV, visibility, and closure-phase panels.

load_oifits(filename, directory)

Load a single OIFITS file and return flattened AMI-ready observables.

Parameters:

Name Type Description Default
filename str

OIFITS file name.

required
directory str

Directory containing the file.

required

Returns:

Type Description
tuple

(u, v, cp, cp_err, vis2, vis2_err, i_cps1, i_cps2, i_cps3) where baselines are converted to spatial frequencies using the effective wavelength.

cp_indices(vis_sta_index, cp_sta_index)

Extracts indices for calculating closure phase from visibility and closure phase station indices