IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12213


Ignore:
Timestamp:
Mar 2, 2007, 5:37:28 PM (19 years ago)
Author:
Paul Price
Message:

Updating to use new ippTools system, where the chip and camera phases take identifiers for those phases, instead of exp_tag.

Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r12079 r12213  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($exp_tag, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($exp_id, $cam_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3636GetOptions(
    37     'exp_tag|e=s'       => \$exp_tag,
    38     'camera|c=s'        => \$camera,
    39     'dbname|d=s'        => \$dbname, # Database name
    40     'workdir|w=s'       => \$workdir,
    41     'no-update'         => \$no_update,
    42     'no-op'             => \$no_op,
    43 ) or pod2usage( 2 );
     37           'exp_id=s'          => \$exp_id, # Exposure identifier
     38           'cam_id=s'          => \$cam_id, # Camtool identifier
     39           'camera|c=s'        => \$camera, # Camera
     40           'dbname|d=s'        => \$dbname, # Database name
     41           'workdir|w=s'       => \$workdir, # Working directory
     42           'no-update'         => \$no_update, # Update the database?
     43           'no-op'             => \$no_op, # Don't do any operations?
     44           ) or pod2usage( 2 );
    4445
    4546pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4647pod2usage(
    47     -msg => "Required options: --exp_tag --camera",
     48    -msg => "Required options: --exp_id --cam_id --camera",
    4849    -exitval => 3,
    49 ) unless defined $exp_tag
     50) unless defined $exp_id
     51    and defined $cam_id
    5052    and defined $camera;
    5153
     
    7577my $files;                      # Array of component files
    7678{
    77     my $command = "$camtool -pendingimfile -exp_tag $exp_tag"; # Command to run
     79    my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run
    7880    $command .= " -dbname $dbname" if defined $dbname;
    7981    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    8183    unless ($success) {
    8284        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    83         &my_die("Unable to perform camtool: $error_code", $exp_tag, $error_code);
     85        &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
    8486    }
    8587    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    86         &my_die("Unable to parse metadata config doc", $exp_tag, $PS_EXIT_PROG_ERROR);
     88        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
    8789    $files = parse_md_list($metadata) or
    88         &my_die("Unable to parse metadata list", $exp_tag, $PS_EXIT_PROG_ERROR);
     90        &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
    8991}
    9092
     
    98100#    my @zp;                    # Array of photometric zero points
    99101    foreach my $file (@$files) {
    100         &my_die("Unable to find class id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id};
     102        &my_die("Unable to find class id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id};
    101103        my $class_id = $file->{class_id};
    102         &my_die("Unable to find bg for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg};
    103         &my_die("Unable to find bg_mean_stdev for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev};
    104 #       &my_die("Unable to find sigma_ra for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra};
    105 #       &my_die("Unable to find sigma_dec for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec};
    106 #       &my_die("Unable to find zp for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{zp};
     104        &my_die("Unable to find bg for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg};
     105        &my_die("Unable to find bg_mean_stdev for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev};
     106#       &my_die("Unable to find sigma_ra for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra};
     107#       &my_die("Unable to find sigma_dec for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec};
     108#       &my_die("Unable to find zp for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{zp};
    107109        push @backgrounds, $file->{bg};
    108110        push @variances, $file->{bg_stdev}**2;
     
    129131    $workdir = $dir;
    130132}
     133
     134$workdir = File::Spec->catfile( $workdir, $exp_id );
    131135system "mkdir -p $workdir" unless -d $workdir;
    132136
    133 # make this a function which generates a specific list file for a specific filename
    134 
    135137# Generate the file list, and get the statistics
    136 my $outputFile =  "$exp_tag.cam";
     138my $outputFile =  "$exp_id.cam$cam_id";
    137139my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
    138140
     
    182184        unless ($success) {
    183185            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    184             &my_die("Unable to perform psastro: $error_code", $exp_tag, $error_code);
    185         }
    186         &my_die("Unable to find expected output file: $fpaObjects", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
     186            &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
     187        }
     188        &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
    187189    } else {
    188190        $fpaObjects = $chipObjects;
     
    198200        unless ($success) {
    199201            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    200             &my_die("Unable to perform addstar: $error_code", $exp_tag, $error_code);
     202            &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
    201203        }
    202204    }
     
    209211        unless ($success) {
    210212            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    211             &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code);
    212         }
    213         &my_die("Unable to find expected output file: $jpeg1", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg1;
     213            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
     214        }
     215        &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg1;
    214216    }
    215217
     
    221223        unless ($success) {
    222224            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    223             &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code);
    224         }
    225         &my_die("Unable to find expected output file: $jpeg2", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
     225            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
     226        }
     227        &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
    226228    }
    227229}
     
    232234
    233235unless ($no_update) {
    234     my $command = "$camtool -addprocessedexp -exp_tag $exp_tag -uri UNKNOWN " .
     236    my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN " .
    235237        "-recip " . RECIPE1() . "," . RECIPE2() . " -path_base $outputRoot " .
    236238        "-bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev " .
     
    253255{
    254256    my $msg = shift; # Warning message on die
    255     my $exp_tag = shift; # Exposure tag
     257    my $cam_id = shift; # Camtool identifier
    256258    my $exit_code = shift; # Exit code to add
    257259
    258260    warn($msg);
    259     if ($exp_tag and not $no_update) {
    260         my $command = "$camtool -addprocessedexp -exp_tag $exp_tag -code $exit_code";
     261    if ($cam_id and not $no_update) {
     262        my $command = "$camtool -addprocessedexp -cam_id $cam_id -code $exit_code";
    261263        $command .= " -dbname $dbname" if defined $dbname;
    262264        system ($command);
  • trunk/ippScripts/scripts/chip_imfile.pl

    r12079 r12213  
    3232
    3333# Parse the command-line arguments
    34 my ($exp_tag,                   # Exposure tag
    35     $class_id,                  # Class Id
     34my ($exp_id,                    # Exposure identifier
     35    $chip_id,                   # Chiptool identifier
     36    $class_id,                  # Class identifier
    3637    $input,                     # Input FITS file
    3738    $camera,                    # Camera
     
    4243    );
    4344GetOptions(
    44     'exp_tag|e=s'   => \$exp_tag,
    45     'class_id|i=s'  => \$class_id,
    46     'uri|u=s'       => \$input,
    47     'camera|c=s'    => \$camera,
    48     'dbname|d=s'    => \$dbname, # Database name
    49     'workdir|w=s'   => \$workdir,
    50     'no-update'     => \$no_update,
    51     'no-op'         => \$no_op,
    52 ) or pod2usage( 2 );
     45           'exp_id=s'      => \$exp_id,
     46           'chip_id=s'     => \$chip_id,
     47           'class_id=s'    => \$class_id,
     48           'uri|u=s'       => \$input,
     49           'camera|c=s'    => \$camera,
     50           'dbname|d=s'    => \$dbname, # Database name
     51           'workdir|w=s'   => \$workdir,
     52           'no-update'     => \$no_update,
     53           'no-op'         => \$no_op,
     54           ) or pod2usage( 2 );
    5355
    5456pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5557pod2usage(
    56     -msg => "Required options: --exp_tag --class_id --uri --camera",
     58    -msg => "Required options: --exp_id --chip_id --class_id --uri --camera",
    5759    -exitval => 3,
    58 ) unless defined $exp_tag
     60) unless defined $exp_id
     61    and defined $chip_id
    5962    and defined $class_id
    6063    and defined $input
     
    8285}
    8386
    84 $workdir = File::Spec->catfile( $workdir, $exp_tag );
     87$workdir = File::Spec->catfile( $workdir, $exp_id );
    8588system "mkdir -p $workdir" unless -d $workdir;
    8689
    8790### Output file name --- must match camera configuration!
    88 my $outputFile =  "$exp_tag.chip";
     91my $outputFile =  "$exp_id.chp$chip_id";
    8992my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
    9093my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
     
    106109    unless ($success) {
    107110        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    108         &my_die("Unable to perform ppImage: $error_code", $exp_tag, $class_id, $error_code);
     111        &my_die("Unable to perform ppImage: $error_code", $chip_id, $class_id, $error_code);
    109112    }
    110     &my_die("Couldn't find expected output file: $outputImage\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
    111     &my_die("Couldn't find expected output file: $outputBin1\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
    112     &my_die("Couldn't find expected output file: $outputBin2\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
    113     &my_die("Couldn't find expected output file: $outputStats\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
     113    &my_die("Couldn't find expected output file: $outputImage\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
     114    &my_die("Couldn't find expected output file: $outputBin1\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
     115    &my_die("Couldn't find expected output file: $outputBin2\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
     116    &my_die("Couldn't find expected output file: $outputStats\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
    114117
    115118    # Get the statistics on the processed image
    116119    my $statsFile;              # File handle
    117     open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR);
     120    open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    118121    my @contents = <$statsFile>; # Contents of file
    119122    close $statsFile;
    120123    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    121124    my $metadata = $mdcParser->parse(join "", @contents) or
    122         &my_die("Unable to parse metadata config doc", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     125        &my_die("Unable to parse metadata config doc", $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
    123126    $stats->parse($metadata) or
    124         &my_die("Unable to find all values in statistics output.\n", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     127        &my_die("Unable to find all values in statistics output.\n", $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
    125128}
    126129
     
    136139    # Command to run chiptool
    137140    my $command = "$chiptool -addprocessedimfile";
    138     $command .= " -exp_tag $exp_tag";
     141    $command .= " -chip_id $chip_id";
    139142    $command .= " -class_id $class_id";
    140143    $command .= " -recip " . RECIPE;
     
    159162{
    160163    my $msg = shift; # Warning message on die
    161     my $exp_tag = shift; # Exposure tag
     164    my $chip_id = shift; # Chiptool identifier
    162165    my $class_id = shift; # Class identifier
    163166    my $exit_code = shift; # Exit code to add
    164167
    165168    warn($msg);
    166     if ($exp_tag and $class_id and not $no_update) {
     169    if ($chip_id and $class_id and not $no_update) {
    167170        my $command = "$chiptool -addprocessedimfile";
    168         $command .= " -exp_tag $exp_tag";
     171        $command .= " -chip_id $chip_id";
    169172        $command .= " -class_id $class_id";
    170173        $command .= " -code $exit_code";
Note: See TracChangeset for help on using the changeset viewer.