How to use the drizzlepac.astrodrizzle.adrizzle function in drizzlepac

To help you get started, we’ve selected a few drizzlepac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gbrammer / grizli / grizli / multifit.py View on Github external
line_wcs = pywcs.WCS(h, relax=True)
            line_wcs.pscale = utils.get_wcs_pscale(line_wcs)

            # Science and wht arrays
            sci = flt.grism['SCI'] - flt.model
            wht = 1/(flt.grism['ERR']**2)
            scl = np.exp(-(fcontam*np.abs(flt.model)/flt.grism['ERR']))
            wht *= scl
            
            wht[~np.isfinite(wht)] = 0
            
            # Drizzle it
            if verbose:
                print('Drizzle {0} to wavelength {1:.2f}'.format(flt.grism.parent_file, wave))
                                                        
            adrizzle.do_driz(sci, line_wcs, wht, out_wcs, 
                             outsci, outwht, outctx, 1., 'cps', 1,
                             wcslin_pscale=line_wcs.pscale, uniqid=1, 
                             pixfrac=pixfrac, kernel=kernel, fillval=0, 
                             stepsize=10, wcsmap=None)
        
        # Done!
        return outsci, outwht
github gbrammer / grizli / grizli / multifit.py View on Github external
### Direct thumbnail
        if direct_extension == 'REF':
            if beam.direct['REF'] is None:
                direct_extension = 'SCI'
                
        if direct_extension == 'REF':
            thumb = beam.direct['REF']
            thumb_wht = np.cast[np.float32]((thumb != 0)*1)
        else:
            thumb = beam.direct[direct_extension]#/beam.direct.photflam
            thumb_wht = 1./(beam.direct.data['ERR']/beam.direct.photflam)**2
            thumb_wht[~np.isfinite(thumb_wht)] = 0
            
        
        adrizzle.do_driz(thumb, beam.direct.wcs, thumb_wht, output_wcs, 
                         doutsci, doutwht, doutctx, 1., 'cps', 1, 
                         wcslin_pscale=beam.direct.wcs.pscale, uniqid=1, 
                         pixfrac=pixfrac, kernel=kernel, fillval=0, 
                         stepsize=10, wcsmap=None)
        
        ## Show in ds9
        if ds9 is not None:
            ds9.view((outsci-coutsci), header=header)
    
    ## Scaling of drizzled outputs     
    #print 'Pscale: ', output_wcs.pscale    
    #outsci /= (output_wcs.pscale)**2
    #coutsci /= (output_wcs.pscale)**2
    # doutsci /= (output_wcs.pscale)**2
    
    outwht  *= (beams[0].grism.wcs.pscale/output_wcs.pscale)**4
github gbrammer / grizli / grizli / utils.py View on Github external
# Output header / WCS    
    header, outputwcs = compute_output_wcs(wcs_list, pixel_scale=scale)
    shape = (header['NAXIS2'], header['NAXIS1'])
    
    # Output arrays
    outsci = np.zeros(shape, dtype=np.float32)
    outwht = np.zeros(shape, dtype=np.float32)
    outctx = np.zeros(shape, dtype=np.int32)
    
    # Do drizzle
    N = len(sci_list)
    for i in range(N):
        if verbose:
            log.info('Drizzle array {0}/{1}'.format(i+1, N))
            
        adrizzle.do_driz(sci_list[i].astype(np.float32, copy=False), 
                         wcs_list[i], 
                         wht_list[i].astype(np.float32, copy=False),
                         outputwcs, outsci, outwht, outctx, 1., 'cps', 1,
                         wcslin_pscale=wcs_list[i].pscale, uniqid=1, 
                         pixfrac=pixfrac, kernel=kernel, fillval=0, 
                         stepsize=10, wcsmap=None)
        
    return outsci, outwht, outctx, header, outputwcs

drizzlepac

HST image combination using the drizzle algorithm to combine astronomical images, to model image distortion, to remove cosmic rays, and generally to improve the fidelity of data in the final image.

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis