wcsf_ codes
Updated: Sep12,2018

The wcsf_ series of scripts drive the processes I use to derive and install WCS header information in FITS images.

The scripts described here are used in a sequential fashion to install WCS in image headers. In the examples below I show them using the same input file named "list.1" that lists the fullpath names of the images to be processed. These codes rely largely on graphical methods that use a variety of input parameters. To use custom values for these parameters you can build a local fle anemd "WCSF.DEFAULTS".


Here is a sample "WCSF.DEFAULTS" for running wcsf_viscat on a typical PFC image: 
 15.0    R2maglim      R2mag limit for initial 2-panel usno_identify run
 red     textcolor     Color for text labeling for initial 2-panel usno_identify run
 14      fontsize      Text size for initial 2-panel usno_identify run
 14.5    Vmag          V mag limit for wcs_refine run
 26.0    radius        search radius (arcminutes) for usno catalog in wcs_refine run
 10.0    circrad       radius (pixels) for source labels in wcs_refine run
 Blue    magname       name of USNO mag for final usno_look_wcs run
 14.0    magmax        mag limit for final usno_look_wcs run
 10.0    skysiglev     sky sigma threshold for imgcat0 run

Here is a sample "WCSF.DEFAULTS" for running wcsf_viscat on a typical PFC image: 
 15.0    R2maglim      R2mag limit for initial 2-panel usno_identify run
 red     textcolor     Color for text labeling for initial 2-panel usno_identify run
 14      fontsize      Text size for initial 2-panel usno_identify run
 14.5    Vmag          V mag limit for wcs_refine run
 26.0    radius        search radius (arcminutes) for usno catalog in wcs_refine run
 10.0    circrad       radius (pixels) for source labels in wcs_refine run
 Blue    magname       name of USNO mag for final usno_look_wcs run
 19.5    magmax        mag limit for final usno_look_wcs run
  5.0    skysiglev     sky sigma threshold for imgcat0 run

You can run the following to make a generic version of this file:  % wcsf_defaults N


Notice that all I really did here was change the last two parameters.
  1. wcsf_rough: survey images and install WCS headers
  2. wcsf_viscat: perform svisual review with catalog sources
  3. wcsf_imgcat: build a moments-based object catalog
  4. wcsf_final: fit (and archive) the final WCS
  5. wcsf_runall: run the above routine in sequence on a list of images



wcsf_rough: survey images and install WCS headers

Basic information about images in an input (full path) list of images is gathered. The user is given the option of running a simple gui application named usno_identify which is used to locate a single astrometric source per image. The resultant (X,Y) and (RA,DEC) pair is the used to establish the CRPIX1,CRPIX2 and CRVAL1,CRVAL2 header cards for the WCS portion of the FITS header in each image. This is usually the basic unknown for most of the images I handle (acm,pfc) where we usually have realiable ways to estimate plate scale and position angle on the sky. The script uses a list of images (list.1 below) that should use fullpath file names. The processed product images will be dumped in a reduction directoru named: ./local_red/ROUGHWCS.


% wcsf_rough --help 
% wcsf_rough list.1 N 
Usage: wcsf_rough image.list Y 
arg1 - Name of file with list of FITS images (can be full path)
arg2 - run in debug mode (Y/N)




wcsf_viscat: perform visual review with catalog sources

Here we can process each image with visual gui tools that overlay sources from the USNO-B1.0 catalog. This routine is going to take the basename of each image from the input list of (fullpath) files names (i.e. list.1 from the wcsf_rough section above). It is then going to take the corresponding image in ./local_red/ROUGHWCS and process it as described below. The final products are going to be deposited in the ./local_red/VISCAT directory. For each input image we will produce (in VISCAT):

  1. A copy of the validated or corrected FITS image
  2. A png image of the field with USNO targets overplotted.
  3. A cdfp file giving the USNOB1.0 Ra,Dec of targets in the field
The gui tools used in this script are named usno_look_wcs and named wcs_refine. The last routine, wcs_refine, is invoked only for cases where the images needs to be manually corrected on the fly. This could be to correct a small translation or field rotation.
 


% wcsf_viscat ./S/list.1 N  

WHAT THIS REALLY RUNS: 
wcs_refine    = visual resetiing of (X,Y,Ra,Dec) stars  (OPTIONAL)
usno_look_wcs = gather a final catalog of USNO stars for the image

Usage: wcs_refine 20180206T083937.3_acm_sci_proc.fits 17.0 3.0 0.5 11.5 red 4.0 
arg1 - image name 
arg2 - V magnitude limit in USNO catalog
arg3 - search Radius in arcmin
arg4 - stellarity low (0.5) 
arg5 - stellarity hi (11.5) 
arg6 - color of markers (red) 
arg7 - radius of circle markers in pixels (5) 

Usage: usno_look_wcs 20180206T083937.3_acm_sci_proc.fits Blue 18.00 1 
arg1 - name of FITS image with WCS installed 
arg2 - USNO mag name to be used for limit (Blue,V,Red) 
arg3 - magnitude limit 
arg4 - ds9 frame to display in  (0 for no disply) 


Note that this may seem like just a casual review of the quality of the roughly calibrated images. This is true, but more importantly, this script runs usno_look_wcs and collects a deeper astrometric catalog from the USNOB-1.0 catalog. These are the files with the suffix "-usno.cdfp", and they will be needed for running the last script (wcsf_final) that will refine our final WCS solution.




wcsf_imgcat: build a moments-based object catalog

To compute the final WCS solution we want to use as many targets as possible for each image. For this we'll need a catalog of detected sources for each image.


% wcsf_imgcat list.1 N  

Usage: wcsf_imgcat ./S/list.0 Y 
arg1 - Name of file with list of FITS images (can be full path)
arg2 - run in debug mode (Y/N)


The results are deposited into the ./local_red/IMGCAT0 directory. Each image produces about a dozen new files. You can read many of the details of these product files in a discussion of imgcat0. That doc links to a much more detailed discussion of image segmentation and contouring. The bottomline here is: for each image we create a cdfp catalog with our best estimates of Ra,Dec for the detected image sources. We'll cross-match these files with USNOB1.0 in the next section to derive a final (deeper and larger) list of WCS sources.




wcsf_final: fit (and archive) the final WCS

Here we use the image catalog computed for our image, and the USNO catalog compiled in an earlier step, to derive a final WCS solution. These final images will be deposited in the ./local_red/WCS directory.


% wcsf_final list.1 N N 

For much more detail use: 
% wcsf_final --help 
Usage: wcsf_final list.0 Y N 
arg1 - Name of file with list of FITS images (can be full path)
arg2 - Build a new ISNO catalog (Y/N)
arg3 - run in debug mode (Y/N)


After all of this, you may like to independently verify that you have a good wcs in your header. The "usno_look_wcs_run" will run the code ../usno_look_wcs until you find a useful magnitude type (Red,V,Blue) and limit for you image. This tool let's you choose differnt values until you see that the majorty of your targets have circles around them. Of course, if no stars have circles, or the circles are significantly offset, then you know that problems persist with your WCS solution. TRunning this tool is not mandatory, but it does provide a convenient way to make quick spot checks.




wcsf_runall: run the above routine in sequence on a list of images

This is just a wrapper for running all 4 wcdf_ routines on one list.


% wcsf_runall list.1 N 
For much more detail use: 
% wcsf_runall --help 




Back