oimUtils

Various utilities for optical interferometry

Functions:

attach_methods(functions)

Class decorator that attaches function(s) to a class as methods.

_pickle(self, f, **kwargs)

Save the pickled representation of the object into an already open file or opens a file from a string or pathlib.Path.

_unpickle(cls, f, **kwargs)

Read the pickled representation from an open file or reads a string or pathlib.Path into a file to return the reconstituted object.

load_toml(toml_file)

Loads a toml file into a dictionary.

getDataTypeIsAnalysisComplex(dataType)

Get the data type and if it is complex.

getDataArrname(dataType)

Returns the dataArrname for a given datatype.

getDataType(dataArrname)

Returns the datatype for a given dataArrname.

getDataTypeError(dataArrname)

Returns the error datatype for a given dataArrname.

compare_angles(phi, psi)

Subtracts two angles and makes sure the are between -π and +π.

blackbody(temperature[, nu])

Planck's law in CGS.

compute_intensity(wavelengths, temperature)

Calculates the blackbody_profile via Planck's law and the emissivity_factor for a given wavelength, temperature- and dust surface density profile.

compute_photometric_slope(data, temperature)

Computes the photometric slope of the data from the effective temperature of the star.

pad_image(image[, padfact])

Pads an image with additional zeros for Fourier transform.

get_next_power_of_two(number)

Returns the next power of two for an integer or float input.

angular_to_linear(radius, distance)

Converts angular radius, using the object's distance, to linear radius.

linear_to_angular(radius, distance)

Converts linear radius, using the object's distance, to angular radius.

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])

Gets the configuration names in an extension of a oifits file.

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, ...])

Get the spatial two dimensional frequencies.

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

Get the spatial dimensional frequencies.

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

Get the wavelength

hdulistDeepCopy(hdulist)

Deep copy of a fits HDUList.

cutWavelengthRange(oifits[, wlRange, addCut])

Cut the wavelength range of an oifits file.

getWlFromFitsImageCube(header[, outputUnit])

Returns the wavelength law from a chromatic cube image in the fits format.

_createOiTab(extname, keywords_def, ...)

Create a OIFITS table from a dictionary of data.

createOiTarget(**kwargs)

Create a OI_TARGET table from a dictionary of data.

createOiArray(**kwargs)

Create a OI_ARRAY table from a dictionary of data.

createOiWavelength(**kwargs)

Create a OI_WAVELENGTH table from a dictionary of data.

createOiVis(**kwargs)

Create a OI_VIS table from a dictionary of data.

createOiVis2(**kwargs)

Create a OI_VIS2 table from a dictionary of data.

createOiT3(**kwargs)

Create a OI_T3 table from a dictionary of data.

createOiFlux(**kwargs)

Create a OI_FLUX table from a dictionary of data.

createOiTargetFromSimbad(names)

Create a OI_TARGET table from a dictionary of data.

shiftWavelength(oifits, shift[, verbose])

Shift the wavelength of an oifits file.

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

Smooth the spectral data of an oifits file.

_intpBinning(array, binMasks, binEdgeValues)

Interpolates the edges of the binning window and bins all values in the mask.

_interpolateBinHDU(hdu, binGrid, binMasks, ...)

Bin an HDU via interpolation.

intpBinWavelength(oifits, binGrid, **kwargs)

Bin the wavelength of an oifits file.

rebin_image(image[, binning_factor, rdim])

Bins a 2D-image down according.

_rebin(array, binsize[, median, circular])

Rebin an array.

_rebinHDU(hdu, binsize[, exception])

Rebin an HDU.

binWavelength(oifits[, binsize, normalizeError])

Bin the wavelength of an oifits file.

oifitsFlagWithExpression(data, arr, extver0, ...)

Flag the data with an expression.

oifitsKeepBaselines(data, arr, baselines_to_keep)

oifitsRemoveBaselines(data, arr, ...[, ...])

oifitsKeepTelescopes(data, arr, ...[, ...])

oifitsRemoveTelescopes(data, arr, ...[, ...])

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

Compute the differential error.

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

Set the minimum error of a given data type to a given value.

_listFeatures(baseClass, featureToTextFunction)

listComponents([details, save2csv, ...])

listDataFilters([details, save2csv])

listFitters([details, save2csv])

listParamInterpolators([details, save2csv])

windowed_linspace(start, end, window)

Creates bins centred around points with half-window spacing on each side.

colorPrint(text, color)

oimWarning(myclass, warningName, text[, color])

oimAckWarning(myclass, text)

Classes:

_terminalColor()

oimodeler.oimUtils.attach_methods(functions: Callable | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | Dict[str, Callable]) Callable

Class decorator that attaches function(s) to a class as methods.

oimodeler.oimUtils._pickle(self, f: str | Path | BufferedWriter, **kwargs) None

Save the pickled representation of the object into an already open file or opens a file from a string or pathlib.Path.

oimodeler.oimUtils._unpickle(cls, f: Path | TextIOWrapper, **kwargs) object

Read the pickled representation from an open file or reads a string or pathlib.Path into a file to return the reconstituted object.

oimodeler.oimUtils.load_toml(toml_file: Path) Dict[str, Any]

Loads a toml file into a dictionary.

oimodeler.oimUtils.getDataTypeIsAnalysisComplex(dataType: str) str

Get the data type and if it is complex.

oimodeler.oimUtils.getDataArrname(dataType: str) str

Returns the dataArrname for a given datatype.

oimodeler.oimUtils.getDataType(dataArrname: str) List[str]

Returns the datatype for a given dataArrname.

oimodeler.oimUtils.getDataTypeError(dataArrname: str) List[str]

Returns the error datatype for a given dataArrname.

oimodeler.oimUtils.compare_angles(phi: float, psi: float) float

Subtracts two angles and makes sure the are between -π and +π.

oimodeler.oimUtils.blackbody(temperature: float, nu: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None) ndarray

Planck’s law in CGS.

Parameters:
  • temperature (float or numpy.typing.ArrayLike) – The temperature (K).

  • nu (float or numpy.typing.ArrayLike, optional) – The frequency (Hz).

Returns:

blackbody – The blackbody (erg / (cm² s Hz sr)).

Return type:

np.ndarray

oimodeler.oimUtils.compute_intensity(wavelengths: Unit('um'), temperature: Unit('K'), pixel_size: float | None = None) ndarray

Calculates the blackbody_profile via Planck’s law and the emissivity_factor for a given wavelength, temperature- and dust surface density profile.

Parameters:
  • wavelengths (astropy.units.um) – Wavelength value(s).

  • temp_profile (astropy.units.K) – Temperature profile.

  • pixSize (float, optional) – The pixel size [rad].

Returns:

intensity – Intensity per pixel.

Return type:

numpy.ndarray

oimodeler.oimUtils.compute_photometric_slope(data: ndarray, temperature: Unit('K')) ndarray

Computes the photometric slope of the data from the effective temperature of the star.

Parameters:
  • data (oimData.oimData) – The observed data.

  • temperature (astropy.units.K) – The effective temperature of the star.

Returns:

photometric_slope

Return type:

numpy.ndarray

oimodeler.oimUtils.pad_image(image: ndarray, padfact: int | float | None = None) ndarray

Pads an image with additional zeros for Fourier transform.

Parameters:
  • image (numpy.ndarray) – The image to be padded.

  • Results

  • ——-

  • padded_image (numpy.ndarray) – The padded image.

oimodeler.oimUtils.get_next_power_of_two(number: int | float) int

Returns the next power of two for an integer or float input.

Parameters:

number (int or float) – An input number.

Returns:

closest_power_of_two – The, to the input, closest power of two.

Return type:

int

oimodeler.oimUtils.angular_to_linear(radius: float | ndarray, distance: float) float | ndarray

Converts angular radius, using the object’s distance, to linear radius.

Parameters:
  • radius (float or numpy.ndarray) – The (angular) radius of the object (arcsec/”).

  • distance (float) – The object’s distance to the observer (pc).

Returns:

radius – The radius of the object around the star (au).

Return type:

float or numpy.ndarray

Notes

The formula for the angular diameter (in small angle approximation) is

\[\delta = \frac{d}{2D}\]

where d is the linear diameter from the star and D is the distance from the star to the observer and ..math::delta is the angular diameter.

oimodeler.oimUtils.linear_to_angular(radius: float | ndarray, distance: float) float | ndarray

Converts linear radius, using the object’s distance, to angular radius.

Parameters:
  • radius (float or numpy.ndarray) – The (linear) radius of the object (au).

  • distance (float) – The star’s distance to the observer (pc).

Returns:

radius – The radius of the object around the star (arcsec/”).

Return type:

float or numpy.ndarray

Notes

The formula for the angular diameter small angle approximation is

\[\delta = \frac{d}{D}\]

where d is the distance from the star and D is the distance from the star to the observer and ..math::delta is the angular diameter.

oimodeler.oimUtils.getBaselineName(oifits: HDUList, hduname: str = 'OI_VIS2', length: bool = False, angle: bool = False, extver: int | None = None, squeeze: bool = True) List[str]

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.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

  • extver (int, optional) – The extension version. The default is None.

  • squeeze (bool, optional) – If True and only one extension is found, the result is squeezed.

Returns:

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

Return type:

list of str

oimodeler.oimUtils.getConfigName(oifits: HDUList, hduname: str = 'OI_VIS2', extver: int | None = None, squeeze: bool = True) List[str]

Gets the configuration names in an extension of a oifits file.

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

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

  • extver (int, optional) – The extension version. The default is None.

  • squeeze (bool, optional) – If True and only one extension is found, the result is squeezed.

  • Results

  • ——-

  • names (list of str) – The array containing the configuration names.

oimodeler.oimUtils.getBaselineLengthAndPA(oifits: HDUList, arr: str = 'OI_VIS2', extver: int | None = None, squeeze: bool = True, returnUV: bool = False, T3Max: bool = False, showFlagged: bool = True) Tuple[ndarray]

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.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, optional) – 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: HDUList, arr: str = 'OI_VIS2', unit: str | None = None, extver: int | None = None, squeeze: bool = True) Tuple[ndarray]

Get the spatial two dimensional frequencies.

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

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

  • unit (str, optional) – The unit of the spatial frequency. The default is None.

  • extver (int, optional) – The extension version. The default is None.

  • squeeze (bool, optional) – If True and only one extension is found, the result is squeezed.

Returns:

spaFreq

Return type:

tuple of numpy.ndarray

oimodeler.oimUtils.getSpaFreq(oifits: HDUList, arr: str = 'OI_VIS2', unit: str | None = None, extver: int | None = None, squeeze: bool = True) Tuple[ndarray]

Get the spatial dimensional frequencies.

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

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

  • unit (str, optional) – The unit of the spatial frequency. The default is None.

  • extver (int, optional) – The extension version. The default is None.

  • squeeze (bool, optional) – If True and only one extension is found, the result is squeezed.

Returns:

spaFreq

Return type:

tuple of numpy.ndarray

oimodeler.oimUtils.getWlFromOifits(oifits: HDUList, arr: str = 'OI_VIS2', extver: int | None = None, returnBand: bool = False) Tuple[ndarray]

Get the wavelength

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

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

  • unit (str, optional) – The unit of the spatial frequency. The default is None.

  • extver (int, optional) – The extension version. The default is None.

  • returnBand (bool, optional) – If True return the bandwith. The default is False.

Returns:

  • wavelength (numpy.ndarray) – The wavelength.

  • dwl (numpy.ndarray) – The bandwith.

oimodeler.oimUtils.hdulistDeepCopy(hdulist: HDUList) HDUList

Deep copy of a fits HDUList.

oimodeler.oimUtils.cutWavelengthRange(oifits: HDUList, wlRange: List[float] | None = None, addCut: List[float] = []) HDUList

Cut the wavelength range of an oifits file.

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

  • wlRange (list of float, optional) – The wavelength range to keep. The default is None.

  • addCut (list of float, optional) – Additional columns to cut. The default is [].

Returns:

data – The new oifits file with the cut wavelength range.

Return type:

fits.HDUList

oimodeler.oimUtils.getWlFromFitsImageCube(header: Header, outputUnit: str | None = None) float

Returns the wavelength law from a chromatic cube image in the fits format.

Parameters:
  • header (astropy.io.fits.header) – The header of the fits cube.

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

Returns:

wavelength – The wavelength in the given unit of the fits cube or the user-specified if outputUnit is set.

Return type:

float

oimodeler.oimUtils._createOiTab(extname: str, keywords_def: Tuple[Any], colums_def: Tuple[Any], dataTypeFromShape: str, **kwargs) BinTableHDU

Create a OIFITS table from a dictionary of data.

Parameters:
  • extname (str) – The extension name.

  • keywords_def (tuple of any) – The keywords definition.

  • colums_def (tuple of any) – The columns definition.

  • dataTypeFromShape (str) – The key in kwargs to get the data type from.

Returns:

hdu

Return type:

astropy.io.fits.BinTableHDU

oimodeler.oimUtils.createOiTarget(**kwargs)

Create a OI_TARGET table from a dictionary of data.

oimodeler.oimUtils.createOiArray(**kwargs)

Create a OI_ARRAY table from a dictionary of data.

oimodeler.oimUtils.createOiWavelength(**kwargs)

Create a OI_WAVELENGTH table from a dictionary of data.

oimodeler.oimUtils.createOiVis(**kwargs)

Create a OI_VIS table from a dictionary of data.

oimodeler.oimUtils.createOiVis2(**kwargs)

Create a OI_VIS2 table from a dictionary of data.

oimodeler.oimUtils.createOiT3(**kwargs)

Create a OI_T3 table from a dictionary of data.

oimodeler.oimUtils.createOiFlux(**kwargs)

Create a OI_FLUX table from a dictionary of data.

oimodeler.oimUtils.createOiTargetFromSimbad(names: str | List[str]) BinTableHDU

Create a OI_TARGET table from a dictionary of data.

Parameters:
  • names (str or list of str) – The name of the targets.

  • Results

  • ——-

  • hdu (astropy.io.fits.BinTableHDU)

oimodeler.oimUtils.shiftWavelength(oifits: HDUList, shift: float, verbose: bool = False) None

Shift the wavelength of an oifits file.

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

  • shift (float) – The wavelength shift to apply.

  • verbose (bool, optional) – If True print the tables index. The default is False.

oimodeler.oimUtils.spectralSmoothing(oifits: HDUList, kernel_size: float, cols2Smooth: str | List[str] = 'all', normalizeError: bool = True) None

Smooth the spectral data of an oifits file.

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

  • kernel_size (float) – The kernel size.

  • cols2Smooth (str or list of str, optional) – The columns to smooth. The default is “all”.

  • normalizeError (bool, optional) – If True normalize the error. The default is True.

oimodeler.oimUtils._intpBinning(array: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], binMasks: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], binEdgeValues: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, nSpecChannels: float = 1.0, circular: bool = False, **kwargs) _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]

Interpolates the edges of the binning window and bins all values in the mask.

Parameters:
  • array (array_like) – The pre-bin values.

  • binMasks (array_like) – Mask of the old grid for the bins.

  • binEdgeValues (array_like) – The interpolated values at the edge of the bins.

  • values (array_like, optional) – If provided will treat the “array” as errors and use the values for error propagation. Default is “None”.

  • spectralChannels (int, optional) – The number of channels of the set bin resolution. Will be used to calculate the divisor within the error propagation. Default is 1.0.

    \[divisor = bin_elements / spectralChannels\]
  • circular (bool, optional) – If True, treats the values periodically. Default is “False”.

Returns:

binned_values

Return type:

array_like

oimodeler.oimUtils._interpolateBinHDU(hdu: BinTableHDU, binGrid: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], binMasks: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], binEdgeGrid: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], grid: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], exception: List[str] = [], **kwargs) BinTableHDU

Bin an HDU via interpolation.

Parameters:
  • hdu (astropy.io.fits.BinTableHDU) – The HDU to rebin.

  • binGrid (array_like) – The binned grid.

  • binMasks (array_like) – The masks for the bin contents.

  • binEdgeGrid (array_like) – The window edges of the binned grid.

  • grid (array_like) – The pre-bin grid.

  • exception (list of str) – The exceptions.

  • spectralChannels (int, optional) – The number of channels of the set bin resolution. Will be used to calculate the divisor within the error propagation. Default is 1.0.

    \[divisor = bin_elements / spectralChannels\]
Returns:

newhdu – The rebinned HDU.

Return type:

astropy.io.fits.BinTableHDU

oimodeler.oimUtils.intpBinWavelength(oifits: HDUList, binGrid: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], **kwargs) None

Bin the wavelength of an oifits file.

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

  • binGrid (array_like) – The binned wavelength grid.

  • binWindow (array_like, optional) – The bin windows that correspond to the binGrid elements. If None, computes the bin windows from the distance between two elements in the binGrid. Default is None.

  • resetFlags (bool, optional) – If True, resets the flags after binning. Default is True.

  • averageError (bool, optional) – If True, forgoes error propagation and simply averages the errors for each bin. Default is False.

  • spectralChannels (int, optional) – The number of channels of the set bin resolution. Will be used to calculate the divisor within the error propagation. Default is 1.0.

    \[divisor = bin_elements / spectralChannels\]
oimodeler.oimUtils.rebin_image(image: ndarray, binning_factor: int | None = None, rdim: bool = False) ndarray

Bins a 2D-image down according.

The down binning is according to the binning factor in oimOptions.ft.binning. Only accounts for square images.

Parameters:
  • image (numpy.ndarray) – The image to be rebinned.

  • binning_factor (int, optional) – The binning factor. The default is 0

  • rdim (bool) – If toggled, returns the dimension

Returns:

  • rebinned_image (numpy.ndarray) – The rebinned image.

  • dimension (int, optional) – The new dimension of the image.

oimodeler.oimUtils._rebin(array: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], binsize: int, median: bool = True, circular: bool = False) _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]

Rebin an array.

Parameters:
  • array (numpy.ndarray) – The array to rebin.

  • binsize (int, optiona) – The bin size.

  • median (bool, optional) – If True return the median.

  • circular (bool, optional) – Treats the data as periodic if toggled.

Returns:

res – The rebinned array.

Return type:

numpy.ndarray

oimodeler.oimUtils._rebinHDU(hdu: BinTableHDU, binsize: int, exception: List[str] = []) BinTableHDU

Rebin an HDU.

Parameters:
  • hdu (astropy.io.fits.BinTableHDU) – The HDU to rebin.

  • binsize (int) – The bin size.

  • exception (list of str) – The exceptions.

Returns:

newhdu – The rebinned HDU.

Return type:

astropy.io.fits.BinTableHDU

oimodeler.oimUtils.binWavelength(oifits: HDUList, binsize: int | None = None, normalizeError: bool = True) None

Bin the wavelength of an oifits file.

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

  • binsize (int, optional) – The bin size.

  • normalizeError (bool, optional) – If True normalize the error.

oimodeler.oimUtils.oifitsFlagWithExpression(data, arr, extver0, expr, keepOldFlag: bool = False)

Flag the data with an expression.

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

  • arr (str or list of str) – The fits extension name.

  • extver (int) – The extension version.

  • expr (str) – The expression to evaluate.

  • keepOldFlag (bool) – If True keep the old flag.

Returns:

flags – The flags.

Return type:

numpy.ndarray

oimodeler.oimUtils.oifitsKeepBaselines(data, arr, baselines_to_keep, extver=None, keepOldFlag: bool = True)
oimodeler.oimUtils.oifitsRemoveBaselines(data, arr, baselines_to_remove, extver=None, keepOldFlag: bool = True)
oimodeler.oimUtils.oifitsKeepTelescopes(data, arr, telescopes_to_keep, extver=None, keepOldFlag: bool = True)
oimodeler.oimUtils.oifitsRemoveTelescopes(data, arr, telescopes_to_remove, extver=None, keepOldFlag: bool = True)
oimodeler.oimUtils.computeDifferentialError(oifits: HDUList, ranges: List[int] = [[0, 5]], excludeRange: bool = False, rangeType: str = 'index', dataType: str = 'VISPHI', extver: List[int | None] = [None]) None

Compute the differential error.

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

  • ranges (list of int, optional) – The ranges to compute the differential error. The default is [[0, 5]].

  • excludeRange (bool, optional) – If True exclude the range. The default is False.

  • rangeType (str, optional) – The range type. The default is “index”.

  • dataType (str, optional) – The data type. The default is “VISPHI”.

  • extver (list of int, optional) – The extension version. The default is [None].

oimodeler.oimUtils.setMinimumError(oifits: HDUList, dataTypes: str | List[str], values: float | List[float], extver: int | List[int] | None = None) None

Set the minimum error of a given data type to a given value.

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

  • dataTypes (str or list of str) – The data types.

  • values (float or list of float) – The minimum error value.

  • extver (int or list of int, optional) – The extension version. The default is None.

oimodeler.oimUtils._listFeatures(baseClass, featureToTextFunction, details: bool = False, save2csv: bool = False, header=None)
oimodeler.oimUtils.listComponents(details: bool = False, save2csv: bool = False, componentType: str = 'all')
oimodeler.oimUtils.listDataFilters(details: bool = False, save2csv: bool = False)
oimodeler.oimUtils.listFitters(details: bool = False, save2csv: bool = False)
oimodeler.oimUtils.listParamInterpolators(details: bool = False, save2csv: bool = False)
oimodeler.oimUtils.windowed_linspace(start: float, end: float, window: float) ndarray

Creates bins centred around points with half-window spacing on each side.

Parameters:
  • start (float) – Centre of the first bin.

  • end (float) – Centre of the last bin.

  • window (float) – Total width of each bin.

Returns:

bin_array

Return type:

array_like

class oimodeler.oimUtils._terminalColor
BACKGROUND_BLACK = '\x1b[40m'
BACKGROUND_RED = '\x1b[41m'
BACKGROUND_GREEN = '\x1b[42m'
BACKGROUND_YELLOW = '\x1b[43m'
BACKGROUND_BLUE = '\x1b[44m'
BACKGROUND_MAGENTA = '\x1b[45m'
BACKGROUND_CYAN = '\x1b[46m'
BACKGROUND_LIGHT_GRAY = '\third-party033[47m'
BACKGROUND_DARK_GRAY = '\x1b[100m'
BACKGROUND_BRIGHT_RED = '\x1b[101m'
BACKGROUND_BRIGHT_GREEN = '\x1b[102m'
BACKGROUND_BRIGHT_YELLOW = '\x1b[103m'
BACKGROUND_BRIGHT_BLUE = '\x1b[104m'
BACKGROUND_BRIGHT_MAGENTA = '\x1b[105m'
BACKGROUND_BRIGHT_CYAN = '\x1b[106m'
BACKGROUND_WHITE = '\x1b[107m'
BLACK = '\x1b[30m'
RED = '\x1b[31m'
GREEN = '\x1b[32m'
YELLOW = '\x1b[33m'
BLUE = '\x1b[34m'
MAGENTA = '\x1b[35m'
CYAN = '\x1b[36m'
LIGHT_GRAY = '\x1b[37m'
DARK_GRAY = '\x1b[90m'
BRIGHT_RED = '\x1b[91m'
BRIGHT_GREEN = '\x1b[92m'
BRIGHT_YELLOW = '\x1b[93m'
BRIGHT_BLUE = '\x1b[94m'
BRIGHT_MAGENTA = '\x1b[95m'
BRIGHT_CYAN = '\x1b[96m'
WHITE = '\x1b[97m'
getCode(text)
oimodeler.oimUtils.colorPrint(text, color)
oimodeler.oimUtils.oimWarning(myclass, warningName, text, color='red')
oimodeler.oimUtils.oimAckWarning(myclass, text)