Changeset 8763 for trunk/ippScripts/scripts/detrend_stack.pl
- Timestamp:
- Sep 6, 2006, 4:32:51 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_stack.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_stack.pl
r8734 r8763 4 4 use strict; 5 5 6 use vars qw( $VERSION ); 7 $VERSION = '0.01'; 8 6 9 use IPC::Cmd qw( can_run run ); 7 10 use PS::IPP::Metadata::Config; 8 11 use PS::IPP::Metadata::List qw( parse_md_list ); 9 12 use PS::IPP::Metadata::Stats; 10 use Data::Dumper; 13 14 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 15 use Pod::Usage qw( pod2usage ); 16 17 my ($det_id, $iter, $class_id, $det_type); 18 GetOptions( 19 'det_id|d=s' => \$det_id, 20 'iteration=s' => \$iter, 21 'class_id|i=s' => \$class_id, 22 'det_type|t=s' => \$det_type, 23 ) or pod2usage( 2 ); 24 25 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 26 pod2usage( 27 -msg => "Required options: --det_id --iteration --class_id --det_type", 28 -exitval => 3, 29 ) unless defined $det_id 30 and defined $iter 31 and defined $class_id 32 and defined $det_type; 11 33 12 34 # Recipes to use as a function of detrend type … … 24 46 }; 25 47 26 # Parse command-line arguments 27 die "Stack detrends.\n\n" . 28 "Usage: $0 DET_ID ITER CLASS_ID DETREND_TYPE\n\n" 29 if scalar @ARGV != 4; 30 my $detId = shift @ARGV; # Detrend ID 31 my $iter = shift @ARGV; # Iteration number 32 my $classId = shift @ARGV; # Class ID 33 my $detType = shift @ARGV; # Detrend type 34 35 die "Unrecognised detrend type: $detType\n" if not defined RECIPES->{$detType}; 36 my $recipe = RECIPES->{$detType}; # Recipe to use in stacking 48 die "Unrecognised detrend type: $det_type\n" if not defined RECIPES()->{$det_type}; 49 my $recipe = RECIPES()->{$det_type}; # Recipe to use in stacking 37 50 38 51 # Look for programs we need … … 47 60 my $files; # Array of files to be stacked 48 61 { 49 my $command = "$dettool -processed -det_id $det Id -iteration $iter -class_id $classId"; # Command to run62 my $command = "$dettool -processed -det_id $det_id -iteration $iter -class_id $class_id"; # Command to run 50 63 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 51 64 run(command => $command, verbose => 1); … … 57 70 58 71 # Stack the files 59 my $output = $det Type . '_' . $classId . '_' . $detId . '_' . $iter . '.fit'; # Output name60 my $outputStats = $det Type . '_' . $classId . '_' . $detId . '_' . $iter . '.stats'; # Statistics name72 my $output = $det_type . '_' . $class_id . '_' . $det_id . '_' . $iter . '.fit'; # Output name 73 my $outputStats = $det_type . '_' . $class_id . '_' . $det_id . '_' . $iter . '.stats'; # Statistics name 61 74 { 62 75 my $command = "$ppMerge $output"; # Command to run … … 66 79 } 67 80 $command .= " -recipe PPMERGE $recipe"; 68 $command .= ' -type ' . uc($det Type); # Type of stacking to perform81 $command .= ' -type ' . uc($det_type); # Type of stacking to perform 69 82 $command .= " -stats $outputStats"; # Statistics output filename 70 83 … … 95 108 # Add the resultant into the database 96 109 { 97 my $command = "$dettool -addstacked -det_id $det Id -iteration $iter -class_id $classId" .110 my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" . 98 111 " -uri $output -recip $recipe"; # Command to run 99 112 $command .= ' -bg ' . $stats->bg_mean(); 100 113 $command .= ' -bg_stdev ' . $stats->bg_stdev(); 101 114 $command .= ' -bg_mean_stdev ' . $stats->bg_mean_stdev(); 102 $command .= ' -pleasenormalize' if NORMALISE()->{$det Type};115 $command .= ' -pleasenormalize' if NORMALISE()->{$det_type}; 103 116 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 117 run(command => $command, verbose => 1);
Note:
See TracChangeset
for help on using the changeset viewer.
