make_combined_adaptive_grid

jwst.extract_1d.soss_extract.atoca_utils.make_combined_adaptive_grid(all_grids, all_estimates, grid_range, max_iter=10, rtol=1e-05, max_total_size=1000000)[source]

Build an irregular oversampled grid needed to reach a given precision when integrating.

The grid is built by subdividing iteratively each intervals that did not reach the required precision. The precision is computed based on the estimate of the integrals using a first order Romberg integration.

Parameters:
all_gridslist[array]

List of grid (arrays) to pass to _adapt_grid, in order of importance.

all_estimateslist[callable]

List of function (callable) to estimate the precision needed to oversample the grid. Must match the corresponding grid in all_grids.

grid_rangelist[float]

Wavelength range the new grid should cover.

max_iterint, optional

Number of times the intervals can be subdivided. The smallest subdivison of the grid if max_iter is reached will then be given by delta_grid / 2^max_iter. Needs to be greater than zero. Default is 10.

rtolfloat, optional

The desired relative tolerance. Default is 10e-6, so 10 ppm.

max_total_sizeint, optional

Maximum size of the output grid. Default is 1 million.

Returns:
os_gridndarray

Oversampled combined 1D grid which minimizes the integration error based on Romberg’s method.