hc_mask_splinefm

breads.fm.hc_mask_splinefm(nonlin_paras, cubeobj, stamp=None, planet_f=None, transmission=None, star_spectrum=None, boxw=1, psfw=1.2, nodes=20, star_flux=None, badpixfraction=0.75, loc=None, optimize_nodes=True, wid_mov=None, opt_p=0.7, knot_margin=0.0001, star_loc=None, KLmodes=None, fit_background=False, recalc_noise=True, just_tellurics=False)[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: (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.

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.