oimUtils
Various utilities for optical interferometry
Functions:
|
|
|
|
|
|
|
|
|
Planck's law with output in cgs. |
|
Calculates the blackbody_profile via Planck's law and the emissivity_factor for a given wavelength, temperature- and dust surface density profile. |
|
Pads an image with additional zeros for Fourier transform. |
|
Bins a 2D-image down according. |
|
Returns the next power of two for an integer or float input. |
|
Converts an angle from milliarcseconds to meters. |
|
Converts a distance from meters to an angle in milliarcseconds. |
|
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". |
|
Gets the baseline names, i.e., telescopes names separated by minus sign, in an extension of a oifits file. |
|
|
|
Return a tuple (B, PA) of the baseline lengths and orientation (position angles) from a fits extension within an opened oifits file. |
|
|
|
|
|
|
|
|
|
|
|
Returns the wl law from a chromatic cube image in the fits format |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- oimodeler.oimUtils.getDataTypeIsAnalysisComplex(dataType)
- oimodeler.oimUtils.getDataArrname(dataType)
- oimodeler.oimUtils.getDataType(dataArrname)
- oimodeler.oimUtils.getDataTypeError(dataArrname)
- oimodeler.oimUtils.blackbody(wavelength: ndarray, temperature: ndarray) ndarray
Planck’s law with output in cgs.
- Parameters:
wavelength (np.ndarray) – The wavelength [cm].
temperature ſ np.ndarray – The temperature [K].
- Returns:
blackbody – The blackbody [erg/(cm² s Hz sr)].
- Return type:
np.ndarray
- oimodeler.oimUtils.calculate_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.pad_image(image: ndarray)
Pads an image with additional zeros for Fourier transform.
- oimodeler.oimUtils.rebin_image(image: ndarray, binning_factor: int | None = None, rdim: bool | None = False) ndarray
Bins a 2D-image down according.
The down binning is according to the binning factor in oimOptions[“FTBinningFactor”]. 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.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.convert_angle_to_distance(radius: float | ndarray, distance: float, rvalue: bool | None = False) float | ndarray
Converts an angle from milliarcseconds to meters.
- Parameters:
radius (float or numpy.ndarray) – The radius of the object around the star [mas].
distance (float) – The star’s distance to the observer [pc].
rvalue (bool, optional) – If toggled, returns the value witout u.else returns an astropy.u.Quantity object. The default is False.
- Returns:
radius – The radius of the object around the star [m].
- 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.convert_distance_to_angle(radius: float | ndarray, distance: float, rvalue: bool | None = False) float | ndarray
Converts a distance from meters to an angle in milliarcseconds.
- Parameters:
radius (float or numpy.ndarray) – The radius of the object around the star [au].
distance (float) – The star’s distance to the observer [pc].
rvalue (bool, optional) – If toggled, returns the value witout u.else returns an astropy.u.Quantity object. The default is False.
- Returns:
radius – The radius of the object around the star [m].
- 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.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, T3Max=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 u.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)