To compute a parallactic anle we need a number of pieces of information related to sky position (RA,DEC) and time (DATE, UT, ST). I've collected a set of scripts and programs that perform the coordinate, angle and time calculations need to manipulate these quantities. I record, in recipe-style, the codes as used here.
I start here with the final script that I used to confirm my parallactic angle calculations. I show a sample run, and then the source code.
% Cal_q.sh* list.HA list.DEC list.PARANGLE To plot the results: % qplot.py -10 380 -10 380 % cat Cal_q.sh #!/bin/bash # Test the use of mcd_parallactic_angle routine # Check that an argument is present if [ -z "$1" ] then printf "Usage: Cal_LST.sh list.HA list.DEC list.PARANGLE \n" printf "arg1 = file of HA (sex)\n" printf "arg2 = file of DEC (sex)\n" printf "arg3 = file of Q (expected)\n" exit 1 fi if [ -z "$2" ] then printf "arg2 = file of DEC (sex)\n" exit 2 fi if [ -z "$3" ] then printf "arg3 = file of Q (expected)\n" exit 3 fi i="0" # Read each line in the input files (= $1, $2, $3) # using file descriptor 4 exec 3<$1 exec 4<$2 exec 5<$3 while read -u3 HAsex do i=$[$i+1] read -u4 DECsex read -u5 Qexp sex_hours_2_deg.sh $HAsex > junk1 read HAdeg < junk1 sex2float.sh $DECsex > junk2 read DECdeg < junk2 # Compute the Q mcd_parallactic_angle $HAdeg $DECdeg > junk3 read Q < junk3 #echo $HAsex $DECsex $HAdeg $DECdeg $Qexp $Q echo $Qexp $Q done # Clean up \rm -f calc_parangle.log junk1 junk3 sex_hours_2_deg.log \rm -f junk2 pars.in sex2float.log sexprep.logTo compute a parallactic angle from the command line (assuming your are at McDonald Observatory:
% mcd_parallactic_angle -20.206375122 0.129916667 Usage: mcd_parallactic_angle -20.20637499 16.808833333 arg1 - HA in units of degrees arg2 = DEC in units of degrees A simple script to recall the McDonald information: % mcdlonlat Usage: mcdlonlat Y Usage: mcdlonlat arg1 - Y flag for verbose output long = -104.0216667 degrees (- means WEST) lat = +30.6716667 degrees (+ means NORTH) % mcdlonlat N -104.0216667 +30.6716667 The more general script (where you feed a latitude): % calc_parangle.sh +30.6716667 -20.206375122 0.129916667 149.694625463Notice that my script requires parameters that are expressed as ANGLES in units of DEGREES. Quantities like RA, DEC, and Time rarely are provided this way. How do we obtain them?
I have a number of routines that convert Time/Coordinate strings in sexigecimal (sex) format. The first (sexprep) is one that is mundane, but extremely useful:
% sexprep.sh list.RA > new_file arg1 - name of ASCII input file with sexigecimal lines % cat list.RA 14:34:12.27 14:27:07.61 14 27 06.98 14h55m17.62777s 14h07m07.17s +14:49:45.5488488 -14:49:46.0334 08:45:32 08:45:33.23222 -14:27:15.14 % cat new_file 14:34:12.27 14:27:07.61 14:27:06.98 14:55:17.62777 14:07:07.17 +14:49:45.5488488 -14:49:46.0334 08:45:32 08:45:33.23222 -14:27:15.14The corrected (standardized) strings are written to standard out, but in a script application (like for Cal_q.sh above) they are usually directed to a file (in the case above we direct to file "new_file"). The output strings should now be terminated properly, and any signs attached to the input strings should be preserved.
Once the sexigecimal strings are standardized, then we usally want to convert to a floating point angle in units of DEGREES. If the string is expressed in HOURS (like is often done with things like RA, HA, ST) we must multiply by a constant (15.0 in most cases). The tools I have for these sorts of tasks are shown below (they all write to standard out):
Convert sex string directly to floating point degrees: % sex2float.py 14:34:12.27 14.570075000 % sex2float.sh 14:34:12.27 14.570075000 Convert sex string in HOURS to floating point degrees: % sex_hours_2_deg.py 14:34:12.27 218.551125000 % sex_hours_2_deg.sh 14:34:12.27 218.551132202 % sex_hours_2_deg.sh -14:34:12.27 -218.551132202Notice that these routines preserve the sign of a quantity. The HA value will often have a sign that is important to preserve (i.e. a negative HA is used for an object that is observed WEST of the meridian). With these routines in place, it is easy to write something that computes hour angle (HA):
% cal_from_sex_HA.py 14:34:12.27 11:52:58.9416 -40.305535000 where, 14:34:12.27 = the object right ascension (RA) 11:52:58.9416 = the local sideral time (LST)
Compute the Apparent Local Sideral Time given an input UT date/time in isot format.
% mcdLST.py 2008-05-03T04:27:12.36 Usage: mcdLST.py 2008-05-03T04:27:12.36 The ISOT format: yyyy mm dd hh mm ss.ss 2008-05-03T04:27:12.36 NOTE: I looked for quite some time throught the Astropy.Time documentation, but could not learn what ISOT stands for. Time: 2008-05-03T04:27:12.360 Julian Date = 2454589.685560 Modified Julian Date = 54589.185560 12h16m54.548s 12:16:56.09 (Expected LST)Acually, the above run is a special case. For practical concerns I have turned off the JD and MJD outputs, and I do not print the "Expected LST" unless it is recognized for this one case (i.e. 2008-05-03T04:27:12.36). Hence, a more normal run would be:
% mcdLST.py 2011-05-23T14:18:12.36 23h25m31.4784sNow it is clear why something like "sexprep.sh" is useful: it can be used to strip out the "h", "m", and "s" characters and then produce a value in degree units.