#!/usr/bin/perl # # Convert Brian Skiff's file with data on "Aql/Sct red" stars into # a computer-friendly form. For example, # translate the HH MM SS and DD MM SS to decimal degrees of # RA and Dec for stars in the Dearborn spectral catalog file # while () { if (substr($_, 0, 1) eq "#") { printf "%s", $_; next; } $line = $_; chomp($line); if ((length($line) == 0) || (substr($line, 0, 1) eq " ")) { printf "\n", $line; next; } $name = substr($line, 0, 7); for ($i = 6; $i > 0; $i--) { if (substr($name, $i, 1) ne " ") { last; } } for ($j = 0; $j < $i; $j++) { if (substr($name, $j, 1) eq " ") { substr($name, $j, 1) = "_"; } } $rah = substr($line, 10, 2); $ram = substr($line, 13, 2); $ras = substr($line, 16, 5); $decd = substr($line, 22, 3); $decm = substr($line, 26, 2); $decs = substr($line, 29, 4); if ($decd =~ /-.*/) { $sign = -1; } else { $sign = 1; } $v = substr($line, 46, 4); if ($v eq " ") { $v = 99.0; } $notes = substr($line, 7, 1); $source = substr($line, 34, 1); $gsc = substr($line, 36, 9); $other = substr($line, 75, 5); $spec = substr($line, 51, 4); $leftover = length($line) - 53; if ($leftover > 0) { $remarks = substr($line, 56, $leftover); } else { $remarks = " "; } # calculate the RA and Dec in decimal degrees $ra_deg = ($rah + ($ram/60.0) + ($ras/3600.0))*15.0; if ($decd < 0) { $decd = 0.0 - $decd; } $dec_deg = $sign*($decd + ($decm/60.0) + ($decs/3600.0)); # now print out the information printf "%-10s %9.5f %9.5f %1s %1s %9s %4.1f %-4s %s\n", $name, $ra_deg, $dec_deg, $notes, $source, $gsc, $v, $spec, $remarks; } exit 0;