oimUtils

Various utilities for optical interferometry

Functions:

getDataTypeIsAnalysisComplex(dataType)

getDataArrname(dataType)

getDataType(dataArrname)

getDataTypeError(dataArrname)

loadOifitsData(something[, 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".

getBaselineName(oifits[, hduname, length, ...])

Gets the baseline names, i.e., telescopes names separated by minus sign, in an extension of a oifits file.

getConfigName(oifits[, hduname, extver, squeeze])

getBaselineLengthAndPA(oifits[, arr, ...])

Return a tuple (B, PA) of the baseline lengths and orientation (position angles) from a fits extension within an opened oifits file.

get2DSpaFreq(oifits[, arr, unit, extver, ...])

Parameters:
  • oifits (TYPE) -- DESCRIPTION.

getSpaFreq(oifits[, arr, unit, extver, squeeze])

Parameters:
  • oifits (TYPE) -- DESCRIPTION.

getWlFromOifits(oifits[, arr, extver, ...])

hdulistDeepCopy(hdulist)

cutWavelengthRange(oifits[, wlRange, addCut])

getWlFromFitsImageCube(header[, outputUnit])

Returns the wl law from a chromatic cube image in the fits format

_createOiTab(extname, keywords_def, ...)

createOiTarget(**kwargs)

createOiArray(**kwargs)

createOiWavelength(**kwargs)

createOiVis2(**kwargs)

createOiVis(**kwargs)

createOiT3(**kwargs)

createOiFlux(**kwargs)

createOiTargetFromSimbad(names)

shiftWavelength(oifits, shift[, verbose])

spectralSmoothing(oifits, kernsize[, ...])

_rebin(arr, binsize[, median])

_rebinHdu(hdu, binsize[, exception])

binWavelength(oifits, binsize[, normalizeError])

oifitsFlagWithExpression(data, arr, extver, expr)

computeDifferentialError(oifits[, ranges, ...])

setMinimumError(oifits, dataTypes, values[, ...])

oimodeler.oimUtils.getDataTypeIsAnalysisComplex(dataType)
oimodeler.oimUtils.getDataArrname(dataType)
oimodeler.oimUtils.getDataType(dataArrname)
oimodeler.oimUtils.getDataTypeError(dataArrname)
oimodeler.oimUtils.loadOifitsData(something, mode='listOfHdlulist')

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”. This Function is used in oimData and multiple plotting functions

Parameters:
  • something (astropy.io.fits.hdu.hdulist.HDUList, oimodeler.oimData, string, list) – 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”

oimodeler.oimUtils.getBaselineName(oifits, hduname='OI_VIS2', length=False, angle=False, extver=None, squeeze=True)

Gets the baseline names, i.e., telescopes names separated by minus sign, in an extension of a oifits file.

By default it is reading the ‘OI_VIS’ extension

Parameters:
  • oifits (astropy.io.fits.hdu.hdulist.HDUList) – An oifits file structure already opened with astropy.io.fits

  • hduname (str, optional) – The fits extension name. The default is “OI_VIS2”.

  • length (bool, optional) – Add baseline length to the returned result. The default is False.

  • angle (bool, optional) – Add baseline position angle ((in deg)à=) to the returned result. The default is False

Returns:

name – The array containing the baseline names (or triplet) and optionally the baseline length and orientation.

Return type:

python list of str

oimodeler.oimUtils.getConfigName(oifits, hduname='OI_VIS2', extver=None, squeeze=True)
oimodeler.oimUtils.getBaselineLengthAndPA(oifits, arr='OI_VIS2', extver=None, squeeze=True, returnUV=False)

Return a tuple (B, PA) of the baseline lengths and orientation (position angles) from a fits extension within an opened oifits file.

By default it is reading the OI_VIS extension.

Parameters:
  • oifits (astropy.io.fits.hdu.hdulist.HDUList) – An oifits file structure already opened with astropy.io.fits.

  • arr (str, optional) – The fits extension name. The default is “OI_VIS2”.

  • returnUV (bool) – if True also return the u,v coordinates in m the default is False

Returns:

  • B (numpy.ndarray) – the array containing the baselines length.

  • PA (numpy.ndarray) – the array containing the baselines orientation (in deg).

  • ucoord (numpy.ndarray) – the array containing the u coordinate (in m)(optional)

  • ucoord (numpy.ndarray) – the array containing the u coordinate (in m)(optional)

oimodeler.oimUtils.get2DSpaFreq(oifits, arr='OI_VIS2', unit=None, extver=None, squeeze=True)
Parameters:
  • oifits (TYPE) – DESCRIPTION.

  • arr (TYPE, optional) – DESCRIPTION. The default is “OI_VIS2”.

  • unit (TYPE, optional) – DESCRIPTION. The default is None.

Returns:

spaFreq – DESCRIPTION.

Return type:

TYPE

oimodeler.oimUtils.getSpaFreq(oifits, arr='OI_VIS2', unit=None, extver=None, squeeze=True)
Parameters:
  • oifits (TYPE) – DESCRIPTION.

  • arr (TYPE, optional) – DESCRIPTION. The default is “OI_VIS2”.

  • unit (TYPE, optional) – DESCRIPTION. The default is None.

Returns:

spaFreq – DESCRIPTION.

Return type:

TYPE

oimodeler.oimUtils.getWlFromOifits(oifits, arr='OI_VIS2', extver=None, returnBand=False)
oimodeler.oimUtils.hdulistDeepCopy(hdulist)
oimodeler.oimUtils.cutWavelengthRange(oifits, wlRange=None, addCut=[])
oimodeler.oimUtils.getWlFromFitsImageCube(header, outputUnit=None)

Returns the wl law from a chromatic cube image in the fits format

Parameters:
  • header (astropy.io.fits.header) – DESCRIPTION.

  • outputUnit (astropy.unit, optional) – If set convert the result to the proper unit. The default is None.

Returns:

wl – The wavelength in the given unit of the fits cube or the units specified by the user if outputUnit is set

Return type:

float

oimodeler.oimUtils._createOiTab(extname, keywords_def, colums_def, dataTypeFromShape, **kwargs)
oimodeler.oimUtils.createOiTarget(**kwargs)
oimodeler.oimUtils.createOiArray(**kwargs)
oimodeler.oimUtils.createOiWavelength(**kwargs)
oimodeler.oimUtils.createOiVis2(**kwargs)
oimodeler.oimUtils.createOiVis(**kwargs)
oimodeler.oimUtils.createOiT3(**kwargs)
oimodeler.oimUtils.createOiFlux(**kwargs)
oimodeler.oimUtils.createOiTargetFromSimbad(names)
oimodeler.oimUtils.shiftWavelength(oifits, shift, verbose=False)
oimodeler.oimUtils.spectralSmoothing(oifits, kernsize, cols2Smooth='all', normalizeError=True)
oimodeler.oimUtils._rebin(arr, binsize, median=True)
oimodeler.oimUtils._rebinHdu(hdu, binsize, exception=[])
oimodeler.oimUtils.binWavelength(oifits, binsize, normalizeError=True)
oimodeler.oimUtils.oifitsFlagWithExpression(data, arr, extver, expr, keepOldFlag=False)
oimodeler.oimUtils.computeDifferentialError(oifits, ranges=[[0, 5]], excludeRange=False, rangeType='index', dataType='VISPHI', extver=[None])
oimodeler.oimUtils.setMinimumError(oifits, dataTypes, values, extver=None)