Changeset 17622 for trunk/ippScripts/scripts/ipp_serial_inject_mosaic.pl
- Timestamp:
- May 9, 2008, 3:28:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_serial_inject_mosaic.pl
r15283 r17622 23 23 use Pod::Usage qw( pod2usage ); 24 24 25 my ($camera, # Camera used 26 $telescope, # Telescope used 27 $dbname, # Database name 28 $workdir, # Working directory 29 $path, # Path to data 25 my ($camera, # Camera used 26 $telescope, # Telescope used 27 $tess_id, # Tessellation identifier 28 $dbname, # Database name 29 $workdir, # Working directory 30 $path, # Path to data 30 31 ); 31 32 GetOptions( 32 'camera|c=s' => \$camera, 33 'telescope|t=s' => \$telescope, 34 'workdir=s' => \$workdir, 35 'path=s' => \$path, 36 'dbname=s' => \$dbname, 33 'camera|c=s' => \$camera, 34 'telescope|t=s' => \$telescope, 35 'workdir=s' => \$workdir, 36 'tess_id=s' => \$tess_id, 37 'path=s' => \$path, 38 'dbname=s' => \$dbname, 37 39 ) or pod2usage( 2 ); 38 40 39 41 pod2usage( 40 -msg => "Required options: --camera --telescope --workdir --path --dbname",41 -exitval => 3,42 ) unless defined $camera42 -msg => "Required options: --camera --telescope --workdir --path --dbname", 43 -exitval => 3, 44 ) unless defined $camera 43 45 and defined $telescope 44 46 and defined $workdir … … 57 59 58 60 # Inject new data into the database 59 my @classes; # Names of the classes60 my @files; # What to add to the filename for each class61 my @classes; # Names of the classes 62 my @files; # What to add to the filename for each class 61 63 my $imfiles; 62 my $add_dir; # Add directory name to get file name?64 my $add_dir; # Add directory name to get file name? 63 65 if ($camera eq "MEGACAM") { 64 66 for (my $i = 0; $i < 36; $i++) { 65 push @classes, sprintf("ccd%02d", $i);66 push @files, sprintf(".ccd%02d", $i);67 push @classes, sprintf("ccd%02d", $i); 68 push @files, sprintf(".ccd%02d", $i); 67 69 } 68 70 } elsif ($camera eq "MCSHORT") { … … 74 76 } elsif ($camera eq "TC3") { 75 77 @classes = ( 'CCID58-1-06b2', 'CCID45-1-14A', 'CCID45-1-11A', 'CCID45-1-22A', 76 'CCID45-1-04C', 'CCID45-1-13A', 'CCID45-1-05A', 'CCID45-1-19A' );78 'CCID45-1-04C', 'CCID45-1-13A', 'CCID45-1-05A', 'CCID45-1-19A' ); 77 79 @files = ( '00', '01', '10', '11', '20', '21', '30', '31' ); 78 80 $add_dir = 1; … … 85 87 } elsif ($camera eq "GPC1") { 86 88 for (my $i = 0; $i < 8; $i++) { 87 for (my $j = 0; $j < 8; $j++) {88 if (($i == 0 or $i == 7) and ($j == 0 or $j == 7)) {89 # Excluding corner chips90 next;91 }92 push @classes, "XY$i$j";93 push @files, "$i$j";94 }89 for (my $j = 0; $j < 8; $j++) { 90 if (($i == 0 or $i == 7) and ($j == 0 or $j == 7)) { 91 # Excluding corner chips 92 next; 93 } 94 push @classes, "XY$i$j"; 95 push @files, "$i$j"; 96 } 95 97 } 96 98 $add_dir = 1; … … 100 102 101 103 foreach my $exp_name ( @ARGV ) { 102 my $command = "$pxinject -newExp -tmp_exp_name $exp_name -tmp_inst $camera -tmp_telescope $telescope -workdir $workdir "; # Command to run104 my $command = "$pxinject -newExp -tmp_exp_name $exp_name -tmp_inst $camera -tmp_telescope $telescope -workdir $workdir -tess_id $tess_id"; # Command to run 103 105 $command .= " -dbname $dbname" if defined $dbname; 104 106 105 107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 106 run( command => $command, verbose => 1 );108 run( command => $command, verbose => 1 ); 107 109 die "Unable to inject $exp_name: $error_code\n" if not $success; 108 110 109 111 my @line = split(/\s+/, $$stdout_buf[0]); # The output line, containing the exposure tag 110 my $exp_id = $line[2]; # The exposure tag112 my $exp_id = $line[2]; # The exposure tag 111 113 for (my $i = 0; $i < scalar @classes; $i++) { 112 my $class_id = $classes[$i];113 my $file_id = $files[$i];114 my $filename = $exp_name . $file_id . '.fits';115 $filename = caturi( $exp_name, $filename ) if defined $add_dir;116 $filename = caturi( $path, $filename );114 my $class_id = $classes[$i]; 115 my $file_id = $files[$i]; 116 my $filename = $exp_name . $file_id . '.fits'; 117 $filename = caturi( $exp_name, $filename ) if defined $add_dir; 118 $filename = caturi( $path, $filename ); 117 119 118 die "Unable to find file $filename" unless -f $ipprc->file_resolve( $filename );120 die "Unable to find file $filename" unless -f $ipprc->file_resolve( $filename ); 119 121 120 $filename = $ipprc->convert_filename_relative( $filename );121 my $command = "$pxinject -newImfile -exp_id $exp_id -tmp_class_id $class_id -uri $filename"; # Command to run122 $command .= " -dbname $dbname" if defined ($dbname);122 $filename = $ipprc->convert_filename_relative( $filename ); 123 my $command = "$pxinject -newImfile -exp_id $exp_id -tmp_class_id $class_id -uri $filename"; # Command to run 124 $command .= " -dbname $dbname" if defined ($dbname); 123 125 124 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =125 run( command => $command, verbose => 1 );126 die "Unable to inject $exp_name $class_id: $error_code\n" if not $success;126 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 127 run( command => $command, verbose => 1 ); 128 die "Unable to inject $exp_name $class_id: $error_code\n" if not $success; 127 129 } 128 130 129 131 if (scalar @classes == 0) { 130 my $filename = $exp_name . '.fits';131 $filename = caturi( $exp_name, $filename ) if defined $add_dir;132 $filename = caturi( $path, $filename );132 my $filename = $exp_name . '.fits'; 133 $filename = caturi( $exp_name, $filename ) if defined $add_dir; 134 $filename = caturi( $path, $filename ); 133 135 134 die "Unable to find file $filename" unless -f $ipprc->file_resolve( $filename );136 die "Unable to find file $filename" unless -f $ipprc->file_resolve( $filename ); 135 137 136 $filename = $ipprc->convert_filename_relative( $filename );137 my $command = "$pxinject -newImfile -exp_id $exp_id -tmp_class_id fpa -uri $filename"; # Command to run138 $command .= " -dbname $dbname" if defined ($dbname);139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =140 run( command => $command, verbose => 1 );141 die "Unable to inject $exp_name imfile: $error_code\n" if not $success;138 $filename = $ipprc->convert_filename_relative( $filename ); 139 my $command = "$pxinject -newImfile -exp_id $exp_id -tmp_class_id fpa -uri $filename"; # Command to run 140 $command .= " -dbname $dbname" if defined ($dbname); 141 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 142 run( command => $command, verbose => 1 ); 143 die "Unable to inject $exp_name imfile: $error_code\n" if not $success; 142 144 } 143 145 144 146 # Update the exposure to run 145 147 { 146 my $command = "$pxinject -updatenewExp -exp_id $exp_id -state run"; # Command to run147 $command .= " -dbname $dbname" if defined ($dbname);148 my $command = "$pxinject -updatenewExp -exp_id $exp_id -state run"; # Command to run 149 $command .= " -dbname $dbname" if defined ($dbname); 148 150 149 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =150 run( command => $command, verbose => 1 );151 die "Unable to activate $exp_name: $error_code\n" if not $success;151 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 152 run( command => $command, verbose => 1 ); 153 die "Unable to activate $exp_name: $error_code\n" if not $success; 152 154 } 153 155
Note:
See TracChangeset
for help on using the changeset viewer.
