model_wcs_header

grizli.jwst_utils.model_wcs_header(datamodel, get_sip=True, degree=4, fit_crval=True, fit_rot=True, fit_scale=True, step=32, crpix=None, lsq_args={'bounds': (-inf, inf), 'diff_step': 1e-06, 'f_scale': 1000.0, 'ftol': 1e-12, 'gtol': 1e-12, 'jac': '2-point', 'jac_sparsity': None, 'kwargs': {}, 'loss': 'soft_l1', 'max_nfev': 100, 'method': 'trf', 'tr_options': {}, 'tr_solver': None, 'verbose': 0, 'x_scale': 1.0, 'xtol': 1e-12}, get_guess=True, set_diff_step=True, initial_header=None, fast_coeffs=True, uvxy=None, **kwargs)[source]

Make a header with a better SIP WCS derived from the JWST gwcs object

Parameters
datamodeljwst.datamodels.ImageModel

Image model with full gwcs in with_wcs.meta.wcs.

get_sipbool

If True, fit a astropy.modeling.models.SIP distortion model to the image WCS.

degreeint

Degree of the SIP polynomial model.

fit_crval, fit_rot, fit_scalebool

Fit the CRVAL, rotation, and scale of the SIP model.

stepint

For fitting the SIP model, generate a grid of detector pixels every step pixels in both axes for passing through datamodel.meta.wcs.forward_transform.

crpix(float, float)

Refernce pixel. If None set to the array center.

lsq_argsdict

Arguments for scipy.optimize.least_squares.

get_guessbool

Get initial guess for SIP coefficients from the datamodel.meta.wcs.

set_diff_stepbool

Set lsq_args['diff_step'] to the pixel scale.

initial_headerNone or Header

Initial header to use as a guess for the SIP fit.

fast_coeffsbool

Use a fast method to compute the SIP coefficients.

uvxyNone or (array, array, array, array)

Manually specify detector and target coordinates for positions to use for the SIP fit, where uvxy = (x, y, ra, dec) and the detector coordinates are zero-index. If not specified, make a grid with step

Returns
header‘~astropy.io.fits.Header`

Header with simple WCS definition: CD rotation but no distortion.