Utilities for Poisson-noise matched filter
in the astronomy & astrophysics toolbox for MATLAB
Description:
Convention:
We note that our convention is not to renormalize $P_{\rm poi}$ to unity, and to subtract the background expectation value from the image prior to filtering. Other conventions are valid as long as they are applied consistently.
Low level functions:
Calculating the flux threshold:
The function ImUtil.X.poiss_f_threshold can be used to calculate the flux threshold and using simulations. The input for this function is the background level (in counts), a stamp of the PSF or a scalar specifying the sigma of a Gaussian PSF (pixels), and the false alarm probability. The user can control the number of simulations, anc convergence accuracy (see help AstroIm.poiss_f_threshold for more information).
Example:
[Flim,Slim]=ImUtil.X.poiss_f_threshold(0.005,2,0.001)
Generating the Poisson-noise matched filter:
In order to generate a Poisson-noise matched filter you can use the @Kernel2 static class:
K=Kernel2.pmf
surface(K)
% or
K=Kernel2.pmf(0.005,Kernel2.gauss,5)
surface(K)
Filtering
You can filter an image using the built-in function filter2. However, a more convinient tool is the SIM/filter function that works on SIM objects and can filter an image using a several methods.
% generate a random poisson noise SIM image
Back = 0.005;
Im = SIM
Im.Im = poissrnd(ones(1024,1024).*Back);
K=Kernel2.pmf(Back,1.5,3);
FiltIm = filter(Im,K);
Background estimation
High level functions
Running mextractor
The matched filter source extraction mextractor can use the Poisson-noise filter.
However, this...
Back = 0.005;
Im = SIM
Im.Im = poissrnd(ones(1024,1024).*Back);
[Flim,Slim,Status]=ImUtil.X.poiss_f_threshold(Back,1.5,1e-3);
PMF = Kernel2.pmf(Back,1.5,Flim);
Im.PSF = PMF;
%Im = mextractor(Im, 'ThreshIsSigma',false,'FilterFind',false,'Filter',PMF,'Thresh',Flim)
Example on Chandra images
% Build a local copy of the Chandra observations catalog
% may take many hours:
% VO.Chandra.build_obsid_cat
% Copy Chandra observations to local directory
% VO.Chandra.wget_obsid(366);
% Read ACIS observations
% [Cat,GT] = AstroX.read_chandra_acis('/raid/eran/projects/Algorithms/PoissonMatchedFilter/Chandra/ObsID366/');