Changeset 8255
- Timestamp:
- Aug 8, 2006, 7:18:17 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase0imfile.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase0imfile.pl
r8240 r8255 10 10 use constant RECIPE => "PPSTATS_PHASE0_IMFILE"; # Recipe to use for ppStats 11 11 12 use constant IMFILE_BG => 'background'; # Key for the background out of p0search -pendingimfile 13 use constant IMFILE_BGSD => 'background_stdev'; # Key for the background standard deviation 12 # Switches for p0search 13 use constant P0SEARCH_MODE => '-updateimfile'; # Mode for p0search 14 use constant P0SEARCH_EXPID => '-exp_id'; # Switch to specify the exposure id 15 use constant P0SEARCH_CLASSID => '-class_id'; # Switch to specify the class id 16 use constant P0SEARCH_BG => '-bg'; # Switch to add the background 17 use constant P0SEARCH_BGSD => '-background_stdev'; # Switch to add the bg stdev 18 use constant P0SEARCH_EXPTIME => '-exp_time'; # Switch to add the exposure time 14 19 15 20 if (scalar @ARGV == 0 || scalar @ARGV > 3) { … … 35 40 my $parsed; # Parsed metadata 36 41 { 37 my $command = "$ppStats $file "; # Command to run ppStats42 my $command = "$ppStats $file -recipe PPSTATS " . RECIPE; # Command to run ppStats 38 43 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 39 run(command => $command, verbose => 0);44 run(command => $command, verbose => 1); 40 45 die "Unable to perform ppStats on exposure id $expid: $error_code\n" if not $success; 41 46 $parsed = $mdcParser->parse(join "", @$stdout_buf); … … 44 49 my $bg = 0; # Mean background level 45 50 my $sd = 0; # Mean standard deviation 51 my $expTime = 0; # Mean exposure time 46 52 my $bgNum = 0; # Number of background entries 47 53 my $sdNum = 0; # Number of standard deviation entries 54 my $expTimeNum = 0; # Number of exposure time entries 48 55 foreach my $fpaItem (@$parsed) { 49 56 if ($fpaItem->{class} eq "metadata") { … … 64 71 $bgNum++; 65 72 } 73 } elsif ($cellItem->{name} =~ /CELL\.EXPOSURE/) { 74 $expTime += $cellItem->{value}; 75 $expTimeNum++; 66 76 } 67 77 } … … 70 80 } 71 81 } 82 die "Unable to find statistics.\n" if ($bgNum == 0 or $sdNum == 0); 72 83 $bg /= $bgNum; 73 84 $sd /= $sdNum; 85 die "Unable to find exposure times.\n" if ($expTimeNum == 0); 86 $expTime /= $expTimeNum; 74 87 75 88 # Push the results into the database 76 89 { 77 my $command = "$p0search -updateimfile -exp_id $expid -class_id $classid -background $bg " . 78 "-background_stdev $sd"; # Command to run p0search 90 my $command = "$p0search " . P0SEARCH_MODE . " " . P0SEARCH_EXPID() . " $expid " . 91 P0SEARCH_CLASSID() . " $classid " . P0SEARACH_BG() ." $bg " . P0SEARCH_BGSD() ." $sd " . 92 P0SEARCH_EXPTIME() . " $expTime"; # Command to run p0search 79 93 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 80 run(command => $command, verbose => 0);94 run(command => $command, verbose => 1); 81 95 die "Unable to perform p0search -updateimfile: $error_code\n" if not $success; 82 96 } 83
Note:
See TracChangeset
for help on using the changeset viewer.
