Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ref_idx = self._mref_idx
refxy = refxy[ref_idx]
# process weights:
if 'weight' in self._catalog.colnames:
im_weight = np.asarray(self._catalog['weight'])[minput_idx]
else:
im_weight = None
if 'weight' in refcat.catalog.colnames:
ref_weight = np.asarray(refcat.catalog['weight'])[ref_idx]
else:
ref_weight = None
fit = iter_linear_fit(
refxy, im_xyref, ref_weight, im_weight,
fitgeom=fitgeom, nclip=nclip, sigma=sigma, center=None
)
# re-compute shifts for the center at (0, 0):
fit['shift_ld'] += fit['center_ld'] - np.dot(fit['center_ld'], fit['matrix_ld'].T)
fit['shift'] = fit['shift_ld'].astype(np.double)
xy_fit = fit['shift'] + np.dot(im_xyref[fit['fitmask']], fit['matrix'].T)
fit['fit_xy'] = xy_fit
fit['fit_RA'], fit['fit_DEC'] = tanplane_wcs.tanp_to_world(*(xy_fit.T))
log.info("Computed '{:s}' fit for {}:".format(fitgeom, self.name))
if fitgeom == 'shift':
log.info("XSH: {:.6g} YSH: {:.6g}".format(*fit['shift']))