IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 12, 2009, 11:38:13 AM (17 years ago)
Author:
Paul Price
Message:

Set error code to PROG_ERROR if not already set --- avoids infinite pantasks loops.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/detrend_resid_exp.pl

    r23229 r23295  
    107107    }
    108108    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);
    110110    }
    111111
     
    126126    print "saving norms to $normsName\n";
    127127    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",
    133133    }
    134134    close $normsFile;
     
    153153    }
    154154    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);
    156156    }
    157157
     
    168168    # also, write out the modified metadata set
    169169    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 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;
     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;
    206206    }
    207207    close $statFile;
     
    633633    my $exit_code = shift; # Exit code to add
    634634
     635    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     636
    635637    carp($msg);
    636638    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.