IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10363


Ignore:
Timestamp:
Nov 30, 2006, 5:11:08 PM (20 years ago)
Author:
Paul Price
Message:

Input camera is either MEGACAM or MCSHORT, which sets which chips to use.

File:
1 edited

Legend:

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

    r10146 r10363  
    1515    $telescope,                 # Telescope used
    1616    $exp_type,                  # Type of exposure
    17     $class,                     # Prefix for class id
    18     $num,                       # Number of imfiles
    1917    $path,                      # Path to use
    2018    );
     
    2321           'telescope|t=s' => \$telescope,
    2422           'exp_type|e=s' => \$exp_type,
    25            'class_id=s' => \$class,
    26            'num|n=i' => \$num,
    2723           'path=s' => \$path,
    2824) or pod2usage( 2 );
    2925
    3026pod2usage(
    31     -msg => "Required options: --camera --telescope --exp_type --num --path",
     27    -msg => "Required options: --camera --telescope --exp_type --path",
    3228    -exitval => 3,
    3329) unless defined $camera
    3430    and defined $telescope
    3531    and defined $exp_type
    36     and defined $num
    3732    and defined $path;
    3833
     
    4843
    4944
     45my @classes;
     46my $imfiles;
     47if ($camera eq "MEGACAM") {
     48    for (my $i = 0; $i < 36; $i++) {
     49        push @classes, sprintf("ccd%02d", $i);
     50    }
     51} elsif ($camera eq "MCSHORT") {
     52    @classes = ( 'ccd12', 'ccd13', 'ccd14', 'ccd21', 'ccd22', 'ccd23' );
     53} else {
     54    die "Unrecognised camera name: $camera.\n";
     55}
     56
    5057# Inject new data into the database
    5158{
    5259    foreach my $exp ( @ARGV ) {
    53         my $command = "$pxinject -newExp -exp_id $exp -inst $camera -telescope $telescope -exp_type $exp_type -imfiles $num"; # Command to run
     60        my $command = "$pxinject -newExp -exp_id $exp -inst $camera -telescope $telescope -exp_type $exp_type -imfiles " . scalar @classes; # Command to run
    5461        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    5562            run( command => $command, verbose => 1 );
     
    5865        my @line = split(/\s+/, $$stdout_buf[0]); # The output line, containing the exposure tag
    5966        my $exp_tag = $line[2]; # The exposure tag
    60         for (my $i = 0; $i < $num; $i++) {
    61             my $class_id;
    62             if (defined $class) {
    63                 $class_id = sprintf $class, $i; # Name for class_id
    64             } else {
    65                 $class_id = $i;
    66             }
     67        foreach my $class_id (@classes) {
    6768            my $command = "$pxinject -newImfile -exp_tag $exp_tag -class chip -class_id $class_id -uri $path/$exp.$class_id.fits"; # Command to run
    6869            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6970                run( command => $command, verbose => 1 );
    70             die "Unable to inject $exp $i: $error_code\n" if not $success;
     71            die "Unable to inject $exp $class_id: $error_code\n" if not $success;
    7172        }
    7273    }
Note: See TracChangeset for help on using the changeset viewer.