IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 1, 2010, 2:03:34 PM (16 years ago)
Author:
bills
Message:

fix error handling cleanup of warp - stack diffs

File:
1 edited

Legend:

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

    r27785 r29097  
    3838
    3939# Parse the command-line arguments
    40 my ($magic_ds_id, $camera);
     40my ($magic_ds_id, $camera, $stage);
    4141my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile);
    4242
     
    4444           'magic_ds_id=s'  => \$magic_ds_id,# Magic destreak run identifier
    4545           'camera=s'       => \$camera,     # camera for evaluating file rules
     46           'stage=s'        => \$stage,     # camera for evaluating file rules
    4647           'save-temps'     => \$save_temps, # Save temporary files?
    4748           'dbname=s'       => \$dbname,     # Database name
     
    5657           -exitval => 3) unless
    5758    defined $magic_ds_id and
    58     defined $camera;
    59 #    defined $stage and
    60 #    defined $stage_id;
     59    defined $camera and
     60    defined $stage;
    6161
    6262my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     
    7979my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) or die "Cannot connect to mysql server\n";
    8080
    81 my $q1 = "SELECT magicDSRun.*, camera, camProcessedExp.path_base AS cam_path_base, camRun.reduction AS cam_reduction, magicRun.inverse"
    82          . " FROM magicDSRun JOIN magicRun USING(magic_id) JOIN rawExp USING(exp_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN camRun USING(cam_id)"
    83          . " WHERE magic_ds_id = $magic_ds_id";
     81my $q1;
     82
     83if ($stage ne 'diff') {
     84    $q1 = "SELECT magicDSRun.*, camera, camProcessedExp.path_base AS cam_path_base, camRun.reduction AS cam_reduction"
     85     . " FROM magicDSRun JOIN magicRun USING(magic_id) JOIN rawExp USING(exp_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN camRun USING(cam_id)";
     86} else {
     87    $q1 = "SELECT magicDSRun.*, diffRun.diff_mode FROM magicDSRun JOIN diffRun ON stage_id = diffRun.diff_id AND stage = 'diff'";
     88}
     89$q1 .= " WHERE magic_ds_id = $magic_ds_id";
     90
    8491my $q2 = "SELECT * from magicDSFile where magic_ds_id = $magic_ds_id";
    8592
     
    8996&my_die ("Unable to find magicDSRun $magic_ds_id", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if !$nrows;
    9097my $run = $stmt1->fetchrow_hashref();
     98$stmt1->finish();
    9199
    92100my $state = $run->{state};
    93 my $stage = $run->{stage};
    94101my $stage_id = $run->{stage_id};
    95102my $cam_path_base = $run->{cam_path_base};
    96103my $cam_reduction = $run->{cam_reduction};
    97104$cam_reduction = 'DEFAULT' if !$cam_reduction or ($cam_reduction eq 'NULL');
    98 my $inverse = $run->{inverse};
     105
     106my $warp_warp = ($stage eq 'diff' and $run->{diff_mode} eq 1);
    99107
    100108
     
    105113&my_die("clean not allowed for raw stage, use goto_restore", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $stage eq "raw";
    106114
    107 my $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use
    108 &my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro;
     115my $recipe_psastro;
     116if ($stage eq 'chip') {
     117    $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use
     118    &my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro;
     119}
    109120
    110121
     
    217228        delete_files($rimage, $rmask, $rweight, $rsources, $rastrom, $bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask);
    218229
    219         if ($stage eq "diff" and $inverse) {
     230        if ($stage eq "diff" and $warp_warp) {
    220231            my $name = "PPSUB.INVERSE";
    221232            if ($backup_path_base) {
Note: See TracChangeset for help on using the changeset viewer.