We discuss the derivations and manipulation of image source catalogs. Our initial catalogs may contain only X,Y positions with a few simple moments-based image parameters. More advanced catalogs will contail star-galaxy classification and more precsise photometric parameters.
A catalog of the dicrete sources present in an image is essential to nearly all factes of image reduction. Initially we may desire a simple list of X,Y positions for use in deriving the image world coordinated system (WCS). In later phases of the analusis we may require more precise photometric parameters for each image in order to perform source classification or derive a photometric zeropoint. This document was initially part of a specialized description of how I reduc HET acm (aquisition camear) images.
Return to top of page.For many reasons, the first thing we must do is establish a WCS for the FIT image header, and for this, we need a list of the X,Y positions of the discreete sources on the image. Since this procedure is usually more time-consuming than many interactive processes, we desire a means of running this in a bact mode. The method below enables this. It is used for batch processing of catalogs in reduction reduction scripst like AcmRunDate.
Reduction location: /home/sco/ACM_work_Oct2019 A good example that has a good number of stars, and a good WCS solution is: /home/sco/ACM_work_Oct2019/red_20191022/local_red/FIXUP/20191022T025524.2_acm_sci.fits /home/sco/ACM_work_Oct2019/red_20191022/local_red/WCS/20191022T025524.2_acm_sci.fits First I create a test directory: /home/sco/ACM_work_Oct2019/Test_imcats % cat list.1 /home/sco/ACM_work_Oct2019/red_20191022/local_red/FIXUP/20191022T025524.2_acm_sci.fits To make the catalog: % image_catalogs list.1 none N N Usage: image_catalogs list.0 none N N arg1 - Name of file with list of input FITS images arg2 - output directory name appendix (can be "none") arg3 - Clean all but the table files (Y/N) arg4 - run in debug mode (Y/N) Here is what results from the above run: % ls ./local_red/IMAGE_CATS/20191022T025524.2_acm_sci/ 20191022T025524.2_acm_sci_BGboxes.reg 20191022T025524.2_acm_sci.fits 20191022T025524.2_acm_sci.props 20191022T025524.2_acm_sci_bkg1.fits 20191022T025524.2_acm_sci_label0.fits 20191022T025524.2_acm_sci_sigma.fits 20191022T025524.2_acm_sci.cat0 20191022T025524.2_acm_sci.params 20191022T025524.2_acm_sci.table 20191022T025524.2_acm_sci_detsig.fits 20191022T025524.2_acm_sci.parlabThe table file above is the one with the actual catalog of image parameters. Other files, like 20191022T025524.2_acm_sci_bkg1.fits, show the sky background map and other useful things. Some of these can be employed downstream when we run routines that compute more refined photometric parameters to be used in classification and calibration. Return to top of page.
It is often useful to make a quick visual check of the image catalogs compiled in the previous section. There are tools for this, but the user must run them from the same working directory where the catalogs were made (i.e. you must be at ./local_red/). Note that we can delete all the files in this working directory if we desire, but we must run our review from there.
% ls local_red/ S/ To get a regions file (using the X,Y centroids): % imgcat0_ds9reg_make ./local_red/FIXUP/20191022T025524.2_acm_sci.fits XY cyan N Usage: imgcat0_ds9reg_make ./local_red/FIXUP/20191022T025524.2_acm_sci.fits XY red N arg1 = name of FITS image run through image_catalogs arg2 = Use XY or Ra,DEC for coordinates (XY,RD) arg3 = color to be used fro region markers arg4 = run in debug mode? (Y/N) % ls 20191022T025524.2_acm_sci.cdfp 20191022T025524.2_acm_sci.cdfp.reg local_red/ S/ % head -5 20191022T025524.2_acm_sci.cdfp Ra_hrs,Dec_deg,Xcent,Ycent,isomag30,NumPix, 0.00 0.00 737.84 209.03 12.182 2081 0.00 0.00 472.52 90.99 14.993 468 0.00 0.00 168.15 756.53 15.865 365 0.00 0.00 562.44 186.81 16.122 320 % head -5 20191022T025524.2_acm_sci.cdfp.reg image circle(737.84,209.03,5.00) # color=cyan width=4 font="helvetica 20 normal roman" text={1} circle(472.52,90.99,5.00) # color=cyan width=4 font="helvetica 20 normal roman" text={2} circle(168.15,756.53,5.00) # color=cyan width=4 font="helvetica 20 normal roman" text={3} circle(562.44,186.81,5.00) # color=cyan width=4 font="helvetica 20 normal roman" text={4} NOTE that I could use the ./local_red/FIXUP/20191022T025524.2_acm_sci.fits name. This file actually does not exist at this location, but only the basename is extracted for use in imgcat0_ds9reg_make. The important files do exist in ./local_red/IMAGE_CATS/20191022T025524.2_acm_sci/. Finally I have the imgcat0_ds9reg_make call made and used in images_catalogs_review/, and I can see the overplotted regions file in the process of reviwing the catalogs:So far, we have simply made a regions file that could diplsayed in a ds9 frame.
If a version of our image with a valied WCS is available, then we can use that image to make a more informative cdfp file, namely one with accurate Ra,Dec values.
% best_wcs_image ./local_red/FIXUP/20191022T025524.2_acm_sci.fits N % cat best_wcs_image.out ./local_red/WCS/20191022T025524.2_acm_sci.fits % cat best_wcs_image.btype wcs First, we need a file named "Plate.Scale" that will be used to record the plate scale % image_ps ./local_red/WCS/20191022T025524.2_acm_sci.fits > Plate.Scale % cat Plate.Scale 0.27094460 0.00000173 We could make a more informative cdfp file with: % imgcat0_ds9reg_make ./local_red/WCS/20191022T025524.2_acm_sci.fits RD green N % head -5 20191022T025524.2_acm_sci.cdfp Ra_hrs,Dec_deg,Xcent,Ycent,isomag30,NumPix, 19.740600 26.221525000 737.84 209.03 12.182 2081 19.739346 26.207641667 472.52 90.99 14.993 468 19.736712 26.249802778 168.15 756.53 15.865 365 19.739687 26.216397222 562.44 186.81 16.122 320 % head -5 20191022T025524.2_acm_sci.cdfp.reg fk5 circle(296.10900879,26.22152519,6.97") # color=green width=4 font="helvetica 20 normal roman" text={1} circle(296.09017944,26.20764160,3.31") # color=green width=4 font="helvetica 20 normal roman" text={2} circle(296.05065918,26.24980354,2.92") # color=green width=4 font="helvetica 20 normal roman" text={3} circle(296.09530640,26.21639633,2.73") # color=green width=4 font="helvetica 20 normal roman" text={4}Note that the actual review routine, which will handle the display and overplotting of region files, will recognize an image with good WCS and will run the image_ps routine to get the Plate.Scale file.
The final routine to review our list of catalogs is rather simple to execute.
% image_catalogs_review list.1 **** Bingo, this works! All of the more that 300 detections are overplotted correctly in in frame 3.Hence, we can now review the catalogs using ds9 regions files immediately following the run of image_catalogs. Moreover, I'll make the same sort of call in photom2_prep EXCEPT there I will be using the "RD" option and the WCS-calibrated image to build the regions file (i.e. the coordinates type at the top of the regions file will be "fk5", note "image"). Fianlly, note that image_catalogs_review does attempt to locate an image version with valid WCS in the FITS header. If it is found, then an regions file is built using Ra,Dec and the sources are overplotted as RED markers in frame1 (the upper-left). If no valid WCS is found, the X,Y centroids are used to build the regions file and GREEN markers are used to overplot the sources in frame3 (the lower-left frame). Return to top of page.
It seems have a whole section on a prep code, but as is oftern the case, the bookwork involved in compileing a code can be more complicated and as critical as the actual code purpose. The code we want ti run, in this case photom2, will compute refined photometric parameters for the moments-based image parameters in the imgcat0 catalogs. Hence, we need acces to the imgcat0 information, specficially the X,Y location of the sources and the boundary box limits established for each source by the 4-connected pixel algorithm used in the imgcat0 routine.
The preparation code I developed for this is photom2_prep.
My first impulse was to develop photom2 not quite from scratch, but nearly so. I have a large number of well-tested image photometry routines in SCOLIB (namely SCOLIB.m2048ims.f) that power routines like ds9_imstats and mido.sh. Actaully the ds9_imstats code is just a wrapper that allows the user to build a ds9 regions file. The image processing work is done by misdo.sh, which measures photometric parameters for each aperture. A good first step would be experiment with these codes to derive aperture photometry at the imgcat0 p X,Y positions. This was deemed prudent before I went hacking up well-used library codes! The code developed for this is apphot.