Changeset 10363
- Timestamp:
- Nov 30, 2006, 5:11:08 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/inject.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/inject.pl
r10146 r10363 15 15 $telescope, # Telescope used 16 16 $exp_type, # Type of exposure 17 $class, # Prefix for class id18 $num, # Number of imfiles19 17 $path, # Path to use 20 18 ); … … 23 21 'telescope|t=s' => \$telescope, 24 22 'exp_type|e=s' => \$exp_type, 25 'class_id=s' => \$class,26 'num|n=i' => \$num,27 23 'path=s' => \$path, 28 24 ) or pod2usage( 2 ); 29 25 30 26 pod2usage( 31 -msg => "Required options: --camera --telescope --exp_type -- num --path",27 -msg => "Required options: --camera --telescope --exp_type --path", 32 28 -exitval => 3, 33 29 ) unless defined $camera 34 30 and defined $telescope 35 31 and defined $exp_type 36 and defined $num37 32 and defined $path; 38 33 … … 48 43 49 44 45 my @classes; 46 my $imfiles; 47 if ($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 50 57 # Inject new data into the database 51 58 { 52 59 foreach my $exp ( @ARGV ) { 53 my $command = "$pxinject -newExp -exp_id $exp -inst $camera -telescope $telescope -exp_type $exp_type -imfiles $num"; # Command to run60 my $command = "$pxinject -newExp -exp_id $exp -inst $camera -telescope $telescope -exp_type $exp_type -imfiles " . scalar @classes; # Command to run 54 61 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 55 62 run( command => $command, verbose => 1 ); … … 58 65 my @line = split(/\s+/, $$stdout_buf[0]); # The output line, containing the exposure tag 59 66 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) { 67 68 my $command = "$pxinject -newImfile -exp_tag $exp_tag -class chip -class_id $class_id -uri $path/$exp.$class_id.fits"; # Command to run 68 69 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 69 70 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; 71 72 } 72 73 }
Note:
See TracChangeset
for help on using the changeset viewer.
