hc_atmgrid_splinefm_jwst_ifu_cal
- breads.fm.hc_atmgrid_splinefm_jwst_ifu_cal(nonlin_paras, cubeobj, atm_grid=None, atm_grid_wvs=None, star_func=None, radius_as=0.2, nodes=20, badpixfraction=0.75, fix_parameters=None, Nrows_max=200, detec_KLs=None, wvs_KLs_f=None, regularization=None, reg_mean_map=None, reg_std_map=None)[source]
For high-contrast companions (planet + speckles). Function to create the model matrix M ([Planet spectrum, Star spectrum * M_spline]), the input data 1d vector d and the noise 1d vector. Regularization matrix can be added to the model M with the reg_mean_map and reg_std_map parameters. PCA can be added as well with the detec_KLs and wvs_KLs_f parameters. Args:
- nonlin_paras: list
Non-linear parameters of the model, which are first the parameters defining the atmopsheric grid (atm_grid). The following parameters are the spin (vsini), the radial velocity, and the position (if loc is not defined) of the planet in the FOV.
[atm paras ….,vsini,rv,y,x] for 3d cubes (e.g. OSIRIS) [atm paras ….,vsini,rv,y] for 2d (e.g. KPIC, y being fiber) [atm paras ….,vsini,rv] for 1d spectra
- cubeobj: Must inherit breads.instruments.jwst_IFUs
Calibrated data object.
- atm_grid: Planet atmospheric model grid as a scipy.interpolate.RegularGridInterpolator object.
Make sure the wavelength coverage of the grid is just right and not too big as it will slow down the spin broadening.
- atm_grid_wvs: 1d array
Wavelength sampling on which atm_grid is defined. Wavelength needs to be uniformly sampled.
- star_func: scipy.interpolate._interpolate.interp1d object (only tested with this interpolator object so far)
Interpolator object to model the stellar spectrum by continuum normalization to fit the speckle noise in each trace of the detector.
- radius_as: float (default is 0.2 arcsec)
Each pixel with coordinates that are within radius_as of the assumed companion location will be included in the fit. Must be expressed in arcsecond.
- nodes: int, list of int or list of list
If int, number of nodes equally distributed. If list, custom locations of nodes [x1,x2,..]. To model discontinous functions, use a list of list [[x1,…],[xn,…]] TODO not sure I get this. Expressed in pixel coordinates.
- badpixfraction: float
Max fraction of bad pixels in data. if above the threshold it returns all empty numpy arrays for M, d and s matrix.
- fix_parameters: List.
Use to fix the value of some non-linear parameters. The values equal to None are being fitted for, other elements will be fixed to the value specified.
- Nrows_max: int (default is 200)
Maximum number of rows to modelize simultaneously. Basically, if radius_as is too large compare to lambda/D, too many traces would be fitted simultaneously. This parameters assures that the matrix dimensions won’t be too large.
detec_KLs: None wvs_KLs_f: None regularization: str “user” or None.
If set to “user”, the values in reg_mean_map and reg_std_map are used to regularized the model fitting incorporating the regularization in the matrices d,M and s.
- reg_mean_map: 2d array (Nrows, Ncolumns)
regularization 2d map of the signal. It helps regularize the sub-splines around those mean values.
- reg_std_map: 2d array (Nrows, Ncolumns)
regularization 2d map of the noise. It helps regularize the sub-splines in those standard deviation intervals.
- Returns:
d: Data as a 1d vector with bad pixels removed (no nans) M: Linear model as a matrix of shape (Nd,Np) with bad pixels removed (no nans). Nd is the size of the data
vector and Np = N_nodes*boxw^2+1 is the number of linear parameters.
s: Noise vector (standard deviation) as a 1d vector matching d.