Oifits Helpers & Utils
Many functions and classes developed for oimodeler to filter data, perform fitting, or produce plots can
be accessed directly by the user. Most of these helper functions are implemented in the
oimUtils module. A complete description is available in the API section.
Here, we only describe some of the features that might be of interest to regular oifits and/or oimodeler users.
Getting information on an oifits file
The functions listed below where developped to retrieve some information from the oifits tables:
getBaselineName: list of all baselines for an oifits arraygetConfigName: array configuration name (i.e., ATs position, UTs, CHARA telescopes)getBaselineLengthAndPA: length (m) and PA (deg) of the baselinesgetWlFromOifitsthe wavelength vector (m)get2DSpaFreq: spatial frequencies of the baselines (with a format nB,n:math:lambda )
ll of these functions operate similarly and return information for a single array (OI_VIS, OI_VIS2, or OI_T3) from one oifits file.
When working with an oimData object, the user needs to access
a single oifits file contained in the data variable.
Here are some examples of using these function on the first oifits file contained in an
oimData instance.
Bname = oim.getBaselineName(data.data[0], length=True, angle=True)
CPname = oim.getBaselineName(data.data[0],hduname="OI_T3")
confname = oim.getConfigName(data.data[0])
B,PA = oim.getBaselineLengthAndPA(data.data[0])
u,v = oim.get2DSpaFreq(data.data[0])
wl = oim.getWlFromOifits(data.data[0])
print(f"This oifits files contains data taken with the {confname} array")
print(f"The wavelength range is {wl.min()*1e6:.2f}-{wl.max()*1e6:.2f}\mum")
for i in range(len(Bname)):
print(f"{Bname[i]}")
This oifits files contains data taken with the A0-B2-C1-D0 array The wavelength range is 2.69-4.20mum D0-C1 23m -149$^o$ A0-B2 24m 147$^o$ B2-D0 34m 31$^o$ B2-C1 11m 31$^o$ A0-D0 32m 74$^o$ A0-C1 22m 119$^o$
Note that, by default the functions return information on the first OI_VIS2 extension. Other extension
can be accessed
- using the hduname option to access extensions with other name such as OI_T3, OI_VIS
- using the extver to specify a specific extension by it EXTVER number
- The
getBaselineNamecan return the baselines length and orientation as seen in the above example.
Modifying oifits arrays
The oimUtils module also contains functions which are at the core of the data
filtering available using the oimDataFilter class.
Instead of using these feature through the oimDataFilter
interface one can directly modify oifits files opened with astrpy.io.fits module.
The main functions are the following :
shiftWavelength: Shift the wavelength of an oifits filespectralSmoothing: Smooth the spectral data of an oifits filebinWavelength: Bin the wavelength of an oifits fileoifitsFlagWithExpression: Flag the data with an expressioncomputeDifferentialError: Compute the differential errorsetMinimumError: Set the minimum error of a given data type to a given value
Creating oifits arrays
the oimUtils module also contains helpers function to create fits tables compatibles
with the OIFITS2 (Optical Interferometry FITS) standard defined in Duvert et al. (2017).
For instance, to create a OI_VIS2 table, ones should provide the complete list required KEYWORDS and COLUMNS as defined in the OFITS2 standard:
vis2 = oim.createOiVis2(OI_REVN=OI_REVN,
DATE-OBS=DATE-OBS,
ARRNAME=ARRNAME,
INSNAME=INSNAME,
TARGET_ID=TARGET_ID,
TIME=TIME,
MJD=MJD,
INT_TIME=INT_TIME,
VIS2DATA=VIS2DATA,
VIS2ERR=VIS2ERR,
UCOORD=UCOORD,
VCOORD=VCOORD,
STA_INDEX=STA_INDEX,
FLAG=FLAG)
Note that the data provided as numpy array should also have the homogeneous dimension in term of number of baselines and number of wavelengths.
A particular case is the createOiTargetFromSimbad function,
which can generate an OI_TARGET table filled with values retrieved from the SIMBAD database when given
a target name.
target = oim.createOiTargetFromSimbad("Gamma Cas")
print(target.data[0])
(1, 'Gamma Cas', 14.1772125, 60.71674, 2000.0, 1.9444444276928152e-08,
1.9444444276928152e-08, 0.0, 'UNKNOWN', 'OPTICAL', 6.991666666666668e-06,
-1.088888888888889e-06, 2.2222222284540294e-08, 2.2222222284540294e-08,
1.65e-06, 3.3333333e-08, 'B0.5IVpe')
Listing oimodeler features
the oimUtils module also contains helpers to list all oimodeler
classes deriving from a parent class.
Listing function |
oimodeler class targeted |
options |
|---|---|---|
details, save2csv, componentType |
||
details, save2csv |
||
details, save2csv |
||
details, save2csv |
These functions can be used to test which components are available in your version of oimodeler
By default the functions only returns the list of the features available. Specifying details=True will return a additionnal information such as a description and the list of parameters.