Changeset 9004
- Timestamp:
- Sep 27, 2006, 9:35:47 AM (20 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 7 edited
-
detrend_apply_norm.pl (modified) (4 diffs)
-
detrend_calc_norm.pl (modified) (4 diffs)
-
detrend_create_resid.pl (modified) (8 diffs)
-
detrend_process.pl (modified) (4 diffs)
-
detrend_reject_exp.pl (modified) (1 diff)
-
detrend_reject_imfile.pl (modified) (3 diffs)
-
detrend_stack.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_apply_norm.pl
r8976 r9004 5 5 6 6 use IPC::Cmd qw( can_run run ); 7 use PS::IPP::Metadata::Config;8 use PS::IPP::Metadata::List qw( parse_md_list );9 7 use Data::Dumper; 10 8 … … 18 16 $value, # Value to multiple (for normalisation) 19 17 $input, # Input file 20 $output # Output file 18 $camera, # Camera 19 $detType # Detrend type 21 20 ); 22 21 GetOptions( … … 26 25 'value|v=s' => \$value, 27 26 'input_uri|u=s' => \$input, 28 'output_uri|o=s' => \$output, 27 'camera|c=s' => \$camera, 28 'det_type|t=s' => \$detType 29 29 ) or pod2usage( 2 ); 30 30 31 31 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 32 pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri -- output_uri",32 pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type", 33 33 -exitval => 3, 34 34 ) unless defined $detId 35 and defined $iter 36 and defined $classId 37 and defined $value 38 and defined $input 39 and defined $output; 40 35 and defined $iter 36 and defined $classId 37 and defined $value 38 and defined $input 39 and defined $camera 40 and defined $detType; 41 41 42 42 43 # Look for programs we need … … 46 47 die "Can't find required tools.\n" if $missing_tools; 47 48 48 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 49 # Output name 50 my $output = $camera . '.' . $detType . '.norm.' . $detId . '.' . $iter . '.' . $classId . '.fits'; 49 51 50 52 # Run ppArith -
trunk/ippScripts/scripts/detrend_calc_norm.pl
r8998 r9004 16 16 # Parse command-line arguments 17 17 my ($detId, # Detrend id 18 $iter, # Iteration 19 $camera, # Camera name 20 $detType # Detrend type 18 $iter # Iteration 21 19 ); 22 20 GetOptions( 23 21 'det_id|d=s' => \$detId, 24 22 'iteration|i=s' => \$iter, 25 'camera|c=s' => \$camera,26 'det_type|t=s' => \$detType27 23 ) or pod2usage( 2 ); 28 24 … … 31 27 -exitval => 3, 32 28 ) unless defined $detId 33 and defined $iter 34 and defined $camera 35 and defined $detType; 29 and defined $iter; 36 30 37 31 … … 56 50 57 51 # Parse the output 58 my $metadata = $mdcParser->parse( join "", @$stdout)52 my $metadata = $mdcParser->parse($stdout) 59 53 or die "unable to parse metadata config doc"; 60 54 $files = parse_md_list($metadata); … … 91 85 92 86 # Parse the output 93 $norms = $mdcParser->parse( join "", @$stdout)87 $norms = $mdcParser->parse($stdout) 94 88 or die "unable to parse metadata config doc"; 95 89 } -
trunk/ippScripts/scripts/detrend_create_resid.pl
r8983 r9004 16 16 17 17 my ($det_id, $iter, $exp_id, $class_id, $det_type, $detrend, 18 $input_uri , $output_uri);18 $input_uri); 19 19 GetOptions( 20 20 'det_id|d=s' => \$det_id, … … 25 25 'detrend=s' => \$detrend, 26 26 'input_uri|u=s' => \$input_uri, 27 'output_uri|o=s' => \$output_uri,28 27 ) or pod2usage( 2 ); 29 28 30 29 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 31 30 pod2usage( 32 -msg => "Required options: --det_id --iteration --exp_id --class_id --det_type --detrend --input_uri --output_uri",31 -msg => "Required options: --det_id --iteration --exp_id --class_id --det_type --detrend --input_uri", 33 32 -exitval => 3, 34 33 ) unless defined $det_id … … 38 37 and defined $det_type 39 38 and defined $detrend 40 and defined $input_uri 41 and defined $output_uri; 39 and defined $input_uri; 42 40 43 41 # Recipes to use, as a function of the detrend type … … 53 51 'dark' => '-dark', # Specify the dark frame 54 52 'flat' => '-flat', # Specify the flat frame 55 };56 57 # Prefix to add to filenames58 use constant PREFIX => {59 'bias' => 'ob', # Overscan only60 'dark' => 'obd', # Overscan and bias only61 'flat' => 'obdf', # Overscan, bias and dark only62 53 }; 63 54 … … 77 68 my $detFlag = DETRENDS->{$det_type}; 78 69 die "Unrecognised detrend type: $det_type\n" if not defined $detFlag; 79 # Prefix to use for filename80 my $prefix = PREFIX->{$det_type};81 die "Unrecognised detrend type: $det_type\n" if not defined $prefix;82 70 83 71 ### Output file names --- must match camera configuration! 84 my $outputRoot = $ prefix . '_' . $output_uri;85 my $outputName = $outputRoot . '.' . $class_id . '.fit ';72 my $outputRoot = $exp_id . '.detresid.' . $det_id . '.' . $iter; # Root name 73 my $outputName = $outputRoot . '.' . $class_id . '.fits'; # Name for 86 74 my $outputStats = $outputRoot . '.' . $class_id . '.stats'; 87 my $bin1Name = $outputRoot . '.' . $class_id . '.b1.fit ';88 my $bin2Name = $outputRoot . '.' . $class_id . '.b2.fit ';75 my $bin1Name = $outputRoot . '.' . $class_id . '.b1.fits'; 76 my $bin2Name = $outputRoot . '.' . $class_id . '.b2.fits'; 89 77 90 78 # Run ppImage … … 96 84 die "Unable to perform ppImage on $input_uri: $error_code\n" if not $success; 97 85 die "Couldn't find expected output file: $outputName\n" if not -f $outputName; 86 die "Couldn't find expected output file: $outputStats\n" if not -f $outputStats; 98 87 die "Couldn't find expected output file: $bin1Name\n" if not -f $bin1Name; 99 88 die "Couldn't find expected output file: $bin2Name\n" if not -f $bin2Name; … … 104 93 { 105 94 my $statsFile; # File handle 106 open $statsFile, "$outputStats"or die "Can't open statistics file $outputStats: $!\n";95 open $statsFile, $outputStats or die "Can't open statistics file $outputStats: $!\n"; 107 96 my @contents = <$statsFile>; # Contents of file 108 97 close $statsFile; … … 134 123 } 135 124 136 unlink "$output_uri.stats"if DELETE_STATS;125 unlink $outputStats if DELETE_STATS; 137 126 138 127 __END__ -
trunk/ippScripts/scripts/detrend_process.pl
r8983 r9004 22 22 'det_type|t=s' => \$det_type, 23 23 'input_uri|u=s' => \$input_uri, 24 'output_uri|o=s' => \$output_uri,25 24 ) or pod2usage( 2 ); 26 25 27 26 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 28 27 pod2usage( 29 -msg => "Required options: --det_id --exp_id --class_id --det_type --input_uri --output_uri",28 -msg => "Required options: --det_id --exp_id --class_id --det_type --input_uri", 30 29 -exitval => 3, 31 30 ) unless defined $det_id … … 33 32 and defined $class_id 34 33 and defined $det_type 35 and defined $input_uri 36 and defined $output_uri; 34 and defined $input_uri; 37 35 38 36 # Recipes to use, as a function of the detrend type … … 41 39 'dark' => 'PPIMAGE_OB', # Overscan and bias only 42 40 'flat' => 'PPIMAGE_OBD', # Overscan, bias and dark only 43 };44 45 # Prefix to add to filenames46 use constant PREFIX => {47 'bias' => 'o', # Overscan only48 'dark' => 'ob', # Overscan and bias only49 'flat' => 'obd', # Overscan, bias and dark only50 41 }; 51 42 … … 61 52 my $recipe = RECIPES->{$det_type}; 62 53 die "Unrecognised detrend type: $det_type\n" if not defined $recipe; 63 die "Unrecognised detrend type: $det_type\n" if not defined PREFIX->{$det_type};64 54 65 55 ### Output file name --- must match camera configuration! 66 my $outputRoot = PREFIX->{$det_type} . '_' . $output_uri;56 my $outputRoot = $exp_id . '.detproc' ; 67 57 my $outputName = $outputRoot . '.' . $class_id ; 68 my $outputImage = $outputName . '.fit ';58 my $outputImage = $outputName . '.fits'; 69 59 my $outputStats = $outputName . '.stats'; 70 60 -
trunk/ippScripts/scripts/detrend_reject_exp.pl
r8764 r9004 24 24 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 25 25 pod2usage( 26 -msg => "Required options: --det_id -- exp_id --class_id --det_type --input_uri --output_uri",26 -msg => "Required options: --det_id --iteration --det_type", 27 27 -exitval => 3, 28 28 ) unless defined $det_id -
trunk/ippScripts/scripts/detrend_reject_imfile.pl
r8963 r9004 96 96 97 97 # Generate the file list, and get the statistics 98 my $output Name = $exp_id . '_' . $det_id . '_' . $iter; # Root output name99 my $list1Name = $output Name . '_jpeg1.list'; # Name for the input file list for binning 1100 my $list2Name = $output Name . '_jpeg2.list'; # Name for the input file list for binning 298 my $outputRoot = $exp_id . '.detresid.' . $det_id . '.' . $iter; # Root output name 99 my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1 100 my $list2Name = $outputRoot . '.b2.list'; # Name for the input file list for binning 2 101 101 my @means; # Array of means 102 102 my @stdevs; # Array of stdevs … … 113 113 114 114 # Output products --- need to synch with the camera configuration! 115 my $jpeg1Name = $output Name. ".b1.jpg"; # Binned JPEG #1116 my $jpeg2Name = $output Name. ".b2.jpg"; # Binned JPEG #2115 my $jpeg1Name = $outputRoot . ".b1.jpg"; # Binned JPEG #1 116 my $jpeg2Name = $outputRoot . ".b2.jpg"; # Binned JPEG #2 117 117 118 118 # Make the jpeg for binning 1 119 119 { 120 my $command = "$ppImage -list $list1Name $output Name-recipe PPIMAGE " . RECIPE1; # Command to run120 my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run 121 121 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 122 122 run(command => $command, verbose => 1); … … 126 126 # Make the jpeg for binning 2 127 127 { 128 my $command = "$ppImage -list $list2Name $output Name-recipe PPIMAGE " . RECIPE2; # Command to run128 my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run 129 129 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 130 130 run(command => $command, verbose => 1); -
trunk/ippScripts/scripts/detrend_stack.pl
r8983 r9004 15 15 use Pod::Usage qw( pod2usage ); 16 16 17 my ($det_id, $iter, $class_id, $det_type );17 my ($det_id, $iter, $class_id, $det_type, $camera); 18 18 GetOptions( 19 19 'det_id|d=s' => \$det_id, … … 21 21 'class_id|i=s' => \$class_id, 22 22 'det_type|t=s' => \$det_type, 23 'camera|c=s' => \$camera, 23 24 ) or pod2usage( 2 ); 24 25 25 26 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 26 27 pod2usage( 27 -msg => "Required options: --det_id --iteration --class_id --det_type ",28 -msg => "Required options: --det_id --iteration --class_id --det_type --camera", 28 29 -exitval => 3, 29 30 ) unless defined $det_id 30 31 and defined $iter 31 32 and defined $class_id 32 and defined $det_type; 33 and defined $det_type 34 and defined $camera; 33 35 34 36 # Recipes to use as a function of detrend type … … 44 46 'dark' => 0, 45 47 'flat' => 1 46 }; 48 }; 47 49 48 die "Unrecognised detrend type: $det_type\n" if not defined RECIPES()->{$det_type}; 50 die "Unrecognised detrend type: $det_type\n" if not defined RECIPES()->{$det_type} 51 or not defined NORMALISE()->{$det_type}; 49 52 my $recipe = RECIPES()->{$det_type}; # Recipe to use in stacking 50 53 … … 70 73 71 74 # Stack the files 72 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 75 my $outputRoot = $camera . '.' . $det_type . '.' . $det_id . '.' . $iter . '.' . $class_id; # Root name 76 my $outputStack = $outputRoot . '.fits'; # Output name 77 my $outputStats = $outputRoot . '.stats'; # Statistics name 74 78 { 75 my $command = "$ppMerge $output "; # Command to run79 my $command = "$ppMerge $outputStack"; # Command to run 76 80 foreach my $file (@$files) { 77 81 my $uri = $file->{uri}; # URI for input file … … 85 89 run(command => $command, verbose => 1); 86 90 die "Unable to perform ppMerge: $error_code\n" if not $success; 87 die "Unable to find expected output file: $output \n" if not -f $output;91 die "Unable to find expected output file: $outputStack\n" if not -f $outputStack; 88 92 die "Unable to find expected output file: $outputStats\n" if not -f $outputStats; 89 93 } … … 109 113 { 110 114 my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" . 111 " -uri $output -recip $recipe";# Command to run115 " -uri $outputStack -recip $recipe"; # Command to run 112 116 $command .= ' -bg ' . $stats->bg_mean(); 113 117 if (defined($stats->bg_stdev())) {
Note:
See TracChangeset
for help on using the changeset viewer.
