Changeset 110
- Timestamp:
- Oct 7, 2003, 11:58:12 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/perl/src/flatten.flips (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/perl/src/flatten.flips
r70 r110 2 2 3 3 # grab the command line options 4 $ use_fringe = 0;4 $defringe = 0; 5 5 $use_mask = 1; 6 6 $fast = 0; … … 8 8 $close = ""; 9 9 $config = ""; 10 $preserve = 0; 10 11 @tARGV = (); 11 12 for (; @ARGV > 0; ) { … … 22 23 shift; shift; shift; next; 23 24 } 25 if ($ARGV[0] eq "-preserve") { 26 $preserve = 1; 27 shift; next; 28 } 24 29 if ($ARGV[0] eq "-fast") { 25 30 $fast = 1; … … 35 40 } 36 41 if ($ARGV[0] eq "-defringe") { 37 $ use_fringe = 1;42 $defringe = 1; 38 43 shift; next; 39 44 } … … 55 60 $mode = uppercase ($ARGV[3]); 56 61 62 $chipname = "-chipname"; 57 63 $infile = $input; 58 64 if ($mode eq "MEF") { $infile = "$input\[$ccd]"; } 65 if ($ccd eq "phu") { 66 $infile = "$input"; 67 $ccd = "ccd00"; 68 $chipname = ""; 69 } 59 70 60 71 # remove old file if it exists … … 63 74 64 75 # find the appropriate detrend images (need to fix output name for MEF - option?) 65 $flat=`detsearch $config -chipname -quiet -image $input $ccd $mode -type flat $close`; chop ($flat);76 $flat=`detsearch $config $chipname -quiet -image $input $ccd $mode -type flat $close`; chop ($flat); 66 77 if ($?) { die "ERROR: can't get flat for image\n"; } 67 78 68 79 if (!$fast) { 69 $bias=`detsearch $config -chipname -quiet -image $input $ccd $mode -type bias $close`; chop ($bias);80 $bias=`detsearch $config $chipname -quiet -image $input $ccd $mode -type bias $close`; chop ($bias); 70 81 if ($?) { die "ERROR: can't get bias for image\n"; } 71 82 72 $dark=`detsearch $config -chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark);83 $dark=`detsearch $config $chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark); 73 84 if ($?) { die "ERROR: can't get dark for image\n"; } 74 85 } … … 77 88 $mask = "none"; 78 89 if ($use_mask) { 79 $mask=`detsearch $config -chipname -quiet -image $input $ccd $mode -type mask $close`; chop ($mask);90 $mask=`detsearch $config $chipname -quiet -image $input $ccd $mode -type mask $close`; chop ($mask); 80 91 if ($?) { die "ERROR: can't get mask for image\n"; } 81 92 } … … 89 100 $fringe = "none"; 90 101 $frpts = "none"; 91 if ($use_fringe) { 92 93 die "ERROR: -fringe not yet available in flatten.flips\n"; 102 if ($defringe) { 94 103 95 104 $filterword = `gconfig $config FILTER-KEYWORD`; chop ($filterword); … … 107 116 108 117 # check for DEFRINGE, DEMODE 109 $ use_fringe = 0;118 $defringe = 0; 110 119 for ($i = 0; $i < @detypes; $i++) { 111 120 if ($detypes[$i] eq "fringe") { 112 if ($exptime >= $cutoffs[$i]) { $ use_fringe = 1; }121 if ($exptime >= $cutoffs[$i]) { $defringe = 1; } 113 122 last; 114 123 } 115 }116 117 # grab necessary detrend files118 if ($use_fringe) {119 $fringe = `detsearch $config -chipname -quiet -image $input $ccd $mode -type fringe $close`; chop ($fringe);120 if ($?) { die "ERROR: can't get fringe for image\n"; }121 122 $frpts = `detsearch $config -chipname -quiet -image $input $ccd $mode -type frpts $close`;123 if ($?) { die "ERROR: can't get fringe points for image\n"; }124 124 } 125 125 } … … 131 131 ($junk, $t1) = split (" ", `echo $input | fields $exptimeword`); 132 132 ($name, $t2) = split (" ", `echo $darkfile | fields $exptimeword`); 133 print STDERR "darktime: $input, $t1; $darkfile, $t2\n";134 133 $darkfactor = `darktime.$darkword $t1 $t2`; chop ($darkfactor); 135 134 if ($?) { die "ERROR: failure to get darkfactor $t1 $t2\n"; } … … 178 177 } 179 178 180 # header blocks 181 $line =~ s|DOHEADER| 0|;182 $line =~ s|NBLOCKS| 0|;179 # header blocks - we need an extra block for elixir keywords 180 $line =~ s|DOHEADER|1|; 181 $line =~ s|NBLOCKS|5|; 183 182 } 184 183 … … 193 192 $stat = $?; 194 193 195 unlink $temp; 194 if ($preserve) { 195 print STDERR "imred input file: $temp\n"; 196 } else { 197 unlink $temp; 198 } 199 200 if ($stat) { 201 if (! $quiet) { print STDOUT "ERROR: failure running flatten.flips\n"; } 202 exit 1; 203 } 204 205 if ($defringe) { 206 system ("mv $output $output.det"); 207 if ($?) { 208 print STDERR "failure to save temporary output file\n"; 209 exit 1; 210 } 211 212 system ("defringe.ccd -quiet $close $output.dat $output $ccd SPLIT"); 213 if ($?) { 214 print STDERR "failure in defringe\n"; 215 $stat = 1; 216 } 217 unlink "$output.dat"; 218 } 196 219 197 220 if (! $quiet) { … … 202 225 } 203 226 } 204 exit $stat; 227 228 # always return 1, don't return just the exit status 229 if ($stat) { 230 exit 1; 231 } else { 232 exit 0; 233 } 205 234 206 235 sub vsystem {
Note:
See TracChangeset
for help on using the changeset viewer.
