<h2>MOPS Solar System Simulation</h2>
<h2>MJD <% "$mjd ($date)" %> </h2>
<table border=1 cellspacing=0>
<tr>
<th> Field ID </td>
<th> Num Detections </td>
<th> RA (deg) </td>
<th> DEC (deg) </td>
<th> Time (MJD) </td>
<th> Detections </td>
<th> Motion </td>
</tr>
% foreach my $item (@goo) {
<tr>
<td> <% $item->{field_id} %> </td>
<td> <% $item->{num_dets} %> </td>
<td> <% $item->{ra} %> </td>
<td> <% $item->{dec} %> </td>
<td> <% $item->{time} %> </td>

<td> <a href="detections.obs?field_id=<% $item->{field_id} %>"> MPC </a> |
<a href="detections.obs?fmt=miti&field_id=<% $item->{field_id} %>"> MITI </a> </td>

<td> <a href="motion?imgtype=png&field_id=<% $item->{field_id} %>"> PNG </a> |
<a href="motion?imgtype=epsc&field_id=<% $item->{field_id} %>"> EPS </a> </td>

</tr>
% }
</table>

<%args>
$mjd
</%args>

<%init>
use Astro::Time;
# Get basic obsTool summary output.
$m->comp('/mops_env');

my @stuff = `obsTool --mjd $mjd`;
my @cal = mjd2cal($mjd);
my $date = sprintf "%4d-%02d-%02d", @cal[2, 1, 0];
my @things;
my @goo;

@stuff = grep !/^#/, @stuff;
foreach (@stuff) {
    @things = split /\s+/, $_;
    push @goo, {
        field_id => $things[0],
        num_dets => $things[1],
        time => $things[2],
        ra => $things[3],
        dec => $things[4],
    };
}
</%init>
