PERL SCRIPT FOR STANDARD STAR PHOTOMETRY

This is used to convert standard star photometry results into catalog template.

#!/usr/bin/perl
#this script is for standard star only.
# revision history
# 1. written by Wei-Chun Jao (08/03/2005)
# 2. shuffle columns to match photometry master list (08/14/2007)


system("rm -rf standard.catalog");

print "!!!!!!!!!!!!!!!!!!!!!!!\n";
print "FOR STANDARD STARS ONLY\n";
print "!!!!!!!!!!!!!!!!!!!!!!!\n";


print STDOUT " Who are you?\n";
$who=;
chomp($who);

#-------------------------------
# read in coefficient file name 
#-------------------------------

use Date::Format;

 $Ldate = time2str("%Y-%m-%d", time);

print STDOUT "Enter the image sets file (ex:standard.imsets):\n";
$cf=;

#-------------------------------
# read in the file name contains mag/airmass
#------------------------------- 
print STDOUT "Enter the output file name from MKNOBSFILE task(ex:standard.obs):\n";
$of=;



open(cfile,$cf) or die "Can't open $cf file";
open(ofile,$of) or die "Can't open $of file";

chop(@fname=);
chop(@obsdata=);

close(ofile);

open(output,">>standard.catalog");

printf output "DATE                   OBJECT       FILTER     A/M   AP      MAG    SNerr  S*err flg   DATE RED.  WHO    STATUS                      MULTIPLE SEPARATION        NOTES                    \n";


$stand="STAND";

#---------------------------------------------------------
# calculate how many lines in *.obs file ($line)
# calculate how many stars are in this file ($starnum)
#---------------------------------------------------------
$line=@obsdata;
$starnum=($line-3)/3;

for ($i=0;$i<=$starnum;$i++) {

($starname[$i],$column[$i],$vfile[$i], $rfile[$i],$ifile[$i])=split(" ",$fname[$i],5);

}

# split the array into several columns...

for ($i=3;$i<=$line-1;$i++) {

($id[$i-3],$filter[$i-3],$time[$i-3],$am[$i-3],$x[$i-3],$y[$i-3],$mag[$i-3],$snerr[$i-3])
    =split(" ",$obsdata[$i],8);

}

for ($i=0;$i<$starnum;$i++) {

#printf output "%-15s  %2s  %22s    %4.3f  %27s  %12s  %6s",
#      $id[$i*3], $filter[$i*3],@vfile[$i],$am[$i*3],$space,$Ldate,$who;
#printf output "%-15s  %2s  %22s    %4.3f  %27s  %12s  %6s",
#      $id[$i*3], $filter[$i*3+1],@rfile[$i],$am[$i*3+1],$space,$Ldate,$who;
#printf output "%-15s  %2s  %22s    %4.3f  %27s  %12s  %6s",
#      $id[$i*3], $filter[$i*3+2],@ifile[$i],$am[$i*3+2],$space,$Ldate,$who;



#19991128.09.083.o      SA98-670        r      1.193  14"     STAND  STAND  STAND  81  2003-10-22  CTF  . BAD NIGHT                 .                          .
#20070719.09.063.o      TVL513-46546    i      1.711  14"    14.977  0.007  0.024  10  2007-07-24  JPS  .                           .                          .

printf output "%-23s%-16s%-7s%5.3f  %-5s  %6s  %5s  %5s  %2s  %10s  %3s  %1s%28s%27s\n",
@vfile[$i], $id[$i*3], $filter[$i*3], $am[$i*3], "14\"", $stand, $stand, $stand, "80", $Ldate, $who, ".", ".", ".";

printf output "%-23s%-16s%-7s%5.3f  %-5s  %6s  %5s  %5s  %2s  %10s  %3s  %1s%28s%27s\n",
@rfile[$i], $id[$i*3], $filter[$i*3+1], $am[$i*3+1], "14\"", $stand, $stand, $stand, "80", $Ldate, $who, ".", ".", ".";

printf output "%-23s%-16s%-7s%5.3f  %-5s  %6s  %5s  %5s  %2s  %10s  %3s  %1s%28s%27s\n",
@ifile[$i], $id[$i*3], $filter[$i*3+2], $am[$i*3+2], "14\"", $stand, $stand, $stand, "80", $Ldate, $who, ".", ".", ".";



}


print "Please make necessary changes for aperture size or photometry quality code\n";
print "Default aperture size is 14\" and photometry quality code is 80 for standard stars\n";