#!/usr/bin/perl
# writewcs.pl
# Program, ki v podane datoteke vpise prave WCS koordinate
#  Jure Skvarc, Marec 1999
#   Definicije parametrov
#=========================
#  Starcount
$prag = 10;    # Prag zaznave
$box = 30;    # Velikost okna, v katerem dolocam povprecno vrednost ozadja

#$usno   ="/var/data/katalogi/usno_SA2";
#$catname="/var/data/katalogi/gsc";
#$tycho  ="/var/data/katalogi/Tycho2/data/";

$usno   ="/home/data/catalogs/usno_A2";
$catname="/home/data/catalogs/gsc";
$tycho  ="/home/data/catalogs/Tycho2/data/";



for $a (@ARGV) {   #  Berem, dokler ni datoteka zaprta
    printf "\n$a\n";
    #  Obdelam slike
    `starcount -l log.dat -s $prag -n 3.0 -o 10.0 -A -m $box $a`;
    $aless = $a;
    #  Odrezem koncnico fts
    $aless =~ s/\.fts//g;
    #  Naredim match s katalogom in vpisem prave koordinate
    `catalog -f $aless.dat -o 5 -e 7.0 -m 18 -D 10.0 -r 1.5 -b 300 -n 15 -N 6 -X 15 -W -A -c tycho2:$tycho -c gscn:$catname -c gscs:$catname -c usno:$usno`;

}

