grid_search
- breads.grid_search.grid_search(para_vecs, dataobj, fm_func, fm_paras, numthreads=None, bounds=None, computeH0=False, scale_noise=True, marginalize_noise_scaling=False)[source]
Planet detection, CCF, or grid search routine. It fits for the non linear parameters of a forward model over a user-specified grid of values while marginalizing over the linear parameters. For a planet detection or CCF routine, choose a forward model (fm_func) and provide a grid of x,y, and RV values.
SNR (detection maps or CCFs) can be computed as: N_linpara = (out.shape[-1]-2)//2 snr = out[…,3]/out[…,3+N_linpara]
The natural logarithm of the Bayes factor can be computed as bayes_factor = out[…,0] - out[…,1]
- Args:
- para_vecs: [vec1,vec2,…] List of 1d arrays defining the sampling of the grid of non-linear parameters such as
rv, y, x. The meaning and number of non-linear parameters depends on the forward model defined.
dataobj: A data object of type breads.instruments.instrument.Instrument to be analyzed. fm_func: A forward model function. See breads.fm.template.template() for an example. fm_paras: Additional parameters for fm_func (other than non-linear parameters and dataobj) numthreads: Number of processes to be used in parallelization. Non parallization if defined as None (default). bounds: (/!Caution: the calculation of log prob is only theoretically accurate if no bounds are used.)
Bounds on the linear parameters used in lsq_linear as a tuple of arrays (min_vals, maxvals). e.g. ([0,0,…], [np.inf,np.inf,…]). default no bounds. Each numpy array must have shape (N_linear_parameters,).
- Returns:
log_prob: Probability of the model marginalized over linear parameters. log_prob_H0: Probability of the model without the planet marginalized over linear parameters. rchi2: noise scaling factor linparas: Best fit linear parameters linparas_err: Uncertainties of best fit linear parameters