IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 20, 2011, 5:14:58 PM (15 years ago)
Author:
watersc1
Message:

Initial implementation of offnight differencing. If the flag is set in the configuration file, it attempts to find 3pi warps that have not been diffed that are from the current lunation and have a boresight separation less than 1.5 degrees.

File:
1 edited

Legend:

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

    r31421 r31649  
    6060    'test_mode'            => \$test_mode,
    6161    'force_stack_count'    => \$force_stack_count,
    62     'force_diff_count'    => \$force_diff_count,
     62    'force_diff_count'     => \$force_diff_count,
    6363    'this_target_only=s'   => \$this_target_only,
    6464    'this_filter_only=s'   => \$this_filter_only,
     
    865865# }
    866866
    867 # sub get_lunation_extent {
    868 #     my $date = shift;
    869 #     my ($year,$month,$day) = split /-/,$date;
    870 #     my $dateobs_begin;
    871 #     my $dateobs_end;
    872 
    873 #     my $dt = DateTime->new(year => $year, month => $month, day => $day,
    874 #                          hour => 0, minute => 0, second => 0, nanosecond => 0,
    875 #                          time_zone => 'Pacific/Honolulu');
    876 #     do {
    877 #       $dt->subtract(days => 1);
    878 #       my $ymd = $dt->ymd;
    879 #       my $md_cmd = "moondata $ymd 0 0";
    880 #       my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    881 #           run ( command => $md_cmd, verbose => $verbose);
    882 #       unless ($success) {
    883 #           $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    884 #           &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR);
    885 #       }
    886 #       my @result = split /\s+/,(join "\n", @$stdout_buf);
    887 #       if (abs($result[6]) <= 0.5) {
    888 #           $dateobs_end = $ymd;
    889 #       }
    890 #     } while (!defined($dateobs_end));
    891    
    892 #     do {
    893 #       $dt->subtract(days => 1);
    894 #       my $ymd = $dt->ymd;
    895 #       my $md_cmd = "moondata $ymd 0 0";
    896 #       my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    897 #           run ( command => $md_cmd, verbose => $verbose);
    898 #       unless ($success) {
    899 #           $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    900 #           &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR);
    901 #       }
    902 #       my @result = split /\s+/,(join "", @$stdout_buf);
    903 #       if (abs($result[6]) <= 0.5) {
    904 #           $dateobs_begin = $ymd;
    905 #       }
    906 #     } while (!defined($dateobs_begin));
     867sub get_lunation_extent {
     868    my $date = shift;
     869    my ($year,$month,$day) = split /-/,$date;
     870    my $dateobs_begin;
     871    my $dateobs_end;
     872
     873    my $dt = DateTime->new(year => $year, month => $month, day => $day,
     874                           hour => 0, minute => 0, second => 0, nanosecond => 0,
     875                           time_zone => 'Pacific/Honolulu');
     876    do {
     877        $dt->add(days => 1);
     878        my $ymd = $dt->ymd;
     879        my $md_cmd = "moondata $ymd 0 0";
     880        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     881            run ( command => $md_cmd, verbose => $verbose);
     882        unless ($success) {
     883            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     884            &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR);
     885        }
     886        my @result = split /\s+/,(join "\n", @$stdout_buf);
     887        if (abs($result[6]) <= 0.6) {
     888            $dateobs_end = $ymd;
     889        }
     890    } while (!defined($dateobs_end));
     891   
     892    do {
     893        $dt->subtract(days => 1);
     894        my $ymd = $dt->ymd;
     895        my $md_cmd = "moondata $ymd 0 0";
     896        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     897            run ( command => $md_cmd, verbose => $verbose);
     898        unless ($success) {
     899            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     900            &my_die("Unable to perform moondata: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR);
     901        }
     902        my @result = split /\s+/,(join "", @$stdout_buf);
     903        if (abs($result[6]) <= 0.6) {
     904            $dateobs_begin = $ymd;
     905        }
     906    } while (!defined($dateobs_begin));
    907907       
    908 #     return($dateobs_begin,$dateobs_end);
    909 # }
     908    return($dateobs_begin,$dateobs_end);
     909}
    910910
    911911# sub pre_sweetspot_queue {
     
    14051405                }
    14061406            }
    1407         }
    1408     }
     1407            if ((defined($science_config{$target}{OFFNIGHT_DIFFS})) && ($science_config{$target}{OFFNIGHT_DIFFS} == 1)) {
     1408                foreach my $filter (@filter_list) {
     1409                    offnight_diff_queue($date,$target,$filter,$pretend);
     1410                }
     1411            }
     1412        }
     1413    }
     1414
    14091415#     if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)) {
    14101416#       $metadata_out{nsDiffState} = 'FINISHED_DIFFS';
     
    16821688
    16831689}
     1690
     1691sub offnight_diff_queue {
     1692    my $date = shift;
     1693    my $target = shift;
     1694    my $filter = shift;
     1695    my $pretend = shift;
     1696    my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target);
     1697
     1698    my $db = init_gpc_db();
     1699
     1700#    my $Npotential = 0;
     1701#    my $Nqueued = 0;
     1702
     1703    my ($lunation_start,$lunation_end) = get_lunation_extent($date);
     1704   
     1705    my $new_data_group = "${data_group}.offnight";
     1706    my $new_dist_group = "${dist_group}.offnight";
     1707    my $cmd = "$difftool -dbname $dbname  -definewarpwarp ";
     1708    $cmd .= "-input_label $label  -template_label $label ";
     1709    $cmd .= "-set_workdir $workdir  -set_dist_group $new_dist_group  -set_data_group $new_data_group ";
     1710    $cmd .= " -simple  -set_label $label -filter $filter ";
     1711    $cmd .= " -dateobs_begin $lunation_start -dateobs_end $lunation_end -distance 1.5 ";
     1712
     1713    if (defined($pretend)) {
     1714        $cmd .= ' -pretend ';
     1715    }
     1716    if (defined($debug)) {
     1717        print STDERR "ON_diffs wants to run this command: $cmd\n";
     1718    }
     1719   
     1720    if (($debug == 0)&&(!defined($pretend))) {
     1721        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1722            run ( command => $cmd, verbose => $verbose );
     1723        unless ($success) {
     1724            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     1725            &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR);
     1726        }
     1727    }
     1728}
    16841729           
    16851730
Note: See TracChangeset for help on using the changeset viewer.