IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25019


Ignore:
Timestamp:
Aug 7, 2009, 12:42:25 PM (17 years ago)
Author:
bills
Message:

update revert to new scheme (single magicDSRun per diffRun)

File:
1 edited

Legend:

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

    r24936 r25019  
    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";
     183    $name = $inverse ? "PPSUB.INVERSE" : "PPSUB.OUTPUT"; # Base name for images
    183184    $image  = $ipprc->filename($name, $path_base);
    184185    $mask   = $ipprc->filename("$name.MASK", $path_base);
     
    188189    $bmask   = $ipprc->filename("$name.MASK", $backup_path_base);
    189190    $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);
     191    $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base);
     192}
     193
     194revert_files($image, $mask, $weight, $sources, $astrom, $bimage, $bmask, $bweight, $bsources, $bastrom);
     195
     196if ($stage eq "diff") {
     197    $name = "PPSUB.INVERSE";
     198    $image  = $ipprc->filename($name, $path_base);
     199    $mask   = $ipprc->filename("$name.MASK", $path_base);
     200    $weight = $ipprc->filename("$name.VARIANCE", $path_base);
     201    $sources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $path_base);
     202    $bimage  = $ipprc->filename($name, $backup_path_base);
     203    $bmask   = $ipprc->filename("$name.MASK", $backup_path_base);
     204    $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base);
     205    $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base);
     206    revert_files($image, $mask, $weight, $sources, undef, $bimage, $bmask, $bweight, $bsources, undef);
    231207}
    232208
     
    254230
    255231### Pau.
     232
     233sub revert_files {
     234    my $image = shift;
     235    my $mask = shift;
     236    my $weight = shift;
     237    my $sources = shift;
     238    my $astrom = shift;
     239    my $bimage = shift;
     240    my $bmask = shift;
     241    my $bweight = shift;
     242    my $bsources = shift;
     243    my $bastrom = shift;
     244
     245    if ($image) {
     246        revert_file($image, $bimage) or
     247            &my_die("failed to restore image file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     248    }
     249
     250    if ($mask) {
     251        if (!revert_file($mask, $bmask)) {
     252            if ($stage eq 'chip') {
     253                # don't fail if the mask file (from the camera stage) fails to revert.
     254                # It probably doesn't exist
     255                # XXX: Handle this properly
     256                print STDERR "failure to revert mask file, ignored\n";
     257            } else {
     258                &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     259            }
     260        }
     261    }
     262
     263    if ($ch_mask) {
     264        if (!revert_file($ch_mask, $bch_mask)) {
     265            &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     266        }
     267    }
     268
     269
     270    if ($weight) {
     271        revert_file($weight, $bweight) or
     272            &my_die("failed to restore variance image", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     273    }
     274
     275    if ($sources) {
     276        revert_file($sources, $bsources) or
     277            &my_die("failed to restore sources file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     278    }
     279
     280    if ($astrom) {
     281        revert_file($astrom, $bastrom) or
     282            &my_die("failed to restore astrometry file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
     283    }
     284}
    256285
    257286sub check_keyword
Note: See TracChangeset for help on using the changeset viewer.