def simultaneous_deconvolve(filelist, krn_size, vb): s2_max = 0.0 ## Find largest PSF in ensemble for infile in filelist: ## Run SExtractor to generate source-catalogue catfile = SD.SEx(infile, vb) ## Run PSFEx to generate model image of PSF psf_obs = SD.PSFEx(catfile, "snap", vb) ### NEED to find FWHM from images without going through the ### following rigmarole: ## Convert PSF image to an array psf_obs = IM.pngcropwhite(IM.fits_pix(psf_obs)) ## Here is how we decide what PSF to use ## Product of the two widths = s2 m = DT.moments(psf_obs) s2 = m[1] * m[2] ## Which image has largest s2? Call this psf_OBS. if s2 > s2_max: s2_max = s2 psf_OBS = psf_obs ##------------------------------------------------------------ ## Make target psf array psf_ref = DT.Gauss_2D(*DT.moments(psf_OBS)) ## Calculate kernel array for obs->ref kernarr = DT.get_kernel(psf_OBS, psf_ref, [krn_size, krn_size], vb) ##------------------------------------------------------------ ## Deconvolve to the target PSF for infile in filelist: DT.deconvolve_image(infile, kernarr, vb) return
def simultaneous_deconvolve(filelist, krn_size, vb): s2_max = 0.0 ## Find largest PSF in ensemble for infile in filelist: ## Run SExtractor to generate source-catalogue catfile = SD.SEx(infile, vb) ## Run PSFEx to generate model image of PSF psf_obs = SD.PSFEx(catfile, "snap", vb) ### NEED to find FWHM from images without going through the ### following rigmarole: ## Convert PSF image to an array psf_obs = IM.pngcropwhite(IM.fits_pix(psf_obs)) ## Here is how we decide what PSF to use ## Product of the two widths = s2 m=DT.moments(psf_obs) s2 = m[1]*m[2] ## Which image has largest s2? Call this psf_OBS. if s2 > s2_max: s2_max = s2 psf_OBS = psf_obs ##------------------------------------------------------------ ## Make target psf array psf_ref = DT.Gauss_2D(*DT.moments(psf_OBS)) ## Calculate kernel array for obs->ref kernarr = DT.get_kernel(psf_OBS, psf_ref, [krn_size,krn_size],vb) ##------------------------------------------------------------ ## Deconvolve to the target PSF for infile in filelist: DT.deconvolve_image(infile, kernarr, vb) return
def single_deconvolve(filelist, krn_size, vb): ## Deconvolve all FITS images in list for infile in filelist: ## Run SExtractor to generate source-catalogue catfile = SD.SEx(infile, vb) ## Run PSFEx to generate model image of PSF psf_obs = SD.PSFEx(catfile, "snap", vb) ## Intermediate step: convert PSF image to an array psf_obs = IM.pngcropwhite(IM.fits_pix(psf_obs)) ## Make target psf array psf_ref = DT.Gauss_2D(*DT.moments(psf_obs)) ## Calculate kernel array kernarr = DT.get_kernel(psf_obs, psf_ref, [krn_size, krn_size], vb) ## Deconvolve image DT.deconvolve_image(infile, kernarr, vb) return
def single_deconvolve(filelist, krn_size, vb): ## Deconvolve all FITS images in list for infile in filelist: ## Run SExtractor to generate source-catalogue catfile = SD.SEx(infile, vb) ## Run PSFEx to generate model image of PSF psf_obs = SD.PSFEx(catfile, "snap", vb) ## Intermediate step: convert PSF image to an array psf_obs = IM.pngcropwhite(IM.fits_pix(psf_obs)) ## Make target psf array psf_ref = DT.Gauss_2D(*DT.moments(psf_obs)) ## Calculate kernel array kernarr = DT.get_kernel(psf_obs, psf_ref,[krn_size,krn_size],vb) ## Deconvolve image DT.deconvolve_image(infile, kernarr, vb) return