IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 6, 2007, 3:44:38 PM (19 years ago)
Author:
eugene
Message:

rework for consistency with the changes to the database and PS-IPP-Config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/detrend_resid.pl

    r14009 r14048  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($det_id, $iter, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);
     34my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);
    3535GetOptions(
    3636    'det_id|d=s'        => \$det_id,
    3737    'iteration=s'       => \$iter,
    38     'exp_tag|e=s'       => \$exp_tag,
     38    'exp_id|e=s'        => \$exp_id,
     39    'exp_tag|=s'        => \$exp_tag,
    3940    'class_id|i=s'      => \$class_id,
    4041    'det_type|t=s'      => \$det_type,
     
    5152
    5253pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    53 pod2usage( -msg => "Required options: --det_id --iteration --exp_tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)",
     54pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)",
    5455           -exitval => 3)
    5556    unless defined $det_id
    5657    and defined $iter
     58    and defined $exp_id
    5759    and defined $exp_tag
    5860    and defined $class_id
     
    7375    $recipe = uc($det_type) . '_VERIFY';
    7476} else {
    75     &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     77    &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    7678}
    7779$recipe = $ipprc->reduction($reduction, $recipe);
     
    139141    if (lc($mode) ne 'verify') {
    140142        my $detFlag = DETRENDS->{lc($det_type)};
    141         &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;
     143        &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;
    142144        $command .= " $detFlag $detrend";
    143145    }
     
    147149    unless ($success) {
    148150        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    149         &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_tag, $class_id, $error_code);
    150     }
    151     &my_die("Couldn't find expected output file: $outputName", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName);
    152     &my_die("Couldn't find expected output file: $outputStats", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats);
    153     &my_die("Couldn't find expected output file: $bin1Name", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name);
    154     &my_die("Couldn't find expected output file: $bin2Name", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name);
     151        &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
     152    }
     153    &my_die("Couldn't find expected output file: $outputName", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName);
     154    &my_die("Couldn't find expected output file: $outputStats", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats);
     155    &my_die("Couldn't find expected output file: $bin1Name", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name);
     156    &my_die("Couldn't find expected output file: $bin2Name", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name);
    155157
    156158    # Load the raw output stats file
    157159    my $statsFile;              # File handle
    158     open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR);
     160    open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR);
    159161    my @contents = <$statsFile>; # Contents of file
    160162    close $statsFile;
     
    162164    # Parse the stats file contents into a metadata
    163165    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    164     my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     166    my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    165167
    166168    # Parse the statistics on the residual image
    167169    my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    168     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     170    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    169171
    170172    # run ppStats on the binned image
     
    174176    unless ($success) {
    175177        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    176         &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_tag, $class_id, $error_code);
     178        &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
    177179    }
    178180
    179181    # parse the binned image statistics
    180     my $binnedMetadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata output", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     182    my $binnedMetadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata output", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    181183
    182184    my $binnedStats = PS::IPP::Metadata::Stats->new($BINNED_STATS); # Stats parser
    183     $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     185    $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    184186}
    185187
     
    188190$command .= " -det_id $det_id";
    189191$command .= " -iteration $iter";
    190 $command .= " -exp_tag $exp_tag";
     192$command .= " -exp_id $exp_id";
    191193$command .= " -class_id $class_id";
    192194$command .= " -recip $recipe";
     
    196198
    197199# add in the elements from the selected stats above
    198 foreach my $entry (@$STATS @$BINNED_STATS) {
     200foreach my $entry (@$STATS, @$BINNED_STATS) {
    199201    my $value = $entry->{value};
    200202    my $flag = $entry->{flag};
     
    220222    my $det_id = shift;         # Detrend identifier
    221223    my $iter = shift;           # Iteration
    222     my $exp_tag = shift; # Exposure tag
     224    my $exp_id = shift; # Exposure tag
    223225    my $class_id = shift; # Class identifier
    224226    my $exit_code = shift; # Exit code to add
    225227
    226228    carp($msg);
    227     if ($det_id and $iter and $exp_tag and not $no_update) {
     229    if ($det_id and $iter and $exp_id and not $no_update) {
    228230        my $command = "$dettool -addresidimfile";
    229231        $command .= " -det_id $det_id";
    230232        $command .= " -iteration $iter";
    231         $command .= " -exp_tag $exp_tag";
     233        $command .= " -exp_id $exp_id";
    232234        $command .= " -class_id $class_id";
    233235        $command .= " -code $exit_code";
Note: See TracChangeset for help on using the changeset viewer.