ForcedPhotometry - EranOfek/AstroPack GitHub Wiki
Background
Forced photometry refers to extracting photometry for sources with exactly or roughly known positions. This may include aperture photometry or PSF-fit photometry.
Forced photometry using imProc.sources.findMeasureSources
Given a calibrated and background subtracted image stored in an AstroImage object, extract photometry based on known X, Y pixel positions:
AI = imProc.sources.findMeasureSources(AI, 'ForcedList',[X, Y], 'OnlyForced',true);
% If OnlyForce=false (default), then will find sources and also perform forced photometry.
Forced photometry using imProc.sources.forcedPhot
This function can be used to perform PSF-fit forced photometry on the position of stationary or moving sources. The output of this function is a MatchedSources object that contains the photometry of the sources.
By default, forced photometry is allowed to shift the best-fit position by up to 0.5 pixels. To relax or change this default you can use the: MomentMaxIter, UseMomCoo, SmallStep, MaxStep, MaxIter arguments.
The imProc.sources.forcedPhot function requires an AstroImage object in which the source catalog associated with the image is populated (in the CatData property). The reason for that is that the source catalog is needed for the PSF construction.
Reading an images and meta data to an AstroImage
There are several options to read an image with its associated catalog, and other meta data into an AstroImage.
- Reduce an astronomical image to the level it is available with its source catalog (see extract source catalogs).
- Read all the products using the AstroImage constructor. For example:
AI = AstroImage(FileName, 'Mask',MaskFileName);
AI.CatData = AstroCatalog(CatFileName);
- In case the image names are in the LAST/ULTRASAT file name format, you can use the AstroImage.readFileNamesObj function:
AI=AstroImage.readFileNamesObj('LAST.01.02.01_20230425.213135.086_clear_185-02_020_001_*_sci_proc_Image_1.fits')
% or
AI=AstroImage.readFileNamesObj('*proc_Image*.fits')
This function will attempt reading the Mask and Cat data into the AstroImage object.
Forced photometry by pixel positions:
R=imProc.sources.forcedPhot(AI, 'Coo',[X Y], 'CooUnits','pix');
Forced photometry by RA/Dec positions:
R=imProc.sources.forcedPhot(AI, 'Coo',[RA, Dec]);
In the case the coordinates are in RA/Dec then by default, the function will also perform forced photometry on all GAIA-DR3 catalog positions within 300 arcseconds from the target position. The following arguments can be used to control this behavior: AddRefStarsDist, AddCatName, and RefColNames.
Forced photometry for moving source:
R=imProc.sources.forcedPhot(AI, 'Coo',[RA, Dec], 'Moving',true);
For this case, Moving=true, the 'Coo' argument contains an entry per each AstroImage element (which we refer as epoch), and the forced photometry is performed on each image in a different location.
In order to generate a list of coordinates for a moving target for each image in an AstroImage object:
% read FITS images into an AstroImage object.
% Note: we assume that the images are fully calibrated and contain astrometric solution.
AI = AstroImage('*.fits');
% get the JD of all the images:
JD = AI.julday;
% get predicted position of your moving target between min(JD) and max(JD):
[Cat]=celestial.SolarSys.jpl_horizons('ObjectInd','9804','StartJD',floor(min(JD)-1),'StopJD',ceil(min(JD)+1), 'StepSizeUnits','h');
% Interpolate the columns of Cat onto the times in JD:
CatInterp = Cat.interp1('JD',{'RA','Dec','r','Delta'}, JD);
% Note Cat.Catalog(:,2:3) contains [RA, Dec]
R=imProc.sources.forcedPhot(AI, 'Coo',CatInterp.Catalog(:,2:3), 'Moving',true);
Forced photometry using pipeline.last.forcedPhotAll
The pipeline.last.forcedPhotAll function can be used on LAST images. The function looks, recursively, for all relevant images in a directory tree. Next, it uses using imProc.sources.forcedPhot to perform forced photometry on a stationary or moving source in the images.
MS=pipeline.last.forcedPhotAll('Coo',[50.0452635724,+8.748787337], 'FileTemp','LAST*_089+48_*_sci_proc_Image_*.fits')
Generate a light curve
Given a MatchedSources object generated by one of the forced photometry routines, you can use this object to generate the light curve of the source of interest.
In the MatchedSources object, the object of interest (if only one was chosen) is populating the first column of the matrices of properties. To see the instrumental magnitude photometry of the measurements:
plot(MS.JD, MS.Data.MAG_PSF, 'o')
Since the MatchedSources object may include also forced photometry for some reference stars, this may be used for relative photometry calibration of the target magnitudes.
TBD