IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 11, 2009, 3:54:00 PM (17 years ago)
Author:
watersc1
Message:

Bringing branch up-to-date at revision 25049

Location:
branches/czw_branch/cleanup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup

  • branches/czw_branch/cleanup/ippScripts/scripts/magic_destreak_revert.pl

    r24951 r25051  
    180180    $bsources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $backup_path_base);
    181181} elsif ($stage eq "diff") {
    182     my $name = $inverse ? "PPSUB.INVERSE" : "PPSUB.OUTPUT"; # Base name for images
     182    my $name = "PPSUB.OUTPUT";
    183183    $image  = $ipprc->filename($name, $path_base);
    184184    $mask   = $ipprc->filename("$name.MASK", $path_base);
    185185    $weight = $ipprc->filename("$name.VARIANCE", $path_base);
    186     $sources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $path_base);
     186    $sources = $ipprc->filename("$name.SOURCES", $path_base);
    187187    $bimage  = $ipprc->filename($name, $backup_path_base);
    188188    $bmask   = $ipprc->filename("$name.MASK", $backup_path_base);
    189189    $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base);
    190     $bsources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $backup_path_base);
    191 }
    192 
    193 if ($image) {
    194     revert_file($image, $bimage) or
    195         &my_die("failed to restore image file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    196 }
    197 
    198 if ($mask) {
    199     if (!revert_file($mask, $bmask)) {
    200         if ($stage eq 'chip') {
    201             # don't fail if the mask file (from the camera stage) fails to revert.
    202             # It probably doesn't exist
    203             # XXX: Handle this properly
    204             print STDERR "failure to revert mask file, ignored\n";
    205         } else {
    206             &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    207         }
    208     }
    209 }
    210 
    211 if ($ch_mask) {
    212     if (!revert_file($ch_mask, $bch_mask)) {
    213         &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    214     }
    215 }
    216 
    217 
    218 if ($weight) {
    219     revert_file($weight, $bweight) or
    220         &my_die("failed to restore variance image", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    221 }
    222 
    223 if ($sources) {
    224     revert_file($sources, $bsources) or
    225         &my_die("failed to restore sources file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    226 }
    227 
    228 if ($astrom) {
    229     revert_file($astrom, $bastrom) or
    230         &my_die("failed to restore astrometry file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     190    $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base);
     191}
     192
     193revert_files($image, $mask, $weight, $sources, $astrom, $bimage, $bmask, $bweight, $bsources, $bastrom);
     194
     195if ($stage eq "diff") {
     196    my $name = "PPSUB.INVERSE";
     197    $image  = $ipprc->filename($name, $path_base);
     198    $mask   = $ipprc->filename("$name.MASK", $path_base);
     199    $weight = $ipprc->filename("$name.VARIANCE", $path_base);
     200    $sources = $ipprc->filename("$name.SOURCES", $path_base);
     201    $bimage  = $ipprc->filename($name, $backup_path_base);
     202    $bmask   = $ipprc->filename("$name.MASK", $backup_path_base);
     203    $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base);
     204    $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base);
     205    revert_files($image, $mask, $weight, $sources, undef, $bimage, $bmask, $bweight, $bsources, undef);
    231206}
    232207
     
    254229
    255230### Pau.
     231
     232sub revert_files {
     233    my $image = shift;
     234    my $mask = shift;
     235    my $weight = shift;
     236    my $sources = shift;
     237    my $astrom = shift;
     238    my $bimage = shift;
     239    my $bmask = shift;
     240    my $bweight = shift;
     241    my $bsources = shift;
     242    my $bastrom = shift;
     243
     244    if ($image) {
     245        revert_file($image, $bimage) or
     246            &my_die("failed to restore image file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     247    }
     248
     249    if ($mask) {
     250        if (!revert_file($mask, $bmask)) {
     251            if ($stage eq 'chip') {
     252                # don't fail if the mask file (from the camera stage) fails to revert.
     253                # It probably doesn't exist
     254                # XXX: Handle this properly
     255                print STDERR "failure to revert mask file, ignored\n";
     256            } else {
     257                &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     258            }
     259        }
     260    }
     261
     262    if ($ch_mask) {
     263        if (!revert_file($ch_mask, $bch_mask)) {
     264            &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     265        }
     266    }
     267
     268
     269    if ($weight) {
     270        revert_file($weight, $bweight) or
     271            &my_die("failed to restore variance image", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     272    }
     273
     274    if ($sources) {
     275        revert_file($sources, $bsources) or
     276            &my_die("failed to restore sources file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     277    }
     278
     279    if ($astrom) {
     280        revert_file($astrom, $bastrom) or
     281            &my_die("failed to restore astrometry file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     282    }
     283}
    256284
    257285sub check_keyword
Note: See TracChangeset for help on using the changeset viewer.