Changeset 23295 for trunk/ippScripts/scripts/detrend_resid_exp.pl
- Timestamp:
- Mar 12, 2009, 11:38:13 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_resid_exp.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_resid_exp.pl
r23229 r23295 107 107 } 108 108 if (@$stdout_buf == 0) { 109 &my_die("No normalizations were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);109 &my_die("No normalizations were found", $det_id, $iter, $PS_EXIT_PROG_ERROR); 110 110 } 111 111 … … 126 126 print "saving norms to $normsName\n"; 127 127 foreach my $norm (@$normsMD) { 128 my $class_id = $norm->{class_id};129 my $normalization = $norm->{norm};130 131 $norms{$class_id} = $normalization;132 printf $normsFile "$class_id F32 $normalization\n", 128 my $class_id = $norm->{class_id}; 129 my $normalization = $norm->{norm}; 130 131 $norms{$class_id} = $normalization; 132 printf $normsFile "$class_id F32 $normalization\n", 133 133 } 134 134 close $normsFile; … … 153 153 } 154 154 if (@$stdout_buf == 0) { 155 &my_die("No imfiles were found", $det_id, $iter, $PS_EXIT_PROG_ERROR);155 &my_die("No imfiles were found", $det_id, $iter, $PS_EXIT_PROG_ERROR); 156 156 } 157 157 … … 168 168 # also, write out the modified metadata set 169 169 foreach my $mdItem (@$metadata) { 170 if ($mdItem->{class} ne "metadata") {171 carp "MD element ", $mdItem->{name}, " isn't of type METADATA --- ignored.\n";172 next;173 }174 my %hash;# Hash element175 my $mdComponents = $mdItem->{value}; # Components of the metadata176 177 # determine the class_id for this block:178 my $class_id;179 foreach my $data (@$mdComponents) {180 unless ($data->{name} eq "class_id") { next; }181 $class_id = $data->{value};182 last;183 }184 185 # a new metadata block186 print $statFile "rawResidImfile METADATA\n";187 188 # modify and save the data in this block:189 foreach my $data (@$mdComponents) {190 my $norm = $norms{$class_id};191 192 # fields to modify by the normalization:193 if ($data->{name} eq "bg") { $data->{value} *= $norm; }194 if ($data->{name} eq "bg_stdev") { $data->{value} *= $norm; }195 if ($data->{name} eq "bg_mean_stdev") { $data->{value} *= $norm; }196 if ($data->{name} eq "bg_skewness") { $data->{value} *= $norm; }197 if ($data->{name} eq "bg_kurtosis") { $data->{value} *= $norm; }198 if ($data->{name} eq "bin_stdev") { $data->{value} *= $norm; }199 200 # write out the metadata, save on the array of hashes201 print $statFile " $data->{name} $data->{type} $data->{value}\n";202 $hash{$data->{name}} = $data->{value};203 }204 print $statFile "END\n";205 push @files, \%hash;170 if ($mdItem->{class} ne "metadata") { 171 carp "MD element ", $mdItem->{name}, " isn't of type METADATA --- ignored.\n"; 172 next; 173 } 174 my %hash; # Hash element 175 my $mdComponents = $mdItem->{value}; # Components of the metadata 176 177 # determine the class_id for this block: 178 my $class_id; 179 foreach my $data (@$mdComponents) { 180 unless ($data->{name} eq "class_id") { next; } 181 $class_id = $data->{value}; 182 last; 183 } 184 185 # a new metadata block 186 print $statFile "rawResidImfile METADATA\n"; 187 188 # modify and save the data in this block: 189 foreach my $data (@$mdComponents) { 190 my $norm = $norms{$class_id}; 191 192 # fields to modify by the normalization: 193 if ($data->{name} eq "bg") { $data->{value} *= $norm; } 194 if ($data->{name} eq "bg_stdev") { $data->{value} *= $norm; } 195 if ($data->{name} eq "bg_mean_stdev") { $data->{value} *= $norm; } 196 if ($data->{name} eq "bg_skewness") { $data->{value} *= $norm; } 197 if ($data->{name} eq "bg_kurtosis") { $data->{value} *= $norm; } 198 if ($data->{name} eq "bin_stdev") { $data->{value} *= $norm; } 199 200 # write out the metadata, save on the array of hashes 201 print $statFile " $data->{name} $data->{type} $data->{value}\n"; 202 $hash{$data->{name}} = $data->{value}; 203 } 204 print $statFile "END\n"; 205 push @files, \%hash; 206 206 } 207 207 close $statFile; … … 633 633 my $exit_code = shift; # Exit code to add 634 634 635 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 636 635 637 carp($msg); 636 638 if (defined $det_id and defined $iter and defined $exp_id and not $no_update) {
Note:
See TracChangeset
for help on using the changeset viewer.
