Changeset 47
- Timestamp:
- Feb 14, 2003, 2:06:00 AM (23 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/perl/src/dt.select (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/perl/src/dt.select
r17 r47 10 10 $output = $ARGV[4]; 11 11 $mode = $ARGV[5]; 12 13 $ptolemy = $ENV{'PTOLEMY'}; 14 print "PTOLEMY: $ptolemy\n"; 15 system ("cp $ptolemy /h/eugene/ptolemy.config"); 12 16 13 17 unless ($output =~ /CCDNUM/) { die "ERROR: output file needs CCDNUM component\n"; } … … 30 34 if ($filter eq "HA") { $min = 1000; } 31 35 if ($filter eq "HAOFF") { $min = 1000; } 36 # these should come from the filter tables 32 37 # probably need to set these in a more intelligent fashion. 33 38 } … … 35 40 # relevant camera parameters 36 41 $Nccd = `cameraconfig -Nccd`; chop ($Nccd); 37 $line = `cameraconfig -axes`; chop ($line); 38 ($Naxis1, $Naxis2) = split (" ", $line); 42 if ($?) { die "error in config\n"; } 43 44 ($Naxis1, $Naxis2) = split (" ", `cameraconfig -axes`); 45 if ($?) { die "error in config\n"; } 46 47 @ccds = split (" ", `cameraconfig -ccds`); 48 if ($?) { die "error in config\n"; } 49 50 @ccdn = split (" ", `cameraconfig -ccdn`); 51 if ($?) { die "error in config\n"; } 39 52 40 53 @good = (); … … 45 58 if ($type eq "FLAT") { 46 59 # 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"; 53 63 } 54 64 } … … 63 73 @list = (); 64 74 foreach $line (@filtline) { 65 @tlist = `imsearch -ccd 0$line`;75 @tlist = `imsearch -ccd $ccds[0] $line`; 66 76 @list = (@list, @tlist); 67 77 } … … 72 82 foreach $frame (@list) { 73 83 @words = split (" ",$frame); 74 print "$words[5]\n";75 84 76 85 # skip domeflat images … … 92 101 @answer = <$words[4]/*.fits>; 93 102 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; } 94 106 } 95 107 96 108 # images have to have the correct dimensions 97 109 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`); 99 111 } 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`); 101 113 } 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; } 104 117 105 # search for Nccd images with same name106 if ($mode eq " split") {118 # must have Nccd entries in db: 119 if ($mode eq "SPLIT") { 107 120 @answer = split ("/", $words[4]); 108 121 $match = $answer[-1]; … … 110 123 $match = $words[5]; 111 124 } 112 @list2 = `imsearch - seq -name $match`;125 @list2 = `imsearch -name $match`; 113 126 if (@list2 != $Nccd) { print STDERR "$words[5] rejected: missing entries in image database\n"; next FRAME; } 114 127 … … 119 132 @words2 = split (" ", $chip); 120 133 121 # test for acceptable fluxrange122 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; } 124 137 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; } 130 141 } 131 142 } 132 143 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 134 147 foreach $line (@list2) { 135 148 @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 } 138 155 } 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; } 142 159 } 143 160 144 # write output to Nccd files161 # write output to Nccd list files 145 162 for ($i = 0; $i < $Nccd; $i++) { 163 $ccd = $ccdn[$i]; 164 $ccdid = $ccds[$i]; 165 146 166 $name = $output; 147 $ccd = sprintf "%02d", $i;148 167 $name =~ s/CCDNUM/$ccd/; 149 $tmp = sprintf "chip%02d", $i;150 168 151 169 open (LIST, ">$name"); 152 foreach $line (@$ tmp) {170 foreach $line (@$ccdid) { 153 171 print LIST "$line\n"; 154 172 } 155 173 close (LIST); 156 174 } 157 print "\n"; 158 print STDERR "SUCCESS\n"; 175 print STDERR "SUCCESS\n\n"; 159 176 exit 0; 160 177
Note:
See TracChangeset
for help on using the changeset viewer.
