AstroPSF - EranOfek/AstroPack GitHub Wiki

Description

Class Hierarchy: Base -> Component -> AstroPSF

AstroPSF is a container for multi-dimensional point spread functions (PSFs) of emission sources, i.e. normalized images of point-like sky objects seen under various observation conditions with various telescopes and detectors. The class also provides basic functionality for PSF data manipulation.

Properties

  • DataPSF -- multi-D data cube with PSF image stamps (X,Y) in the first two dimensions
  • DataVar -- variance of the PSF stamps
  • Oversampling -- pixel oversampling in X and Y (may be different)
  • FunPSF -- PSF-generating function, e.g., Map = Fun(Data, X,Y, Color, Flux)
  • DimName -- a cell array with the names of DataPSF dimensions over 2 (the default set is {'Wave', 'PosX', 'PosY', 'PixPhaseX', 'PixPhaseY'})
  • DimVals -- a cell array with the desired PSF stamp coordinates in the upper dimensions of DataPSF
  • InterpMethod -- a cell array of interpolation methods applied over each of the DataPSF dimensions
  • StampSize -- the desired PSF stamp size in X and Y
  • FWHM -- a FWHM of some default PSF stamp
  • FluxContainmentRadius -- a quantile radius of some default PSF stamp
  • Nstars -- the number of stars employed to build the PSF stamp

Methods

  • getPSF -- the most basic function used to obtain a PSF stamp from an AstroPSF object and a set of parameters; many of other class functions relay on getPSF

  • specWeightedPSF -- produce a spectrum-weighted PSF of a single-element AstroPSF object

  • isemptyPSF -- сheck if PSFData is empty

  • fitFunPSF -- fit a composite function to a PSF stamp and replace it

  • curve_of_growth -- calculate a curve of growth of a PSF

  • moment2 -- calculate the moments and aperture photometry of all PSF stamps in an AstroPSF object

  • fwhm -- calculate the FWHM of a PSF using the curve of growth

  • radialProfile -- extract a radial profile from an AstroPSF object

  • images2cube -- transform an array of AstroPSF into a cube of PSFs

  • padShift -- pad a PSF with zeros and shift its center

  • full2stamp -- given a PSF contained in a full-size image, generate a stamp of the PSF

  • suppressEdges -- multiply the PSF by edge suppressing function (e.g., cosbell)

  • normPSF -- normalize a PSF so that its sum is 1

  • even2odd -- rescale a PSF so that the stamp size becomes odd in both directions

  • surface -- plot a PSF using matlab surface function

  • plotRadialProfile -- plot radial profiles of the input AstroPSF objects

Examples

% create an empty AstroPSF object and fill the DataPSF property with a simple 2D stamp:
AP = AstroPSF; P = imUtil.kernel2.gauss; AP.DataPSF = P;
% create an AstroPSF object with the DataPSF property immediately filled with a synthetic 2D stamp:
AP = AstroPSF('Synthetic','gauss','GaussSigma',[3 4 0],'StampSize',[15 19]); 
AP = AstroPSF('Synthetic','lorentzian','LorentzianGamma',2); 
AP = AstroPSF('Synthetic','cosbell','CosbellRadii',[6 10],'StampSize',21); 
AP = AstroPSF('Synthetic','moffat','MoffatAlphaBeta',[0.7 3]); 
% get a radial profile of the PSF stamp:
[R, V] = AP.radialProfile;
% measure the moments and make an aperture photometry of the PSF:
[M1,M2,Aper] = moment2(AP,'moment2Args',{'Momradius',4,'Annulus',[3, 4]});
% a multi-D example involving a database of ULTRASAT PSFs:
% load the ULTRASAT PSFs as AP.DataPSF
I = Installer; PSF_db = sprintf('%s%s%g%s',I.getDataDir('ULTRASAT_PSF'),'/ULTRASATlabPSF5.mat'); ReadDB = struct2cell ( io.files.load_check(PSF_db) ); PSFdata = ReadDB{2}; 
AP.DataPSF = PSFdata;
% two additional PSF dimensions:
AP.DimVals{1} = 2000:100:11000;
AP.DimVals{2} = linspace(0,10,25);
% get the default ``average'' stamp (at mean the radius and the mean wavelength):  
Pg1 = AP.getPSF;
% get the stamp at the default radius and at the given wavelength:
Pg2 = AP.getPSF('PsfArgs',{'Wave',2210});
% get the stamp at the given position in the radius-wavelength space:
Pg3 = AP.getPSF('PsfArgs',{'Wave',3550,'PosX',5.5});
% the same with the interpolation method 'linear' instead of the default 'nearest neighbor':
Pg3 = AP.getPSF('PsfArgs',{'Wave',3550,'PosX',5.5},'InterpMethod','linear');
% get a cube of PSFs at the given set of wavelengths:
Pg4 = AP.getPSF('PsfArgs',{'Wave',[2210 3400 6800]}); 
% resample the output PSF stamp to the given value of oversampling:    
Pg5 = AP.getPSF('Oversampling',5,'PsfArgs',{'Wave',2500,'PosX',7});
% make a spectrum-weighted PSF with the default (flat) spectrum:
Pw1 = AP.specWeightedPSF;
% the same at the given radius instead of the mean radius:
Pw2 = AP.specWeightedPSF('Pos',{'PosX',2});
% weight the PSF with the spectrum given as an explicit grid:
Pw3 = AP.specWeightedPSF('Pos',{'PosX',6},'Wave',[2000 3000 4000 5000],'Spec',[0.5 1 1 0.3]);
% weight the PSF with a blackbody spectrum of the given temperature T on defined on the given wavelength grid:
T = 3500; Sp = AstroSpec.blackBody(2000:11000,T);
Pw4 = AP.specWeightedPSF('Pos',{'PosX',6},'Wave',Sp.Wave,'Spec',Sp.Flux');

More examples can be found in AstroPSF.unitTest (https://github.com/EranOfek/AstroPack/blob/dev1/matlab/image/%40AstroPSF/unitTest.m).