What a ride. As it turns out, I did a lot of research on parallactic angle calculations. You can read about most of this here!
Compute the parallactic angle, Q, for a CAT image. Actually, I wrote two versions of this. The first, called cat2qlist takes an input list of files and positions (see below) and derives the parallactic angle and position angle for each of them. In the cat2q routine, I simply read the input on the command line for one image. In the cat2q version I use a way to get variables assigned from runs of other scripts (as opposed to writing to an intermediate file), and I use a formatted printf. So, I iclude the source for BOTH of these scripts below.
% ls Expected.Q list.1 README S0/ % cat list.1 20140219T030632.1_cat_sci.fits 07:27:25.80 +66:19:54.0 20140219T031453.4_cat_sci.fits 06:12:51.10 +65:43:06.0 20140219T044549.8_cat_sci.fits 08:30:15.90 +60:43:05.0 20140219T051011.5_cat_sci.fits 09:25:44.20 +63:56:27.0 20140219T053130.2_cat_sci.fits 08:30:15.90 +60:43:05.0 Usage: cat2qlist list.1 N arg1 = input list of [image,Ra,Dec] values arg2 = "Y" for verbose output % cat2qlist list.1 N 07:27:25.80 +66:19:54.0 20140219T030632.1_cat_sci.fits 06:12:51.10 +65:43:06.0 20140219T031453.4_cat_sci.fits 08:30:15.90 +60:43:05.0 20140219T044549.8_cat_sci.fits 09:25:44.20 +63:56:27.0 20140219T051011.5_cat_sci.fits 08:30:15.90 +60:43:05.0 20140219T053130.2_cat_sci.fits Your answers are in the files: list.Q and list.catPAdeg % ls a junk2 list.1 list.DECdeg list.HAdeg list.Q list.ST S/ junk1 junk3 list.catPAdeg list.DECsex list.LST list.RAsex pars.in % cat Expected.Q 29.13 359.27 18.74 28.69 359.35 % cat list.Q 29.13 359.27 18.74 28.69 359.35 You can run a test of this in $tdata: /home/sco/sco/projects/Test_Data_for_Codes/T_runs/cat2q/ex1The input list (list.1) includes the information we'll need: time of the observation and Ra,Dec. In this version, we'll use scripts that assume we are working from McDonald Observatory. The output we desire is in "list.Q", but other list files, possible of some use in other scripts, are also creates (list.RAsex, list.HAdeg, etc...). The script that performs this calcualtion uses a variety of very useful routines (bash, otw/gfortran, and python). Many of those routines are explained in this are explained in this in this document. Below I show the full cat2q script and illustrate a few other feature. Really, including the documention on cat2q here is just a place-holder. The CAT camera will fade into history soon, but the tools that went into cat2q will be used for many future projects.
#!/bin/bash # Compute parallactic angles for McDonald Obs. CAT images # Check that an argument is present if [ -z "$1" ] then printf "Usage: cat2q 20140219T030632.1_cat_sci.fits 07:27:25.80 +66:19:54.0\n" printf "arg1 = CAT image fits file name \n" printf "arg2 = RA in sexigecimal format \n" printf "arg3 = DEC in sexigecimal format \n" exit 1 fi # Put commandline arguments into easy varaible names catname="$1" RAsex="$2" DECsex="$3" #printf "$RAsex $DECsex $catname\n" # Construct the isot date/time strings isot=$(cat2isot.sh $catname) #printf "ISOT string: $isot\n" LST=$(mcdLST.py $isot) #printf "local sidereal time (LST) string: $LST\n" # Write the LST string to a file for run for sexprep echo $LST > list.LST # prepare the ST file (clean the sexigecimal) STsex=$(sexprep.sh list.LST) #printf "clean local sidereal time (LST) string: $STsex\n" # Compute the HA HAdeg=$(cal_from_sex_HA.py $RAsex $STsex) #printf "HA(degrees) = $HAdeg\n" # get DECdeg DECdeg=$(sex2float.sh $DECsex) #printf "DEC(degrees) = $DECdeg\n" # Compute the Q Q=$(mcd_parallactic_angle $HAdeg $DECdeg) #printf "Parallactic angle (Q) = $Q \n" # Compute CAT PA PAdeg=$(q2catpa.sh $Q) #printf "CAT position angle (PA) = $PAdeg\n" printf "%9.3f %9.3f\n" $Q $PAdeg # Do some clean up #\rm -f junk1 junk2 junk3 pars.in
The cat2qlist script may be more useful for processing a long list of images. I include the source here.
#!/bin/bash # Compute parallactic angles for McDonald Obs. CAT images # Check that an argument is present if [ -z "$1" ] then printf "Usage: cat2qlist list.1 N \n" printf "arg1 = input list of [image,Ra,Dec] values \n" printf 'arg2 = "Y" for verbose output \n' exit 1 fi # delete files from a previous run \rm -f list.RAsex list.DECsex list.LST list.ST list.Q \rm -f list.DECdeg list.HAdeg list.catPAdeg # Create individual lists of LST,RA,DEC (all in # sexigecimal string format) i="0" # Read each line in the input file (= $1) # using file descriptor 3 exec 3<$1 while read -u3 catname RAsex DECsex do i=$[$i+1] printf "$RAsex $DECsex $catname\n" # Construct the isot date/time strings cat2isot.sh $catname >a read isot > list.LST # Write to the Ra,Dec list files printf " $RAsex \n" >> list.RAsex printf " $DECsex \n" >> list.DECsex done # prepare the ST file (clean the sexigecimal) sexprep.sh list.LST > list.ST # Now process each line in the list.RAsex, list.DECsex # list.ST files you have just built i="0" # Read each line in the input files (= $1, $2, $3) # using file descriptor 4 exec 3Notice above that the first thing we do is read the input list and create files of RA,DEC and LST. The LST are computed with the routine mcdLST.py after I generate the ISOT time string with cat2isot.sh. Next, we process these file to generate the Q values written to list.Q. Finally, the custom (OTW) code called q2catpa.sh is used to transform parallactic angles (q) to the CAT position angles (in list.catPAdeg). With these final PA values, I can generate North vectors in the CAT images shown below.junk1 read HAdeg < junk1 printf " $HAdeg \n" >>list.HAdeg # get DECdeg sex2float.sh $DECsex > junk2 read DECdeg < junk2 printf " $DECdeg \n" >>list.DECdeg # Compute the Q mcd_parallactic_angle $HAdeg $DECdeg > junk3 read Q < junk3 printf " $Q \n" >>list.Q # Compute CAT PA q2catpa.sh $Q >>list.catPAdeg if [ "$2" = "Y" ] then printf "$STsex $RAsex $DECsex\n" printf "HA (degrees) this image = $HAdeg\n" printf "DEC (degrees) this image = $DECdeg\n" printf "Parallactic angle, Q = $Q\n" fi done # Do some clean up #\rm -f junk1 junk2 junk3 pars.in
Below I show some results of practice runs (in my Test_Data directories) of cat2q. These examples are found in:
$tdata/T_runs/cat2q/ex0
![]() |
In the left panel I show the raw CAT image of NGC2355 (jan17_2015).
This image (20150117T041016.0_cat_sci.fits) was processed with
the cat2q script to compute the q and PA. The PA=220 value I
"drew in by hand" above using a ds9 vector marker. In the
right panel I show a smoothed version of this image that had
WCS that was processed by astrometry.net. You can see in the
small sub-window in the upper-right that the North vector for
this WCS agrees approximately to that predicted with cat2q. It
is useful to record the ds9 regions file I used to generate the
North marker in the left panel:
% cat ds9.reg # Region file format: DS9 version 4.1 # Filename: 20150117T041016.0_cat_sci.fits physical # vector(822.93276,621.97311,492.04,312.709) vector=1 color=white width=4 text={North}Note that the last two arguments for a vector are the length and the angle. The angle for a ds9 vector is measured CCW from the +X axis. |
![]() |
Much like above, but with NGC869. The vector drawn in both panels was generated (n.reg) manually to give a vector pointing at CAT_PA = 44 deg. This would correspond to a ds9 angle = 134 deg. |