IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 29, 2007, 7:37:37 AM (19 years ago)
Author:
eugene
Message:

update workdir and outroot names

File:
1 edited

Legend:

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

    r11333 r11360  
    2424
    2525# Parse the command-line
    26 my ($detId,                     # Detrend ID
     26my ($det_id,                     # Detrend ID
    2727    $iter,                      # Iteration
    28     $classId,                   # Class ID
     28    $class_id,                  # Class ID
    2929    $value,                     # Value to multiple (for normalisation)
    3030    $input,                     # Input file
    3131    $camera,                    # Camera
    32     $detType,                   # Detrend type
     32    $det_type,                  # Detrend type
    3333    $dbname,                    # Database name
    3434    $workdir,                   # Working directory, for output files
     
    3636    );
    3737GetOptions(
    38     'det_id|d=s'        => \$detId,
     38    'det_id|d=s'        => \$det_id,
    3939    'iteration|n=s'     => \$iter,
    40     'class_id|i=s'      => \$classId,
     40    'class_id|i=s'      => \$class_id,
    4141    'value|v=s'         => \$value,
    4242    'input_uri|u=s'     => \$input,
    4343    'camera|c=s'        => \$camera,
    44     'det_type|t=s'      => \$detType,
     44    'det_type|t=s'      => \$det_type,
    4545    'dbname|d=s'        => \$dbname,
    4646    'workdir|w=s'       => \$workdir, # Working directory, for output files
     
    5151pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type",
    5252    -exitval => 3,
    53     ) unless defined $detId
     53    ) unless defined $det_id
    5454    and defined $iter
    55     and defined $classId
     55    and defined $class_id
    5656    and defined $value
    5757    and defined $input
    5858    and defined $camera
    59     and defined $detType;
     59    and defined $det_type;
    6060
    6161$ipprc->define_camera($camera);
     
    8383
    8484# Output name
    85 my $outputRoot = $camera . '.' . $detType . '.norm.' . $detId . '.' . $iter; # Root output name
    86 $outputRoot = File::Spec->catfile( $workdir, $outputRoot );
     85my $outputFile = "$camera.$det_type.norm.$det_id.$iter"; # Root name
     86my $outputSubD = "$camera.$det_type.$det_id";
     87my $outputRoot = File::Spec->catfile( $workdir, $outputSubD, $outputFile );
    8788
    88 my $output = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $classId);
    89 my $b1name = $ipprc->filename("PPIMAGE.BIN1", $outputRoot, $classId);
    90 my $b2name = $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $classId);
     89my $output = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
     90my $b1name = $ipprc->filename("PPIMAGE.BIN1", $outputRoot, $class_id);
     91my $b2name = $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $class_id);
    9192
    92 my $statsName = $outputRoot . '.' . $classId . '.stats'; # Statistics file
     93my $statsName = $outputRoot . '.' . $class_id . '.stats'; # Statistics file
    9394
    9495# Run normalisation
    9596{
    9697    my $command = "$ppImage -file $input $outputRoot -norm $value -stat $statsName -recipe PPIMAGE " . RECIPE(); # Command to run
    97     $command .= ' -isfringe' if lc($detType) eq 'fringe';
     98    $command .= ' -isfringe' if lc($det_type) eq 'fringe';
    9899    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    99100        run(command => $command, verbose => 1);
    100101    unless ($success) {
    101102        $error_code = $error_code >> 8;
    102         &my_die("Unable to perform ppImage: $error_code", $detId, $iter, $classId, $error_code);
     103        &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $class_id, $error_code);
    103104    }
    104     &my_die("Can't find expected output file: $output", $detId, $iter, $classId, $PS_EXIT_SYS_ERROR) unless -e $output;
    105     &my_die("Can't find expected output file: $b1name", $detId, $iter, $classId, $PS_EXIT_SYS_ERROR) unless -e $b2name;
    106     &my_die("Can't find expected output file: $b2name", $detId, $iter, $classId, $PS_EXIT_SYS_ERROR) unless -e $b1name;
    107     &my_die("Can't find expected output file: $statsName", $detId, $iter, $classId, $PS_EXIT_SYS_ERROR) unless -e $statsName;
     105    &my_die("Can't find expected output file: $output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $output;
     106    &my_die("Can't find expected output file: $b1name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $b2name;
     107    &my_die("Can't find expected output file: $b2name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $b1name;
     108    &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $statsName;
    108109}
    109110
     
    112113{
    113114    my $statsFile;              # File handle
    114     open $statsFile, $statsName or &my_die("Can't open statistics file $statsName: $!\n", $detId, $iter, $classId, $PS_EXIT_SYS_ERROR);
     115    open $statsFile, $statsName or &my_die("Can't open statistics file $statsName: $!\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
    115116    my @contents = <$statsFile>; # Contents of file
    116117    close $statsFile;
    117118    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    118119    my $metadata = $mdcParser->parse(join "", @contents)
    119         or &my_die("Unable to parse metadata config", $detId, $iter, $classId, $PS_EXIT_PROG_ERROR);
     120        or &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    120121    $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
    121     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $detId, $iter, $classId, $PS_EXIT_PROG_ERROR);
     122    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    122123}
    123124
     
    127128$b2name = $ipprc->convert_filename_relative( $b2name );
    128129unless ($no_update) {
    129     my $command = "$dettool -addnormalizedimfile -det_id $detId -iteration $iter -class_id $classId ".
     130    my $command = "$dettool -addnormalizedimfile -det_id $det_id -iteration $iter -class_id $class_id ".
    130131        "-uri $output -b1_uri $b1name -b2_uri $b2name"; # Command to run
    131132    # Add the statistics triplet
Note: See TracChangeset for help on using the changeset viewer.