oimData

Data for optical interferometry

Functions:

oimDataGetWl(data, array[, dwl])

Gets the wavelengths from the data.

oimGetDataValErrAndTypeFlag(table)

Get the data, error and flag arrays from the oifits data.

oimDataCheckData(table)

oimDataGetVectCoord(data, arr)

Get the (u, v)-coordinates from the data.

loadOifitsData(input[, mode])

Return the oifits data from either filenames, already opened oifts or a oimData boject as either a list of hdlulist (default) or as a oimData object using the option mode="oimData".

Classes:

oimDataType(value)

Data types for the oifits data.

oimData([dataOrFilename, filt])

A class to hold and manipulate data

oimodeler.oimData.oimDataGetWl(data: HDUList, array: BinTableHDU, dwl: bool = True) ndarray

Gets the wavelengths from the data.

Parameters:
  • data (astropy.io.fits.HDUList) – The data from which to get the wavelengths.

  • array (astropy.io.fits.BinTableHDU)

  • dwl (bool, optional)

Returns:

wavelengths

Return type:

numpy.ndarray

class oimodeler.oimData.oimDataType(value)

Data types for the oifits data.

NONE = 0
VIS2DATA = 1
VISAMP_ABS = 2
VISAMP_DIF = 4
VISAMP_COR = 8
VISPHI_ABS = 16
VISPHI_DIF = 32
T3AMP = 64
T3PHI = 128
FLUXDATA = 256
_generate_next_value_(start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the last value assigned or None

_boundary_ = 'keep'
_flag_mask_ = 511
_singles_mask_ = 511
_all_bits_ = 511
_inverted_ = None
oimodeler.oimData.oimGetDataValErrAndTypeFlag(table: BinTableHDU) Tuple[ndarray]

Get the data, error and flag arrays from the oifits data.

Parameters:

table (astropy.io.fits.BinTableHDU) – The table from which to get the data, error and flag arrays.

Returns:

  • dtype (oimDataType) – The type of the data.

  • val (numpy.ndarray) – The data array.

  • err (numpy.ndarray) – The error array.

  • flag (numpy.ndarray) – The flag array.

oimodeler.oimData.oimDataCheckData(table: BinTableHDU) List[str]
oimodeler.oimData.oimDataGetVectCoord(data: HDUList, arr: BinTableHDU) Tuple[ndarray]

Get the (u, v)-coordinates from the data.

Parameters:

data (astropy.io.fits.HDUList) – The data from which to get the (u, v)-coordinates.

Returns:

  • u (numpy.ndarray) – The u-coordinates.

  • v (numpy.ndarray) – The v-coordinates.

  • wl (numpy.ndarray) – The wavelengths.

  • dwl (numpy.ndarray) – The wavelength bandwidths.

  • mjd (numpy.ndarray) – The modified Julian dates.

  • nB (int) – The number of baselines.

  • nwl (int) – The number of wavelengths.

class oimodeler.oimData.oimData(dataOrFilename: Any | None = None, filt: oimDataFilter | None = None)

A class to hold and manipulate data

Parameters:
  • dataOrFilename (any) – The data to add. Can be a filename, a list of filenames, a hdulist or a list of hdulist.

  • filt (oimDataFilter, optional) – The filter to use. The default is None.

property data: None

Return the data.

addData(dataOrFilename, prepare: bool = True) None

Add data to the class.

Parameters:
  • dataOrFilename (any) – The data to add. Can be a filename, a list of filenames, a hdulist or a list of hdulist.

  • prepare (bool, optional) – Whether to prepare the data or not. The default is True.

removeData(dataOrIndex: Any) None

Remove either all data or specified data from the class.

Parameters:

dataOrIndex (any) – The data to remove. Can be a hdulist, a filename, a list of these or an index to remove.

setFilter(filt: oimDataFilter | None = None, useFilter: bool | None = True) None

Set the filter to use.

Parameters:
  • filt (oimDataFilter, optional) – The filter to use. The default is None.

  • useFilter (bool, optional) – Whether to use the filter or not. The default is True.

applyFilter() None

Apply the used filter(s) to the data.

property useFilter: None

Return whether the filter is used or not.

_analyzeOIFitFile(data: List[HDUList]) None

Analyze the oifits file and get the data info.

Parameters:

data (list of astropy.io.fits.HDUList) – The data to analyze.

info() None

print info on the oimData object

removeUselessArrays()
prepareData() None

Prepare the data for further analysis.

writeto(filename: str | Path | None = None, overwrite: bool = False, directory: str | Path | None = None) None

Write the data to a file.

Parameters:
  • filename (str or pathlib.Path, optional) – The filename to write the data to. The default is None.

  • overwrite (bool, optional) – Whether to overwrite the file or not. The default is False.

  • directory (str or pathlib.Path, optional) – The directory to write the data to. The default is None.

plot(xname: str, yname: str, axe: Axes | None = None, removeFilter: bool = False, savefig=None, **kwargs)

Plot the data contained in the oimData.

Parameters:
  • xname (str) – Name of the x-axis to be plotted: can be EFF_WAVE, SPAFREQ, LENGTH, PA, MJD …

  • yname (str) – Name of the y-axis to be plotted: for instance VIS2DATA, T3PHI, …

  • axe (Union[Axes, None], optional) – the maplotlib axe that should be used for the plot. The default is None.

  • removeFilter (TYPE, optional) – Plot unfiltered data if True. The default is False.

  • **kwargs (TYPE) – kwargs to be passed to the oiplot function.

Returns:

  • fig (TYPE) – The matplotlib figure.

  • axe (TYPE) – The matplotlib axe.

uvplot(axe: Axes | None = None, removeFilter: bool = False, savefig=None, **kwargs)
Parameters:
  • axe (Union[Axes, None], optional) – The matplotlib axe to be used for the plot. The default is None.

  • removeFilter (TYPE, optional) – Plot unfiltered data if True. The default is False.

  • **kwargs (TYPE) – kwargs to be passed to the uvplot function.

Returns:

  • fig (TYPE) – The matplotlib figure.

  • axe (TYPE) – The matplotlib axe.

oimodeler.oimData.loadOifitsData(input: str | Path | List[str] | List[Path] | HDUList | oimData, mode: str = 'listOfHdlulist') oimData

Return the oifits data from either filenames, already opened oifts or a oimData boject as either a list of hdlulist (default) or as a oimData object using the option mode=”oimData”.

Parameters:
  • input (string or pathlib.Path or list of str or list of pathlib.Path) – or astropy.io.fits.hdu.hdulist.HDUList or oimodeler.oimData The data to deal with. Can be a oimData object, a hdulist, a string representing a filename or a list of these kind of object

  • mode (str, optional) – The type of the return data, either “listOfHdlulist” or “oimData” The default is “listOfHdlulist”

Returns:

data

Return type:

.oimData