IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2008, 12:09:48 PM (18 years ago)
Author:
Paul Price
Message:

Adding -dbname for binaries. Probably not required for all of these, but it can't hurt (much).

File:
1 edited

Legend:

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

    r17671 r17943  
    2828my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $no_update, $no_op, $save_temps);
    2929GetOptions(
    30            'det_id|d=s'        => \$det_id,
    31            'iteration|i=s'     => \$iter,
    32            'camera|c=s'        => \$camera,
    33            'det_type|t=s'      => \$det_type,
    34            'outroot|w=s'       => \$outroot,   # output file base name
    35            'dbname|d=s'        => \$dbname, # Database name
    36            'reduction|=s'      => \$reduction,
     30           'det_id|d=s'        => \$det_id,
     31           'iteration|i=s'     => \$iter,
     32           'camera|c=s'        => \$camera,
     33           'det_type|t=s'      => \$det_type,
     34           'outroot|w=s'       => \$outroot,   # output file base name
     35           'dbname|d=s'        => \$dbname, # Database name
     36           'reduction|=s'      => \$reduction,
    3737           'verbose'           => \$verbose,   # Print to stdout
    38            'no-update'         => \$no_update,
    39            'no-op'             => \$no_op,
    40            'save-temps'        => \$save_temps, # Save temporary files?
    41            ) or pod2usage( 2 );
     38           'no-update'         => \$no_update,
     39           'no-op'             => \$no_op,
     40           'save-temps'        => \$save_temps, # Save temporary files?
     41           ) or pod2usage( 2 );
    4242
    4343pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4444pod2usage( -msg => "Required options: --det_id --iteration --camera --det_type --outroot",
    45            -exitval => 3) unless
    46     defined $det_id   and 
    47     defined $iter     and 
    48     defined $camera   and 
     45           -exitval => 3) unless
     46    defined $det_id   and
     47    defined $iter     and
     48    defined $camera   and
    4949    defined $det_type and
    5050    defined $outroot;
     
    6565# XXX -bg_mean_stdev should take stdev of bg_mean if bg_mean_stdev == 0     (B)
    6666# XXX  (A) if imfile.Ncomp > 1, (B) if imfile.Ncomp == 1
    67 my $STATS = 
    68     [   
    69         #          KEYWORD                 STATISTIC          CHIPTOOL FLAG
    70         { name => "bg",             type => "mean",  flag => "-bg",            dtype => "float" },
    71         { name => "bg",             type => "stdev", flag => "-bg_mean_stdev", dtype => "float" },
    72         { name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",      dtype => "float" },
    73         # { name => "bg_mean_stdev",  type => "rms",   flag => "-bg_mean_stdev" },
    74         ];
     67my $STATS =
     68    [
     69        #          KEYWORD                 STATISTIC          CHIPTOOL FLAG
     70        { name => "bg",             type => "mean",  flag => "-bg",            dtype => "float" },
     71        { name => "bg",             type => "stdev", flag => "-bg_mean_stdev", dtype => "float" },
     72        { name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",      dtype => "float" },
     73        # { name => "bg_mean_stdev",  type => "rms",   flag => "-bg_mean_stdev" },
     74        ];
    7575my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    7676
     
    7979my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    8080my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    81 if ($missing_tools) { 
     81if ($missing_tools) {
    8282    warn("Can't find required tools.");
    83     exit($PS_EXIT_CONFIG_ERROR); 
     83    exit($PS_EXIT_CONFIG_ERROR);
    8484}
    8585
     
    9090    $command .= " -dbname $dbname" if defined $dbname;
    9191    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    92         run(command => $command, verbose => $verbose);
     92        run(command => $command, verbose => $verbose);
    9393    unless ($success) {
    94         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    95         &my_die("Unable to get list of normalized imfiles from dettool: $error_code", $det_id, $iter, $error_code);
     94        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     95        &my_die("Unable to get list of normalized imfiles from dettool: $error_code", $det_id, $iter, $error_code);
    9696    }
    9797
    9898    # convert stdout to a metadata
    99     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     99    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    100100    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    101         &my_die("Unable to parse metadata config doc", $det_id, $iter, $PS_EXIT_PROG_ERROR);
     101        &my_die("Unable to parse metadata config doc", $det_id, $iter, $PS_EXIT_PROG_ERROR);
    102102
    103103    # parse the file info in the metadata
    104104    $files = parse_md_list($metadata) or
    105         &my_die("Unable to parse metadata list", $det_id, $iter, $PS_EXIT_PROG_ERROR);
     105        &my_die("Unable to parse metadata list", $det_id, $iter, $PS_EXIT_PROG_ERROR);
    106106
    107107    # parse the stats in the metadata
    108108    unless ($stats->parse($metadata)) {
    109         &my_die("Unable to find all values in statistics output.\n", $det_id, $iter, $PS_EXIT_PROG_ERROR);
     109        &my_die("Unable to find all values in statistics output.\n", $det_id, $iter, $PS_EXIT_PROG_ERROR);
    110110    }
    111111}
     
    134134    # Make the jpeg for binning 1
    135135    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     136    $command .= " -dbname $dbname" if defined $dbname;
    136137    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    137         run(command => $command, verbose => $verbose);
     138        run(command => $command, verbose => $verbose);
    138139    &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg1Name);
    139    
     140
    140141    # Make the jpeg for binning 2
    141142    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     143    $command .= " -dbname $dbname" if defined $dbname;
    142144    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    143         run(command => $command, verbose => $verbose);
     145        run(command => $command, verbose => $verbose);
    144146    &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg2Name);
    145147
     
    158160unless ($no_update) {
    159161    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    160         run(command => $command, verbose => $verbose);
     162        run(command => $command, verbose => $verbose);
    161163    unless ($success) {
    162         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    163         &my_die("Unable to perform dettool -addnormalizedexp: $error_code", $det_id, $iter, $error_code);
     164        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     165        &my_die("Unable to perform dettool -addnormalizedexp: $error_code", $det_id, $iter, $error_code);
    164166    }
    165167} else {
     
    170172{
    171173    my $msg = shift; # Warning message on die
    172     my $det_id = shift;         # Detrend identifier
    173     my $iter = shift;           # Iteration
     174    my $det_id = shift;         # Detrend identifier
     175    my $iter = shift;           # Iteration
    174176    my $exit_code = shift; # Exit code to add
    175177
    176178    carp($msg);
    177179    if (defined $det_id and defined $iter and not $no_update) {
    178         my $command = "$dettool -addnormalizedexp";
    179         $command .= " -det_id $det_id";
    180         $command .= " -iteration $iter";
    181         $command .= " -code $exit_code";
    182         $command .= " -dbname $dbname" if defined $dbname;
     180        my $command = "$dettool -addnormalizedexp";
     181        $command .= " -det_id $det_id";
     182        $command .= " -iteration $iter";
     183        $command .= " -code $exit_code";
     184        $command .= " -dbname $dbname" if defined $dbname;
    183185        system ($command);
    184186    }
Note: See TracChangeset for help on using the changeset viewer.