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_apply.pl

    r17671 r17943  
    2828     $no_update, $no_op );
    2929GetOptions(
    30     'det_id|d=s'        => \$det_id,     # Detrend ID                           
    31     'iteration|n=s'     => \$iter,       # Iteration                           
    32     'class_id|i=s'      => \$class_id,   # Class ID                             
    33     'value|v=s'         => \$value,      # Value to multiple (for normalisation)       
    34     'input_uri|u=s'     => \$input_uri,  # Input file                           
    35     'camera|c=s'        => \$camera,     # Camera                               
    36     'det_type|t=s'      => \$det_type,   # Detrend type                         
     30    'det_id|d=s'        => \$det_id,     # Detrend ID
     31    'iteration|n=s'     => \$iter,       # Iteration
     32    'class_id|i=s'      => \$class_id,   # Class ID
     33    'value|v=s'         => \$value,      # Value to multiple (for normalisation)
     34    'input_uri|u=s'     => \$input_uri,  # Input file
     35    'camera|c=s'        => \$camera,     # Camera
     36    'det_type|t=s'      => \$det_type,   # Detrend type
    3737    'outroot|w=s'       => \$outroot,    # output file base name
    38     'dbname|d=s'        => \$dbname,     # Database name                               
     38    'dbname|d=s'        => \$dbname,     # Database name
    3939    'verbose'           => \$verbose,   # Print to stdout
    40     'no-update'         => \$no_update,  # Don't update the database           
    41     'no-op'             => \$no_op,      # Don't do any operations               
     40    'no-update'         => \$no_update,  # Don't update the database
     41    'no-op'             => \$no_op,      # Don't do any operations
    4242    ) or pod2usage( 2 );
    43    
     43
    4444pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4545pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type --outroot",
    46            -exitval => 3) unless
    47     defined $det_id    and 
    48     defined $iter      and 
    49     defined $class_id  and 
    50     defined $value     and 
    51     defined $input_uri and 
    52     defined $camera    and 
     46           -exitval => 3) unless
     47    defined $det_id    and
     48    defined $iter      and
     49    defined $class_id  and
     50    defined $value     and
     51    defined $input_uri and
     52    defined $camera    and
    5353    defined $det_type  and
    5454    defined $outroot;
     
    6565
    6666# values to extract from output metadata and the stats to calculate
    67 my $STATS = 
    68    [   
     67my $STATS =
     68   [
    6969       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    7070       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",            dtype => "float" },
     
    7878my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    7979my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    80 if ($missing_tools) { 
     80if ($missing_tools) {
    8181    warn("Can't find required tools.");
    82     exit($PS_EXIT_CONFIG_ERROR); 
     82    exit($PS_EXIT_CONFIG_ERROR);
    8383}
    8484
     
    100100my $statsName = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    101101my $traceDest = $ipprc->filename("TRACE.IMFILE",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    102 my $logDest   = $ipprc->filename("LOG.IMFILE",    $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     102my $logDest   = $ipprc->filename("LOG.IMFILE",    $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    103103
    104104# Run normalisation
     
    112112    $command .= ' -isdark' if lc($det_type) eq 'dark';
    113113    $command .= " -tracedest $traceDest -log $logDest";
     114    $command .= " -dbname $dbname" if defined $dbname;
    114115
    115116    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    116         run(command => $command, verbose => $verbose);
     117        run(command => $command, verbose => $verbose);
    117118    unless ($success) {
    118         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    119         &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $class_id, $error_code);
     119        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     120        &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $class_id, $error_code);
    120121    }
    121122    &my_die("Can't find expected output file: $output",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($output);
     
    123124    &my_die("Can't find expected output file: $b2name",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b2name);
    124125    &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($statsName);
    125    
     126
    126127    # Get the statistics on the normalised image
    127128    my $statsFile; # File handle
     
    132133
    133134    # parse the statistics MDC file
    134     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     135    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    135136    my $metadata = $mdcParser->parse(join "", @contents);
    136137    unless ($metadata) {
    137         &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
     138        &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    138139    }
    139140
    140141    # extract the stats from the metadata
    141142    unless ($stats->parse($metadata)) {
    142         &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
     143        &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    143144    }
    144145}
     
    157158unless ($no_update) {
    158159    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    159         run(command => $command, verbose => $verbose);
     160        run(command => $command, verbose => $verbose);
    160161    unless ($success) {
    161         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    162         warn("Unable to perform dettool -addnormalizedimfile: $error_code\n");
    163         exit($error_code);
     162        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     163        warn("Unable to perform dettool -addnormalizedimfile: $error_code\n");
     164        exit($error_code);
    164165    }
    165166} else {
     
    169170sub my_die
    170171{
    171     my $msg = shift;            # Warning message on die
    172     my $det_id = shift;         # Detrend identifier
    173     my $iter = shift;           # Iteration
    174     my $class_id = shift;       # Class identifier
    175     my $exit_code = shift;      # Exit code to add
     172    my $msg = shift;            # Warning message on die
     173    my $det_id = shift;         # Detrend identifier
     174    my $iter = shift;           # Iteration
     175    my $class_id = shift;       # Class identifier
     176    my $exit_code = shift;      # Exit code to add
    176177
    177178    carp($msg);
    178179    if (defined $det_id and defined $iter and defined $class_id and not $no_update) {
    179         my $command = "$dettool -addnormalizedimfile";
    180         $command .= " -det_id $det_id";
    181         $command .= " -iteration $iter";
    182         $command .= " -class_id $class_id";
    183         $command .= " -code $exit_code";
    184         $command .= " -dbname $dbname" if defined $dbname;
     180        my $command = "$dettool -addnormalizedimfile";
     181        $command .= " -det_id $det_id";
     182        $command .= " -iteration $iter";
     183        $command .= " -class_id $class_id";
     184        $command .= " -code $exit_code";
     185        $command .= " -dbname $dbname" if defined $dbname;
    185186        system ($command);
    186187    }
Note: See TracChangeset for help on using the changeset viewer.