% if ($report) { % } else { <& /htmlheader, title => $htmltitle &> % }

<% $title %>

% if (!$all) { TJD <% $tjd %> (MOPS Night Number <% $tjd + 50000 - 1 %>)
<% $utdate_str %>

% } % unless ($report) {

Find submitted designation (e.g. "P100105"): | Search using MPC observation records

% } # unless ($report)
Disclaimer: this report is a summary of data submitted by PS1 to the Minor Planet Center (MPC). It is not an official record of PS1 NEO candidates as determined by the MPC. Digest values may differ between PS1 and MPC, and not all submitted objects by PS1 are guaranteed to be deemed NEO candidates.

% unless ($tjd) { # don't show totals table if single-night % if ($discsum) { % foreach my $row (@discoveries) { % } # for
Discoveries by Type Count
<% $dispmap{$row->{disposition}} %> <% $row->{ct} %>
Total % unless ($report) { List All % } <% $discsum %>

% } # discsum % if ($discsum_A) { % foreach my $row (@disc_A) { % } # for
PHAs by Survey Count
<% $row->{sm} %> <% $row->{ct} %>
Total % unless ($report) { List All % } <% $discsum_A %>

% } # discsum_A % if ($discsum_C) { % foreach my $row (@disc_C) { % } # for
NEOs by Survey Count
<% $row->{sm} %> <% $row->{ct} %>
Total % unless ($report) { List All % } <% $discsum_C %>
Note: tracklets spanning two survey modes will be counted twice

% } # discsum_C % if (@incidental) { % foreach my $row (grep { $_->{disposition} ne 'S' } @incidental) { % } # for
Other Submissions Count (Tracklets)
<% $dispmap{$row->{disposition}} %> <% $row->{ct} %>
% } # incidental

% } # if ($tjd) % unless ($report) { <& /lib/pager, rooturi => "?disp_sel=$disp_sel", limit => $limit, offset => $offset, found => $found &> % } % foreach $href (@rows) { % my $trk_dbname = $href->{dbname}; % my $trkId = $href->{tracklet_id}; % my $bgstyle; % if ($href->{disposition} eq 'C') { $bgstyle = 'style="background-color: #9ACD32"' } % elsif ($href->{disposition} eq 'R') { $bgstyle = 'style="background-color: #B0C4DE"' } % elsif ($href->{disposition} eq 'A') { $bgstyle = 'style="background-color: #FF4500"' } % elsif ($href->{disposition} eq 'M') { $bgstyle = 'style="background-color: #CDC9C9"' }; % if ($report) { % } # if report % } # foreach
Internal
Designation
Database/Tracklet ID Observation
Date
Source Chunk Digest2 Disposition MPC
Designation
% if ($report) { <% $href->{desig} %> % } else { <% $href->{desig} %> % } % unless ($report) { % if ($href->{dbname} and $href->{tracklet_id}) { <% "$href->{dbname}/T$href->{tracklet_id}" %> % } else { NA % } % } else { <% "$href->{dbname}/T$href->{tracklet_id}" %> % } <% mopslib_mjd2utctimestr($href->{epoch_mjd}, ' ') %> <% $href->{survey_mode} %> <% defined($href->{digest}) ? sprintf("%.1f", $href->{digest}) : 'NA' %> align="center"> <% $dispmap{$href->{disposition}} || 'NA' %> <& /mpc_link, desig => $href->{mpc_desig}, neocp_desig => $href->{desig} &>
% my $dets = $dbh->selectall_arrayref($det_sql, { Slice => {} }, $href->{desig});
% foreach my $h (@$dets) {
<% PS::MOPS::MPC::det2mpc($h, $href->{desig}) %>
% } # foreach
% unless ($report) { <& /lib/pager, rooturi => "?disp_sel=$disp_sel", limit => $limit, offset => $offset, found => $found &>

% if (!$all) { All NEO submissions to date % } % } % if ($report) { Report generated <% scalar gmtime %> UT.

% } else { <& /htmlfooter &> % } <%args> $tjd => undef $limit => 100 $offset => 0 $found => undef $report => undef $disp_all => undef $disp_sel => '' $summary => 1 <%init> use Astro::Time; use PS::MOPS::MPC; use PS::MOPS::Lib qw(:all); use PS::MOPS::Constants qw(:all); use PS::MOPS::DC::Instance; my %dispmap = ( C => 'DISCOVERY, NEO (non-PHA)', A => 'DISCOVERY, PHA', M => 'DISCOVERY, COMET', R => 'RECOVERY, NEO', N => 'DISCOVERY, NON-NEO', '1' => 'NEOCP (1-NIGHTER)', '2' => 'NEOCP (FOLLOWED UP)', S => 'SUBMITTED', T => 'SUBMITTED (INCIDENTAL)', K => 'KNOWN', D => 'DOWNGRADED', O => 'OUTREACH', J => 'REJECTED', ); my $inst = PS::MOPS::DC::Instance->new(DBNAME => 'psmops_export'); my $dbh = $inst->dbh(); # Get a tally of totals so far. my @discoveries; my @disc_A; my @disc_C; my @incidental; my $tots; my $tots_A; my $tots_C; if ($summary and !$tjd and $offset == 0) { $tots = $dbh->selectall_arrayref(<<"SQL", { Slice => {} }); select disposition, count(distinct desig) ct from export.mpc_sub group by disposition order by ct desc SQL $tots_A = $dbh->selectall_arrayref(<<"SQL", { Slice => {} }); select if(survey_mode regexp 'SS|3PI',substring_index(substring_index(survey_mode, '.', 2), '.', -1),'Other') sm, count(distinct desig) ct from export.mpc_sub where disposition='A' group by if(survey_mode regexp 'SS|3PI',substring_index(substring_index(survey_mode, '.', 2), '.', -1),'Other') order by ct desc SQL $tots_C = $dbh->selectall_arrayref(<<"SQL", { Slice => {} }); select if(survey_mode regexp 'SS|3PI',substring_index(substring_index(survey_mode, '.', 2), '.', -1),'Other') sm, count(distinct desig) ct from export.mpc_sub where disposition='C' group by if(survey_mode regexp 'SS|3PI',substring_index(substring_index(survey_mode, '.', 2), '.', -1),'Other') order by ct desc SQL } my $discsum = 0; foreach my $row (@$tots) { if ($row->{disposition} =~ /^(C|A|R)$/) { push @discoveries, $row; $discsum += $row->{ct}; } else { push @incidental, $row; } } my $discsum_A = 0; foreach my $row (@$tots_A) { push @disc_A, $row; $discsum_A += $row->{ct}; } my $discsum_C = 0; foreach my $row (@$tots_C) { push @disc_C, $row; $discsum_C += $row->{ct}; } my $limit_str; if ($report) { $limit = 250; $offset = 0; } if (defined($offset)) { $limit = 100 unless $limit; $limit_str = sprintf 'limit %d,%d', $offset, $limit; } else { $limit_str = $limit ? "limit $limit" : ''; } my $found_str = !defined($found) ? 'SQL_CALC_FOUND_ROWS' : ''; my $where = ''; my $utdate_str; my $title; my $htmltitle = 'Submitted NEOs'; my $all; if (!defined($tjd)) { $utdate_str = 'To date'; if ($disp_sel =~ /^CAR/) { $title = 'PS1 Discoveries'; $htmltitle = $title; } else { $title = $report ? "$limit most recent PS1 NEO submissions" : 'PS1 Submitted NEOs to Date'; } $all = 1; } else { $utdate_str = mopslib_mjd2utctimestr($tjd + 50000); $utdate_str =~ s/T.*//; # trim everything after date $utdate_str .= 'UT'; my $epoch1 = $tjd + 50000; my $epoch2 = $epoch1 + 1; $where = "epoch_mjd between $epoch1 and $epoch2 and "; $title = 'PS1 Submitted NEOs'; } my $disp_str; if ($disp_sel) { # convert ABC to 'A', 'B', 'C' $disp_str = sprintf "disposition in (%s)", join ',', map { qq{'$_'} } split //, $disp_sel; } else { $disp_str = $disp_all ? "disposition <> 'J'" : "disposition not in ('T', 'J', 'O', 'D')"; } # SQL to get dets only. my $det_sql = <<"SQL"; select epoch_mjd as epoch, ra_deg as ra, dec_deg as `dec`, filter_id as filter, mag as mag, obscode as obscode from export.mpc_sub where desig=? order by epoch_mjd SQL my $sql = <<"SQL"; select $found_str epoch_mjd, survey_mode, ra_deg, dec_deg, filter_id, mag, obscode, desig, mpc_desig, digest, dbname, tracklet_id, disposition from export.mpc_sub where $where $disp_str group by desig order by epoch_mjd desc $limit_str SQL my $sth = $dbh->prepare($sql) or die $dbh->errstr; $sth->execute() or die $sth->errstr; my @rows; my $href; while ($href = $sth->fetchrow_hashref()) { push @rows, $href; } $sth->finish(); if ($found_str) { ($found) = $dbh->selectrow_array("select FOUND_ROWS()"); }