IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 47


Ignore:
Timestamp:
Feb 14, 2003, 2:06:00 AM (23 years ago)
Author:
eugene
Message:

megacan & flips2 upgrades

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/perl/src/dt.select

    r17 r47  
    1010$output = $ARGV[4];
    1111$mode   = $ARGV[5];
     12
     13$ptolemy = $ENV{'PTOLEMY'};
     14print "PTOLEMY: $ptolemy\n";
     15system ("cp $ptolemy /h/eugene/ptolemy.config");
    1216
    1317unless ($output =~ /CCDNUM/) { die "ERROR: output file needs CCDNUM component\n"; }
     
    3034    if ($filter eq "HA")    { $min = 1000; }
    3135    if ($filter eq "HAOFF") { $min = 1000; }
     36    # these should come from the filter tables
    3237    # probably need to set these in a more intelligent fashion.
    3338}
     
    3540# relevant camera parameters
    3641$Nccd = `cameraconfig -Nccd`; chop ($Nccd);
    37 $line = `cameraconfig -axes`; chop ($line);
    38 ($Naxis1, $Naxis2) = split (" ", $line);
     42if ($?) { die "error in config\n"; }
     43
     44($Naxis1, $Naxis2) = split (" ", `cameraconfig -axes`);
     45if ($?) { die "error in config\n"; }
     46
     47@ccds = split (" ", `cameraconfig -ccds`);
     48if ($?) { die "error in config\n"; }
     49
     50@ccdn = split (" ", `cameraconfig -ccdn`);
     51if ($?) { die "error in config\n"; }
    3952
    4053@good = ();
     
    4558if ($type eq "FLAT") {
    4659    # convert given filter name to list of possible names:
    47     print STDERR "filtnames $filter -all\n";
    48     @filtlist = `filtnames $filter -all`;
    49     foreach $name (@filtlist) {
    50         chop $name;
    51         $line = "-type flat -filter $name -mode $mode -trange $start $stop";
    52         push @filtline, $line;
     60    @filtlist = split (" ", `filtnames $filter -all`);
     61    foreach $filt (@filtlist) {
     62        push @filtline, "-type flat -filter $filt -mode $mode -trange $start $stop";
    5363    }
    5464}
     
    6373@list = ();
    6474foreach $line (@filtline) {
    65     @tlist = `imsearch -ccd 0 $line`;
     75    @tlist = `imsearch -ccd $ccds[0] $line`;
    6676    @list = (@list, @tlist);
    6777}
     
    7282foreach $frame (@list) {
    7383    @words = split (" ",$frame);
    74     print "$words[5]\n";
    7584
    7685    # skip domeflat images
     
    92101        @answer = <$words[4]/*.fits>;
    93102        if (@answer != $Nccd) { print STDERR "$words[5] rejected: missing images\n"; next FRAME; }
     103    } else {
     104        # base file should exist:
     105        if (! -e "$words[4]/$words[5]") { print STDERR "file $words[4]/$words[5] missing, skipping\n"; next FRAME; }
    94106    }
    95107
    96108    # images have to have the correct dimensions
    97109    if ($mode eq "SPLIT") {
    98         $answer = `echo $words[4]/$words[5] | fields NAXIS1 NAXIS2`;
     110        ($tmp, $Nx, $Ny) = split (" ", `echo $words[4]/$words[5] | fields NAXIS1 NAXIS2`);
    99111    } else {
    100         $answer = `echo $words[4]/$words[5] | fields -x 0 NAXIS1 NAXIS2`;
     112        ($tmp, $Nx, $Ny) = split (" ", `echo $words[4]/$words[5] | fields -x 0 NAXIS1 NAXIS2`);
    101113    }
    102     ($tmp, $Nx, $Ny) = split (" ", $answer);
    103     if (($Nx != $Naxis1) || ($Ny != $Naxis2)) { print STDERR "$words[5] rejected: wrong dimensions\n"; next FRAME; }
     114    if ($?) { print STDERR "failure to find NAXIS1, NAXIS2 in file $words[4]/$words[5], skipping\n"; next FRAME; }
     115    if ($Nx != $Naxis1) { print STDERR "$words[5] rejected: wrong dimensions\n"; next FRAME; }
     116    if ($Ny != $Naxis2) { print STDERR "$words[5] rejected: wrong dimensions\n"; next FRAME; }
    104117   
    105     # search for Nccd images with same name
    106     if ($mode eq "split") {
     118    # must have Nccd entries in db:
     119    if ($mode eq "SPLIT") {
    107120        @answer = split ("/", $words[4]);
    108121        $match = $answer[-1];
     
    110123        $match = $words[5];
    111124    }
    112     @list2 = `imsearch -seq -name $match`;
     125    @list2 = `imsearch -name $match`;
    113126    if (@list2 != $Nccd) { print STDERR "$words[5] rejected: missing entries in image database\n"; next FRAME; }
    114127
     
    119132            @words2 = split (" ", $chip);
    120133           
    121             # test for acceptable flux range
    122             if ($words2[11] < $min) { $range = 0; print STDERR "$words[5] rejected: signal too low: $words2[11] vs $min\n"; next FRAME; }
    123             if ($words2[11] > $max) { $range = 0; print STDERR "$words[5] rejected: signal too high: $words2[11] vs $max\n"; next FRAME; }
     134            # test for acceptable counts range
     135            if ($words2[11] < $min) { print STDERR "$words[5] rejected: signal too low: $words2[11] vs $min\n"; next FRAME; }
     136            if ($words2[11] > $max) { print STDERR "$words[5] rejected: signal too high: $words2[11] vs $max\n"; next FRAME; }
    124137           
    125             # test for acceptable rate
    126             if (($words2[11] / $words2[7]) < $minrate) {
    127               $rate = 0;
    128               $F = $words2[11] / $words2[7];
    129               print STDERR "$words[5] rejected: flux too low: $F vs $minrate\n"; next FRAME; }
     138            # test for acceptable flux
     139            $Flux = $words2[11] / $words2[7];
     140            if ($Flux < $minrate) { print STDERR "$words[5] rejected: flux too low: $Flux vs $minrate\n"; next FRAME; }
    130141        }
    131142    }
    132143
    133     # add good images to the output lists
     144    # add good images to the output lists (use CCD N for output filenames, CCD ID for [extname] in mef files)
     145    # entries are not guaranteed to be in CCD N sequence
     146
    134147    foreach $line (@list2) {
    135148        @words2 = split (" ", $line);
    136         $tmp = sprintf "chip%02d", $words2[3];
    137         @$tmp = (@$tmp, "$words2[4]/$words2[5]");
     149        $ccdid  = $words2[3];
     150        if ($mode eq "MEF") {
     151            @$ccdid = (@$ccdid, "$words2[4]/$words2[5]\[$ccdid]");
     152        } else {
     153            @$ccdid = (@$ccdid, "$words2[4]/$words2[5]");
     154        }
    138155    }
    139     if (($type eq "BIAS") && (@$tmp > 30)) { last FRAME; }
    140     if (($type eq "DARK") && (@$tmp > 30)) { last FRAME; }
    141     if (($type eq "FLAT") && (@$tmp > 50)) { last FRAME; }
     156    if (($type eq "BIAS") && (@$ccdid > 30)) { last FRAME; }
     157    if (($type eq "DARK") && (@$ccdid > 30)) { last FRAME; }
     158    if (($type eq "FLAT") && (@$ccdid > 50)) { last FRAME; }
    142159}
    143160
    144 # write output to Nccd files
     161# write output to Nccd list files
    145162for ($i = 0; $i < $Nccd; $i++) {
     163    $ccd   = $ccdn[$i];
     164    $ccdid = $ccds[$i];
     165
    146166    $name = $output;
    147     $ccd = sprintf "%02d", $i;
    148167    $name =~ s/CCDNUM/$ccd/;
    149     $tmp = sprintf "chip%02d", $i;
    150168
    151169    open (LIST, ">$name");
    152     foreach $line (@$tmp) {
     170    foreach $line (@$ccdid) {
    153171        print LIST "$line\n";
    154172    }
    155173    close (LIST);
    156174}
    157 print "\n";
    158 print STDERR "SUCCESS\n";
     175print STDERR "SUCCESS\n\n";
    159176exit 0;
    160177
Note: See TracChangeset for help on using the changeset viewer.