Changeset 16276 for trunk/ippScripts/scripts/flatcorr_proc.pl
- Timestamp:
- Feb 1, 2008, 1:43:05 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/flatcorr_proc.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/flatcorr_proc.pl
r15356 r16276 8 8 9 9 # relphot -D CATDIR $dvodb -grid (outgrid.fits) (filter) -region 0 360 -90 90 (other parameters?) 10 11 # detselect flat?12 10 13 11 # dvoMakeCorr -file outgrid.fits -ref ref.fits outcorr … … 52 50 use Pod::Usage qw( pod2usage ); 53 51 54 my ($ dvo_id, $catdir, $region, $dbname, $workdir, $no_update, $no_op);52 my ($corr_id, $dvodb, $region, $filter, $dbname, $workdir, $no_update, $no_op); 55 53 GetOptions( 56 ' dvo_id|i=s' => \$dvo_id,57 ' catdir|c=s' => \$catdir,54 'corr_id|i=s' => \$corr_id, 55 'dvodb|c=s' => \$dvodb, 58 56 'region|r=s' => \$region, 57 'filter|f=s' => \$filter, 59 58 'dbname|d=s' => \$dbname,# Database name 60 59 'workdir|w=s' => \$workdir, # Working directory for output files … … 64 63 65 64 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 66 pod2usage( -msg => "Required options: -- dvo_id --catdir --region",65 pod2usage( -msg => "Required options: --corr_id --dvodb --region --filter", 67 66 -exitval => 3) unless 68 defined $dvo_id and 69 defined $catdir and 70 defined $region; 67 defined $corr_id and 68 defined $dvodb and 69 defined $region and 70 defined $filter; 71 71 72 72 # Look for programs we need 73 73 my $missing_tools; 74 my $ addstar = can_run('addstar') or (warn "Can't find addstar"and $missing_tools = 1);75 my $ relphot = can_run('relphot') or (warn "Can't find relphot" and $missing_tools = 1);76 my $ uniphot = can_run('uniphot') or (warn "Can't find uniphot"and $missing_tools = 1);77 my $ relastro = can_run('relastro') or (warn "Can't find relastro"and $missing_tools = 1);78 my $ caltool = can_run('caltool') or (warn "Can't find caltool"and $missing_tools = 1);74 my $relphot = can_run('relphot') or (warn "Can't find relphot" and $missing_tools = 1); 75 my $dvoMakeCorr = can_run('dvoMakeCorr') or (warn "Can't find dvoMakeCorr" and $missing_tools = 1); 76 my $detselect = can_run('detselect') or (warn "Can't find detselect" and $missing_tools = 1); 77 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 78 my $flatcorr = can_run('flatcorr') or (warn "Can't find flatcorr" and $missing_tools = 1); 79 79 80 80 if ($missing_tools) { … … 83 83 } 84 84 85 # select the primary filters from DVO query? 86 my (@filters) = `photcodeList -average`; 85 my($outgrid, $outcorr); 86 87 $outgrid = "$workdir/grid.$corr_id.fits"; 88 $outcorr = "$workdir/corr.$corr_id.fits"; 87 89 88 90 # parse the region (RAs,RAe:DECs,DECe) : item = +/-NNN.NNNN … … 91 93 my ($DECs, $DECe) = split (",", $coords[1]); 92 94 93 # Run addstar -resort94 { 95 my $command = "$ addstar -resort";96 $command .= "-D CATDIR $ catdir";95 # Run relphot (filter) for each filter 96 { 97 my $command = "$relphot $filter"; 98 $command .= "-D CATDIR $dvodb"; 97 99 $command .= "-region $RAs $RAe $DECs $DECe"; 98 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 100 cache_run(command => $command, verbose => 1); 101 102 unless ($success) { 103 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 104 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RESORT", $status, $dbname); 105 } 106 } 107 108 # Run relphot (filter) for each filter 109 { 110 foreach my $filter (@filters) { 111 my $command = "$relphot $filter"; 112 $command .= "-D CATDIR $catdir"; 113 $command .= "-region $RAs $RAe $DECs $DECe"; 114 115 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 116 cache_run(command => $command, verbose => 1); 117 118 unless ($success) { 119 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 120 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname); 121 } 122 } 123 } 124 125 # Run uniphot (filter) for each filter 126 # XXX skip this one? run less frequently? 127 if (0) { 128 foreach my $filter (@filters) { 129 my $command = "$uniphot $filter"; 130 $command .= "-D CATDIR $catdir"; 131 $command .= "-region $RAs $RAe $DECs $DECe"; 132 133 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 134 cache_run(command => $command, verbose => 1); 135 136 unless ($success) { 137 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 138 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "UNIPHOT", $status, $dbname); 139 } 140 } 141 } 142 143 { 144 my $command = "$relastro -objects"; 145 $command .= "-D CATDIR $catdir"; 100 $command .= "-grid $outgrid"; 101 $command .= "-imfreeze?"; 102 103 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 cache_run(command => $command, verbose => 1); 105 106 unless ($success) { 107 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 108 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname); 109 } 110 } 111 112 # use one of the input raw images as a reference image 113 my ($reffile) 114 { 115 my $command = "$flatcoor -flatcorrimfile -limit 1"; 116 117 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 118 cache_run(command => $command, verbose => 1); 119 120 unless ($success) { 121 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 122 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname); 123 } 124 125 # parse the output metadata to get the refernece image filename 126 $reffile = "foobar"; 127 } 128 129 { 130 my $command = "$dvoMakeCorr -file $outgrid -ref $reffile $outcorr"; 131 $command .= "-D CATDIR $dvodb"; 146 132 $command .= "-region $RAs $RAe $DECs $DECe"; 147 133 … … 156 142 157 143 { 158 my $command = "$relastro -images"; 159 $command .= "-D CATDIR $catdir"; 160 $command .= "-region $RAs $RAe $DECs $DECe"; 144 my $command = "$dettool -register"; 145 $command .= "-det_type FLATCORR"; 146 $command .= "-file_level $fileLevel"; 147 $command .= "-workdir $workdir"; 148 $command .= "-inst $inst"; 149 $command .= " -dbname $dbname" if defined $dbname; 150 ## XXX what else do we need, and where do we get it? 161 151 162 152 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 169 159 } 170 160 171 my $command = "$caltool -addcalrun"; 172 $command .= " -dvo_id $dvo_id"; 173 $command .= " -region $region"; 174 $command .= " -last_step RELASTRO.IMAGES"; 175 $command .= " -status SUCCESS"; 161 my $command = "$flatcorr -done"; 162 $command .= " -corr_id $corr_id"; 163 $command .= " -stats UNKNOWN"; 176 164 $command .= " -dbname $dbname" if defined $dbname; 177 165
Note:
See TracChangeset
for help on using the changeset viewer.
