hc_splinefm
- breads.fm.hc_splinefm(nonlin_paras, cubeobj, planet_f=None, transmission=None, star_spectrum=None, boxw=1, psfw=1.2, nodes=20, badpixfraction=0.75, loc=None, fix_parameters=None)[source]
For high-contrast companions (planet + speckles). Generate forward model fitting the continuum with a spline. No high pass filter or continuum normalization here. The spline are defined with a linear model. Each spaxel (if applicable) is independently modeled which means the number of linear parameters increases as N_nodes*boxw^2+1.
- Args:
- nonlin_paras: Non-linear parameters of the model, which are the radial velocity and the position (if loc is not
defined) of the planet in the FOV. [rv,y,x] for 3d cubes (e.g. OSIRIS) [rv,y] for 2d (e.g. KPIC, y being fiber) [rv] for 1d spectra
- cubeobj: Data object.
Must inherit breads.instruments.instrument.Instrument.
planet_f: Planet atmospheric model spectrum as an interp1d object. Wavelength in microns. transmission: Transmission spectrum (tellurics and instrumental).
np.ndarray of size the number of wavelength bins.
- star_spectrum: Stellar spectrum to be continuum renormalized to fit the speckle noise at each location. It is
(for now) assumed to be the same everywhere which is not compatible with a field dependent wavelength solution. np.ndarray of size the number of wavelength bins.
- boxw: size of the stamp to be extracted and modeled around the (x,y) location of the planet.
Must be odd. Default is 1.
psfw: Width (sigma) of the 2d gaussian used to model the planet PSF. This won’t matter if boxw=1 however. nodes: 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,…]].
badpixfraction: Max fraction of bad pixels in data. loc: Deprecated, Use fix_parameters.
(x,y) position of the planet for spectral cubes, or fiber position (y position) for 2d data. When loc is not None, the x,y non-linear parameters should not be given.
- 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.
- 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.