Observation format#
This section will help you convert your observationnal data into the ForMoSA format
Imports#
[12]:
from astropy.io import fits
from astropy.table import Table
Data .fits#
Your observed data (spectroscopy and/or photometry) should be formated in a .fits file with the following extensions :
‘WAV’ The wavelengths sampling
‘WAVE_UNIT’ The wavelengths unit
‘FLX’ The corresponding flux
‘ERR’ or ‘COV’ The corresponding flux error (or covariance matrix). Note : The covariance matrix should have
diag(COV)=ERR².‘RES’ The corresponding spectral resolution given for each wavelength. Note : You must put res = 0.0 where you have photometric points.
‘FAC’ The observatory where the data come from. Note :need to be consistent with VOSA for photometric points.
‘INS’ The instrument used to obtain the data. Note : need to be consistent with VOSA for photometric points.
‘FILT’ The photometric filter used in case of photometric point. Note : need to be consistent with VOSA.
Note : All of these extensions need to be numpy arrays of the same length.
We can use the example given in the demo XXXXXXX:
[13]:
# CHECKUP FORMAT
hdul = fits.open('/Users/spetrus/Desktop/ForMoSA_pkg/ForMoSA/docs/demos/sinfoni/abpicb/data/ABPicb_SINFONI_K.fits')
print(hdul[1].columns)
wav = hdul[1].data['WAV']
wav_u = hdul[1].data['WAVE_UNIT']
flx = hdul[1].data['FLX']
err = hdul[1].data['ERR']
res = hdul[1].data['RES']
fac = hdul[1].data['FAC']
ins = hdul[1].data['INS']
filt = hdul[1].data['FILT']
print('WAV : ', wav[:3])
print('WAVE_UNIT : ', wav_u[:3])
print('FLX : ', flx[:3])
print('ERR : ', err[:3])
print('RES : ', res[:3])
print('FAC : ', fac[:3])
print('INS : ', ins[:3])
print('FILT : ', filt[:3])
ColDefs(
name = 'WAV'; format = 'D'
name = 'WAVE_UNIT'; format = '2A'
name = 'FLX'; format = 'D'
name = 'ERR'; format = 'D'
name = 'RES'; format = 'D'
name = 'FAC'; format = '7A'
name = 'INS'; format = '7A'
name = 'FILT'; format = '2A'
)
WAV : [1.95304004 1.95328504 1.95353004]
WAVE_UNIT : ['um' 'um' 'um']
FLX : [1.15922346e-15 1.01987308e-15 9.42198880e-16]
ERR : [9.69466216e-17 1.14293769e-16 1.09448441e-16]
RES : [5090. 5090. 5090.]
FAC : ['Paranal' 'Paranal' 'Paranal']
INS : ['SINFONI' 'SINFONI' 'SINFONI']
FILT : ['NA' 'NA' 'NA']
optional extensions can also be used when dealing with stellar-contaminated high-resolution spectroscopy:
‘TRANSM’ : (array) transmission (atmospheric + instrumental)
‘STAR_FLX’ or ‘STAR_FLXi’ : (array or i arrays) star flux or shifted star flux (to account for LSF changes)
‘SYSTEM’ or ‘SYSTEMj’ : (array or j arrays) systematic model(s) (usually computed from PCA)
See XXXXXX for more details
Format your data#
To format your data, you can use the simple Python routine below :
[14]:
# FITS converter :
table = Table([wav, wav_u, flx, err, res, fac, ins, filt], names=('WAV', 'WAVE_UNIT', 'FLX', 'ERR', 'RES', 'FAC', 'INS', 'FILT'))
hdul = fits.HDUList()
hdu = fits.BinTableHDU(table)
hdul.append(hdu)
hdul.writeto('/Users/spetrus/Desktop/ForMoSA_pkg/ForMoSA/docs/demos/sinfoni/abpicb/data/ABPicb_SINFONI_K.fits', overwrite=True)
print('correction successful')
correction successful
If you have multiple observations, you can put them in a same .fits file by giving their properties accordingly in the different Tables. You can also put them into separated .fits files (e.g data_1.fits, data_2.fits, …) to treat them differently during the inversion. For instance with different likelihood function, different normalizatoin factor, etc.
Note : We encourage you to put every photometric points into a same .fits file.
Note : If you need to calculate the dilution facto Ck analytically, we encourage you to put all of your datasets into a same .fits file.
[ ]: