Changeset 13275 for trunk/ippScripts/scripts/detrend_process_exp.pl
- Timestamp:
- May 4, 2007, 4:52:03 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_process_exp.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_process_exp.pl
r12800 r13275 18 18 use Statistics::Descriptive; 19 19 20 use PS::IPP::Config qw( 21 $PS_EXIT_SUCCESS 22 $PS_EXIT_UNKNOWN_ERROR23 $PS_EXIT_SYS_ERROR24 $PS_EXIT_CONFIG_ERROR25 $PS_EXIT_PROG_ERROR26 $PS_EXIT_DATA_ERROR27 $PS_EXIT_TIMEOUT_ERROR 28 );20 use PS::IPP::Config qw($PS_EXIT_SUCCESS 21 $PS_EXIT_UNKNOWN_ERROR 22 $PS_EXIT_SYS_ERROR 23 $PS_EXIT_CONFIG_ERROR 24 $PS_EXIT_PROG_ERROR 25 $PS_EXIT_DATA_ERROR 26 $PS_EXIT_TIMEOUT_ERROR 27 caturi 28 ); 29 29 my $ipprc = PS::IPP::Config->new(); # IPP configuration 30 use File:: Spec;30 use File::Temp qw( tempfile ); 31 31 32 32 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 115 115 } 116 116 117 # Set output directory 118 if (defined $workdir) { 119 $workdir = $ipprc->convert_filename_absolute( $workdir ); 120 my $subdir = "$camera.$det_type.$det_id"; 121 $workdir = File::Spec->catdir( $workdir, $subdir, $exp_tag ); 122 } else { 123 my $example = $ipprc->convert_filename_absolute( ${$files}[0]->{path_base} ); # Example original name 124 my ($vol, $dir, $file) = File::Spec->splitpath( $example ); 125 $workdir = $dir; 126 } 127 system "mkdir -p $workdir" unless -d $workdir; 128 129 my $outputFile = $exp_tag . '.detproc.' . $det_id; # Root name 130 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 131 132 # output files: 133 my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1 134 my $list2Name = $outputRoot . '.b2.list'; # Name for the input file list for binning 2 117 # File lists for the two binnings 118 my ($list1File, $list1Name) = tempfile( "$exp_tag.detproc.$det_id.b1.list.XXXX", UNLINK => 1 ); 119 my ($list2File, $list2Name) = tempfile( "$exp_tag.detproc.$det_id.b2.list.XXXX", UNLINK => 1 ); 135 120 my @means; # Array of means 136 121 my @stdevs; # Array of stdevs 137 open my $list1File, '>' . $list1Name;138 open my $list2File, '>' . $list2Name;139 122 foreach my $file (@$files) { 140 my $origRoot = $ipprc->convert_filename_absolute( $file->{path_base} ); # Original root name 141 print $list1File ($ipprc->filename( "PPIMAGE.BIN1", $origRoot, $file->{class_id} ) . "\n"); 142 print $list2File ($ipprc->filename( "PPIMAGE.BIN2", $origRoot, $file->{class_id} ) . "\n"); 123 print $list1File ($ipprc->filename( "PPIMAGE.BIN1", $file->{path_base}, $file->{class_id} ) . "\n"); 124 print $list2File ($ipprc->filename( "PPIMAGE.BIN2", $file->{path_base}, $file->{class_id} ) . "\n"); 143 125 push @means, $file->{bg}; 144 126 push @stdevs, $file->{bg_stdev}; … … 147 129 close $list2File; 148 130 149 # Output products 131 # Output files 132 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir; 133 my $outputRoot = $ipprc->file_prepare( "$exp_tag.detproc.$det_id", $workdir, ${$files}[0]->{path_base} ); 150 134 my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1 151 135 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2 … … 161 145 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code); 162 146 } 163 &my_die("Unable to find expected output file: $jpeg1", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $ jpeg1;147 &my_die("Unable to find expected output file: $jpeg1", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg1); 164 148 } 165 149 … … 173 157 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code); 174 158 } 175 &my_die("Unable to find expected output file: $jpeg2", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2; 176 } 177 } 178 179 # Add the result into the database 180 $outputRoot = $ipprc->convert_filename_relative( $outputRoot ); 159 &my_die("Unable to find expected output file: $jpeg2", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg2); 160 } 161 } 181 162 182 163 unless ($no_update) { … … 192 173 exit($error_code); 193 174 } 194 195 unlink $list1Name;196 unlink $list2Name;197 175 } 198 176
Note:
See TracChangeset
for help on using the changeset viewer.
