Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wht = 1./im['ERR'].data**2
wht[(im['ERR'].data == 0) | (dq > 0) | (~np.isfinite(wht))] = 0
wht[im['SCI'].data < -3*im['ERR'].data] = 0
wht = np.cast[np.float32](wht)
exp_wcs = pywcs.WCS(im[1].header, relax=True)
exp_wcs.pscale = utils.get_wcs_pscale(exp_wcs)
#pf = 0.5
# import drizzlepac.wcs_functions as dwcs
# xx = out_wcs.deepcopy()
# #xx.all_pix2world = xx.wcs_world2pix
# map = dwcs.WCSMap(exp_wcs, xx)
astrodrizzle.adrizzle.do_driz(im['SCI'].data, exp_wcs, wht,
inter_wcs, outsci, outwht, outctx,
1., 'cps', 1,
wcslin_pscale=exp_wcs.pscale,
uniqid=1,
pixfrac=pixfrac, kernel=kernel,
fillval=0, stepsize=10,
wcsmap=SIP_WCSMap)
if ds9 is not None:
ds9.view(outsci, header=outh)
#outsci /= out_wcs.pscale**2
rms = 1/np.sqrt(outwht)
mask = (outwht == 0) | (rms > 100)
rms[mask] = 0
outsci[mask] = 0.
flt_wcs, 1, coeffs=True, interp='nearest',
sinscl=1.0, stepsize=1, wcsmap=None)
blotted_ones = astrodrizzle.ablot.do_blot(seg_ones+1, ref_wcs,
flt_wcs, 1, coeffs=True, interp='nearest',
sinscl=1.0, stepsize=1, wcsmap=None)
blotted_ones[blotted_ones == 0] = 1
ratio = np.round(blotted_seg/blotted_ones)
grow = nd.maximum_filter(ratio, size=3, mode='constant', cval=0)
ratio[ratio == 0] = grow[ratio == 0]
blotted = ratio
else:
#print '\nREFDATA\n\n', refdata.dtype, ref_wcs, flt_wcs
blotted = astrodrizzle.ablot.do_blot(refdata, ref_wcs, flt_wcs, 1, coeffs=True, interp='poly5', sinscl=1.0, stepsize=10, wcsmap=None)
return blotted