IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33079


Ignore:
Timestamp:
Jan 10, 2012, 2:17:58 PM (15 years ago)
Author:
watersc1
Message:

Updated LAP code that does nto require magic to be run on the images. May need further debugging, but appears to work fine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20111222/ippScripts/scripts/lap_science.pl

    r32928 r33079  
    3333# Global configuration constants that probably should be read from elsewhere. 
    3434my $qstack_threshold     = 0.05; # Only make a quickstack if more than 5% of the exposures require it.
    35 my $minimum_stack_inputs = 6;    # We can avoid magicking stack inputs if we have more than this number.
     35my $minimum_stack_inputs = 2;    # We can avoid magicking stack inputs if we have more than this number.
    3636
    3737GetOptions(
     
    620620    my $are_warped = 0;
    621621    my $are_magicked = 0;
    622 
    623622    foreach my $exposure (@$exposures) {
    624623        $total_exposures++;
     
    710709            $exposure->{data_state} = 'to_diff';
    711710        }
    712         if (($exposure->{diff_id})&&(&S64_IS_NOT_NULL($exposure->{diff_id}))) {
     711        if (($exposure->{diff_id})&&
     712            (&S64_IS_NOT_NULL($exposure->{diff_id}))&&
     713            (($exposure->{diffRun_state} eq 'full')||
     714             ($exposure->{diffRun_state} eq 'cleaned'))
     715            ) {
     716            $are_magicked++;
    713717            $have_diff ++;
    714             $exposure->{data_state} = 'to_magic';
    715         }
    716         if (($exposure->{magicked})&&
    717             ($exposure->{warpRun_state})&&
    718             ($exposure->{warpRun_state} eq 'full')&&
    719             (&S64_IS_NOT_NULL($exposure->{magicked}))) {  # This exposure has been magicked, so it is through with diff.
    720             $are_magicked++;
     718#           $exposure->{data_state} = 'to_magic';
    721719            $exposure->{data_state} = 'full';
    722 #           $can_fstack ++;
    723         }
    724         &update_this_exposure($exposure);
     720        }
     721        # We no longer need to care about magic
     722#       if (($exposure->{magicked})&&
     723#           ($exposure->{warpRun_state})&&
     724#           ($exposure->{warpRun_state} eq 'full')&&
     725#           (&S64_IS_NOT_NULL($exposure->{magicked}))) { # This exposure has been magicked, so it is through with diff.
     726#           $are_magicked++;
     727#           $exposure->{data_state} = 'full';
     728# #         $can_fstack ++;
     729#       }
     730        unless ($debug) {
     731            &update_this_exposure($exposure);
     732        }
    725733    }
    726734
     
    748756        if ($defined_fstack == 0) {        # We have not yet made any stacks.
    749757            print "STATUS: We can attempt to queue deep final stacks.\n";
    750             my $Nstacks_made = &queue_muggle_finalstack($exposures);
     758            my $Nstacks_made;
     759            unless ($debug) {
     760                $Nstacks_made = &queue_muggle_finalstack($exposures);
     761            }
    751762            print "STATUS: Made $Nstacks_made final stacks.\n";
    752763            exit($Nstacks_made);
     
    756767            if ($have_fstack == $defined_fstack) { # We have made all the stacks we have asked for (so far)
    757768                if ($are_magicked < $total_exposures) { # But we have not yet made diffs
     769#               if ($have_diff < $total_exposures) { # We have not yet made diffs
    758770                    if (($can_diff == $total_exposures)&& # And we have exposures that should be diffed.
    759771                        ($have_diff < $can_diff)) {       # and we haven't made them all yet, either.
     
    763775#                           &update_this_exposure($exposure);
    764776#                       }
    765                         &queue_diffs($exposures);
     777                        unless ($debug) {
     778                            &queue_diffs($exposures);
     779                        }
    766780                        exit(0);
    767781                    }
     
    774788                }
    775789                elsif ($are_magicked == $total_exposures) { # We have made all of the diffs, and propagated through magic
    776                     print "STATUS: We can create all remaining stacks possible.\n";
    777                     my $Nstacks_made = &queue_magic_finalstack($exposures);
    778                     if ($Nstacks_made == 0) { # We have made all the stacks that we will ever make.
     790                    print "STATUS: We would create all remaining stacks possible, but no longer require magic.\n";
     791#                   my $Nstacks_made = -1;
     792#                   unless ($debug) {
     793#                       $Nstacks_made = &queue_muggle_finalstack($exposures);
     794#                   }
     795#                   if ($Nstacks_made == 0) { # We have made all the stacks that we will ever make.
    779796                        print "STATUS: No more stacks generated. Deactivating exposures for this complete lapRun.\n";
    780                         &deactivate_exposures($exposures);
    781                         $command = "$laptool -updaterun -lap_id $lap_id";
    782                         $command .= " -dbname $dbname " if defined $dbname;
    783                         $command .= " -set_state full ";
    784                         my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    785                             run(command => $command, verbose => $verbose);
    786                         unless ($success) {
    787                             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    788                             &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    789                         }
     797                        unless ($debug) {
     798                            &deactivate_exposures($exposures);
     799                       
     800                            $command = "$laptool -updaterun -lap_id $lap_id";
     801                            $command .= " -dbname $dbname " if defined $dbname;
     802                            $command .= " -set_state full ";
     803                            my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     804                                run(command => $command, verbose => $verbose);
     805                            unless ($success) {
     806                                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     807                                &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
     808                            }
     809#                       }
    790810                        exit(0);
    791811                    }
    792                     else {
    793                         print "STATUS: $Nstacks_made stacks made.\n";
    794                         exit(0);
    795                     }
     812#                   else {
     813#                       print "STATUS: $Nstacks_made stacks made.\n";
     814#                       exit(0);
     815#                   }
    796816                }
    797817                else { # What?
     
    9951015    foreach $exposure (@$exposures) {
    9961016        if (($exposure->{data_state} ne 'drop')&&
    997             (S64_IS_NOT_NULL($exposure->{magicked}))&&
     1017#           (S64_IS_NOT_NULL($exposure->{magicked}))&&
    9981018            (S64_IS_NOT_NULL($exposure->{warp_id}))) {
    9991019            $warps .= " -warp_id $exposure->{warp_id} ";
     
    14781498        $command .= " -set_data_state $exposure->{data_state} ";
    14791499    }
    1480 
    1481     my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    1482         run(command => $command, verbose => $verbose);
    1483     unless ($success) {
    1484         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    1485         &my_die("Unable to perform laptool -updateexp: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     1500    unless ($do_nothing) {
     1501        my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1502            run(command => $command, verbose => $verbose);
     1503       
     1504        unless ($success) {
     1505            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     1506            &my_die("Unable to perform laptool -updateexp: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     1507        }
    14861508    }
    14871509}   
Note: See TracChangeset for help on using the changeset viewer.