<& /htmlheader &>
<& modelheader &>
Exposure Name:
<% $field_info %>

Histograms

mag s2n ra_sigma_deg dec_sigma_deg psf_chi2 psf_dof cr_sig ext_sig psf_major psf_minor psf_theta psf_quality psf_pix moments_xx moments_xy moments_yy n_pos f_pos ratio_bad ratio_mask ratio_all psf_inst_flux psf_inst_flux_sig ap_mag ap_mag_raw ap_mag_radius ap_flux ap_flux_sig peak_flux_as_mag cal_psf_mag cal_psf_mag_sig sky sky_sigma psf_qf_perfect moments_r1 moments_rh kron_flux kron_flux_err kron_flux_inner kron_flux_outer diff_r_p diff_sn_p diff_r_m diff_sn_m pseudo1 pseudo2 pseudo3

Conditions (for WHERE clause):
SELECT AS pseudo1, AS pseudo2, AS pseudo3,
FROM detections d JOIN det_rawattr_v2 dr USING(det_id) WHERE
<% $where %>

Limit:

% if ($all_aref) {

Selected | Histograms | The Rest
--- | --- | ---
<& stamp_decider, dets => \@sel_dets &> |  | <& stamp_decider, dets => \@unsel_dets &>

% } <& /htmlfooter &> <%args> $fpa_id => undef $where => '' $limit => 500 $pseudo1 => '' $pseudo2 => '' $pseudo3 => '' <%init> use URI::Escape; use Astro::Time; use PS::MOPS::Lib qw(:all); use PS::MOPS::Constants qw(:all); use PS::MOPS::DC::Field; use PS::MOPS::DC::Detection; my $SQL_STUB = <<"SQL"; SELECT d.det_id det_id FROM fields f JOIN detections d USING(field_id) JOIN det_rawattr_v2 dr USING(det_id) SQL my %cols = ( ); my @extcolnames = qw( det_id psf_chi2 psf_dof cr_sig ext_sig psf_major psf_minor psf_theta psf_quality psf_npix moments_xx moments_xy moments_yy n_pos f_pos ratio_bad ratio_mask ratio_all flags ipp_idet psf_inst_flux psf_inst_flux_sig ap_mag ap_mag_raw ap_mag_radius ap_flux ap_flux_sig peak_flux_as_mag cal_psf_mag cal_psf_mag_sig sky sky_sigma psf_qf_perfect moments_r1 moments_rh kron_flux kron_flux_err kron_flux_inner kron_flux_outer diff_r_p diff_sn_p diff_r_m diff_sn_m flags2 n_frames ); my %extcols = ( psf_chi2 => 'float', psf_dof => 'int', cr_sig => 'float', ext_sig => 'float', psf_major => 'float', psf_minor => 'float', psf_theta => 'float', psf_quality => 'float', psf_npix => 'int', moments_xx => 'float', moments_xy => 'float', moments_yy => 'float', n_pos => 'int', f_pos => 'float', ratio_bad => 'float', ratio_mask => 'float', ratio_all => 'float', flags => 'int', ipp_idet => 'int', psf_inst_flux => 'float', psf_inst_flux_sig => 'float', ap_mag => 'float', ap_mag_raw => 'float', ap_mag_radius => 'float', ap_flux => 'float', ap_flux_sig => 'float', peak_flux_as_mag => 'float', cal_psf_mag => 'float', cal_psf_mag_sig => 'float', sky => 'float', sky_sigma => 'float', psf_qf_perfect => 'float', moments_r1 => 'float', moments_rh => 'float', kron_flux => 'float', kron_flux_err => 'float', kron_flux_inner => 'float', kron_flux_outer => 'float', diff_r_p => 'float', diff_sn_p => 'float', diff_r_m => 'float', diff_sn_m => 'float', flags2 => 'int', n_frames => 'int', ); my $inst = $m->notes('INST'); my $dbname = $inst->dbname; my $model = $m->notes('MODEL'); my $dbh = $inst->dbh(); my $sth; my $field; my $field_info = ''; my $all_href; my $all_aref; my $sel_aref; my %sel_tbl; my $det_id; my $limit_str = $limit ? " limit $limit" : ''; if ($fpa_id) { $field = modcf_retrieve($inst, fpaId => $fpa_id); $field_info = '' . join("
\n", $field->fpaId, sprintf("%.6f", $field->epoch), mopslib_mjd2utctimestr($field->epoch), $field->surveyMode) . "\n"; } # We will do two queries: one to get all detections from the field, and another # specified by the user to discriminate. We will display two columns of stamps, # one selected for, and all others. if ($field) { $sth = $dbh->prepare("select d.det_id det_id, dr.* from fields f join detections d using(field_id) join det_rawattr_v2 dr using(det_id) where f.fpa_id=? $limit_str") or die $dbh->errstr; $sth->execute($fpa_id) or die $sth->errstr; while (my $href = $sth->fetchrow_hashref) { $all_href->{$href->{det_id}} = $href; # save entire row push @{$all_aref}, $href->{det_id}; } $sth->finish; } # This is very dangerous! We are passing a query directly from a form field. my $sql = ''; if ($all_aref && $where) { $sql = "$SQL_STUB WHERE fpa_id='$fpa_id' and ($where) $limit_str"; $sel_aref = $dbh->selectcol_arrayref($sql); foreach my $sel_id (@{$sel_aref}) { $sel_tbl{$sel_id} = 1; # mark as in selected column } } # Now create Detection lists. my @sel_dets = map { modcd_retrieve($inst, detId => $_) } @{$sel_aref}; my @unsel_dets = map { modcd_retrieve($inst, detId => $_) } grep { !$sel_tbl{$_} } @{$all_aref};