IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 21, 2010, 2:45:13 PM (16 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/ippScripts/scripts/automate_stacks.pl

    r29124 r29515  
    124124    defined $check_chips or defined $check_stacks or $check_sweetspot or $check_detrends or $check_dqstats or
    125125    defined $test_mode or defined $clean_old or defined $check_mode or
    126     defined $confirm_stacks;
     126    defined $confirm_stacks or defined $burntool_stats;
    127127
    128128# Configurable parameters from our config file.
    129129my @target_list = ();
    130130my @filter_list = ();
     131my %distribution_list = ();
    131132my %tessID_list = ();
    132133my %obsmode_list = ();
     
    135136my %cleanmods_list = ();
    136137my %stackable_list = ();
     138my %extra_processing = ();
    137139my %reduction_class = ();
    138140my %macro_formats = ();
     
    206208                $this_target = ${ $tentry }{value};
    207209                push @target_list, $this_target;
     210                $distribution_list{$this_target} = $this_target;
     211            }
     212            elsif (${ $tentry }{name} eq 'DISTRIBUTION') {
     213                $distribution_list{$this_target} = ${ $tentry }{value};
    208214            }
    209215            elsif (${ $tentry }{name} eq 'TESS') {
     
    222228                $stackable_list{$this_target} = ${ $tentry }{value};
    223229            }
     230            elsif (${ $tentry }{name} eq 'EXTRA_PROCESSING') {
     231                $extra_processing{$this_target} = ${ $tentry }{value};
     232            }
    224233            elsif (${ $tentry }{name} eq 'REDUCTION') {
    225234                $reduction_class{$this_target} = ${ $tentry }{value};
     
    726735        my ($Nexposures,$Nimfiles,$Nburntooled,$Nalready) = pre_chip_queue($date,$target);
    727736        if (defined($burntool_stats)) {
    728             print "$Nexposures $Nimfiles $Nburntooled $Nalready\n";
     737            print "BTSTATS: $date $target $Nexposures $Nimfiles $Nburntooled $Nalready\n";
    729738        }
    730739
    731740        if ($Nexposures == 0) {
    732741            print STDERR "execute_chips: Target $target on $date had no exposures.\n";
    733 #           next;
     742            next;
    734743        }
    735744        if ($Nalready != 0) {
    736745            print STDERR "execute_chips: Not queueing $target on $date due to already existing exposures.\n";
    737 #            next;
     746            next;
    738747        }
    739748        if ($Nimfiles != $Nburntooled) {
     
    11831192        &my_die("Unable to perform stacktool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR);
    11841193    }
     1194   
     1195   
    11851196    return(0);
    11861197}
     
    11901201    my $pretend = shift;
    11911202    foreach my $target (@target_list) {
    1192         if ($stackable_list{$target} == 1) {
    1193             foreach my $filter (@filter_list) {
     1203        foreach my $filter (@filter_list) {
     1204            if (exists($extra_processing{$target})) {
     1205                do_extra_processing($date,$target,$filter,$pretend);
     1206            }
     1207            if ($stackable_list{$target} == 1) {
    11941208                my ($Nexposures,$NprocChips,$NprocWarps,$Nalready) = pre_stack_queue($date,$target,$filter);
    11951209                if ((!defined($force_stack_count))&&($NprocChips != $NprocWarps)) { # This makes me sad. :(
     
    12311245                }
    12321246            }
     1247            else {
     1248                # print STDERR "execute_stacks: Target $target is not auto-stackable.\n";
     1249            }
    12331250        }
    1234         else {
    1235             # print STDERR "execute_stacks: Target $target is not auto-stackable.\n";
    1236         }
    1237     }
    1238 
     1251    }
    12391252}
    12401253
     
    12911304
    12921305#
     1306# Extra processing
     1307################################################################################
     1308
     1309sub do_extra_processing {
     1310    my $date = shift;
     1311    my $target = shift;
     1312    my $filter = shift;
     1313    my $pretend = shift;
     1314    my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target);
     1315
     1316    if ($target eq 'OSS') {
     1317        my $db = init_gpc_db();
     1318
     1319        my $obj_sth = "select DISTINCT rawExp.object from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) ";
     1320        $obj_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' ORDER BY rawExp.object";
     1321        print STDERR "$obj_sth\n";
     1322        my $object_ref = $db->selectall_arrayref( $obj_sth );
     1323
     1324        foreach my $object_row (@{ $object_ref }) {
     1325            my $this_object = shift @{ $object_row };
     1326            my $input_sth = "select exp_id,warp_id,dateobs from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) ";
     1327            $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";
     1328            $input_sth .= " ORDER BY dateobs ";
     1329
     1330            my $warps = $db->selectall_arrayref( $input_sth );
     1331           
     1332            if (($#{ $warps } + 1) % 2 != 0) {
     1333                print STDERR "Number of input warps to make OSS diffs is not even! $#{ $warps }\n";
     1334                die;
     1335            }
     1336           
     1337            while ($#{ $warps } > -1) {
     1338                my $input_warp = shift @{ $warps };
     1339                my $template_warp = shift @{ $warps };
     1340                my $input_exp_id = ${ $input_warp }[0];
     1341                my $template_exp_id = ${ $template_warp }[0];
     1342               
     1343                my $cmd = "$difftool -dbname $dbname  -definewarpwarp ";
     1344                $cmd .= "-input_label $label  -template_label $label ";
     1345                $cmd .= "-backwards "; # Needed because difftool assumes a different date sorting.
     1346                $cmd .= "-set_workdir $workdir  -set_dist_group $dist_group  -set_data_group $data_group ";
     1347                $cmd .= " -simple  -set_label $label -exp_id $input_exp_id -template_exp_id $template_exp_id ";
     1348#               $cmd .= " -pretend ";
     1349                if (defined($pretend)) {
     1350                    $cmd .= ' -pretend ';
     1351                }
     1352                if ($debug == 1) {
     1353                    $cmd .= ' -pretend ';
     1354                }
     1355                print STDERR "EXTRA_PROCESSING: $cmd\n";
     1356                if (($debug == 0)&&(!defined($pretend))) {
     1357                    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1358                        run ( command => $cmd, verbose => $verbose );
     1359                    unless ($success) {
     1360                        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     1361                        &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR);
     1362                    }
     1363                }
     1364            }
     1365        }
     1366    }
     1367}
     1368
     1369           
     1370
     1371
     1372#
    12931373# Auto-Clean
    12941374################################################################################
     
    13801460    my $object   = $object_list{$target};
    13811461    my $comment = $comment_list{$target};
    1382     my $dist_group = $target;
     1462    my $dist_group = $distribution_list{$target};
    13831463    my $data_group = "${target}.${trunc_date}";
    13841464    my $tess_id = $tessID_list{$target};
     
    14271507        my $N = $metadata_out{N_MACROS};
    14281508        $metadata_out{"ns${N}Macro"} = $macro_formats{$proc_mode};
    1429         print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n";
     1509#       print STDERR "WORKING ON A MACRO: ns${N}Macro $proc_mode $macro_formats{$proc_mode}\n";
    14301510        if (defined($date)&&(defined($target))) {
    14311511
Note: See TracChangeset for help on using the changeset viewer.