Skip to main content

Proud to be part of LJMU,
in partnership with the Dill Faulkes Educational Trust

 

Part of

 

Complete the form to report your results. You will need the following information:

  • The Group Code ID of your object.
  • The X and Y coordinates of your object in each image from the set of observations.
  • You can also use the form to share any comments you have about the object.

We'd like to be able to let you know if we find something interesting or unusual in the images. If you are happy for us to do so, please make sure to log into your account before you submit your results.

" // So, to see if it is valid, then remove the "neo-" to get the objectid and search through fitsfiles $objectid = preg_replace('/^neo-/', '', $neogroupid); // This is a globally useful query, so don't overwrite $query or $res! $query = "SELECT fitsfile,obsdate,UNIX_TIMESTAMP(obsdate) FROM fitsfiles WHERE objectid='".$objectid."' ORDER BY obsdate"; $res = mysqli_query($link, $query); $numfits = mysqli_num_rows($res); // No valid fits files, so tell the user and blank out // neogroupid as a flag to show that we need to produce the list // for the user to select from if($numfits == 0) { print "

There are no observations for the Group you have selected. Please try again

\n"; $neogroupid = ""; } } // -------------------------------------------------------------------- // If we get here with a blank "neogroupid", then produce the // Group selection form. if($neogroupid == "") { // Get a list of all the recently valid Group IDs // NB This will need to look for a bit longer than the 2 weeks // of downld.shtml, but not for ever... print "

Which \"Group\" do you have results for?


\n"; print "
\n"; // This is quite complicated, but needs to start from project_neo and then work towards fitsfiles // First get all the top 30 NEO object observation groups that have data (the download form limits to 25) $res1 = mysqli_query($link, 'SELECT DISTINCT groupid FROM project_neo ORDER BY -addeddate LIMIT 15;'); $numobsgrp = mysqli_num_rows($res1); if($numobsgrp == 0) { $res1 = mysqli_query($link, 'SELECT DISTINCT groupid FROM project_neo ORDER BY -addeddate LIMIT 1'); $numobsgrp = mysqli_num_rows($res1); } // Create a drop-down selection list of all the approriate "groupids" (defined as "neo-") print " Select the Group ID of your results from the list: "; print "\n"; print "
\n"; print "
\n"; // -------------------------------------------------------------------- // Otherwise, we have a valid groupID, so is the rest of the data here? } else { // -------------------------------------------------------------------- // Pull out all the data we need. If any fail, set // $validinput="n" and $errormessage is set to some suitble response. $validinput = "y"; $errormessage = ""; // Get the username, removing anything that names should not have... $username = ""; if(array_key_exists('username', $_REQUEST)) { $tmp_u = strip_tags($_REQUEST['username']); $username = preg_replace("/[^A-Za-z '-]/", "", $tmp_u); } if($username == "") { $validinput = "n"; $errormessage = "Please enter your name."; } // Get all the coordinates, leaving just [0-9.]* (-ive coordinates are not possible) $_w = array(""); $x = array_pad($_w, $numfits, ""); $y = array_pad($_w, $numfits, ""); // And for the "notes" $notes = array_pad($_w, $numfits, ""); $allblank = "y"; for($fitslp=1; $fitslp<=$numfits; $fitslp += 1) { $varnm = "x".$fitslp; if(array_key_exists($varnm, $_REQUEST)) { if(is_numeric($_REQUEST[$varnm])) { $x[$fitslp-1] = $_REQUEST[$varnm]; $allblank = "n"; } else { $x[$fitslp-1] = ""; $validinput = "n"; $errormessage = "Make sure that you fill in all the coordinates. If you could not find the NEO on one of the images put '-1' as the coordinate."; } } else { $x[$fitslp-1] = ""; $validinput = "n"; $errormessage = "Make sure that you fill in all the coordinates. If you could not find the NEO on one of the images put '-1' as the coordinate."; } $varnm = "y".$fitslp; if(array_key_exists($varnm, $_REQUEST)) { if(is_numeric($_REQUEST[$varnm])) { $y[$fitslp-1] = $_REQUEST[$varnm]; $allblank = "n"; } else { $y[$fitslp-1] = ""; $validinput = "n"; $errormessage = "Please fill in all the coordinates. If you could not find the NEO on one of the images put '-1' as the coordinate."; } } else { $y[$fitslp-1] = ""; $validinput = "n"; $errormessage = "Make sure that you fill in all the coordinates. If you could not find the NEO on one of the images put '-1' as the coordinate."; } // Get the notes, but these are allowed to be blank $varnm = "notes".$fitslp; if(array_key_exists($varnm, $_REQUEST)) { if(is_string($_REQUEST[$varnm])) { $notes[$fitslp-1] = strip_tags($_REQUEST[$varnm]); } else { $notes[$fitslp-1] = ""; } } else { $notes[$fitslp-1] = ""; } } if($allblank == "y") { $validinput = "n"; $errormessage = ""; } // -------------------------------------------------------------------- // We appear to have some valid data, but it might be sensible // to do some basic sanity checks before accepting it... if($validinput == "y") { // Sanity check 1: Are all the points on the image (since // this is all binned-IOO only at the moment, I will assume // a 2048x2048 image). // Also allow -1 as this is the "I cannot find it" flag for($lp=0; $lp<$numfits; $lp++) { if( ($x[$lp+0] < -1.1) || ($x[$lp+0] > 2048.0) || ($y[$lp+0] < -1.1) || ($y[$lp+0] > 2048.0)) { $validinput = "n"; $errormessage = "Your coordinates go off the image. Both X and Y values for all observations must be between 0 and 2048."; } } } // Sanity check 2: The first and last coordinates are not the same if($validinput == "y") { if(($x[0] == $x[$numfits-1]) && ($y[0] == $y[$numfits-1])) { $validinput = "n"; $errormessage = "Your object does not seem to have moved. It is probably not an asteroid."; } } // Sanity check 3: It goes at a (reasonably) constant velocity if($validinput == "y") { // This is slightly trickier as it needs me to get the dates // of the observations, but that is doable... // Repeat the basic query to get the FITS file data (especially UNIX_TIMESTAMP(obsdate)) $res = mysqli_query($link, $query); // Get an array of the timestamps $tstamp = array_pad($_w, $numfits, ""); $fitslp = 1; while($fld = mysqli_fetch_array($res)) { $tstamp[$fitslp-1] = $fld[2]; $fitslp = $fitslp + 1; } // Turn that into a X/Y velocity component for all pairs 0-1, 0-2, ... 0- $xvel = array_pad($_w, $numfits-1, ""); $yvel = array_pad($_w, $numfits-1, ""); $vel = array_pad($_w, $numfits-1, ""); for($lp=1; $lp<$numfits; $lp++) { $tdif = $tstamp[$lp] - $tstamp[0]; $xdif = $x[$lp] - $x[0]; $ydif = $y[$lp] - $y[0]; $xvel[$lp] = $xdif / $tdif; $yvel[$lp] = $ydif / $tdif; $vel[$lp] = sqrt(($xvel[$lp]*$xvel[$lp]) + ($yvel[$lp]*$yvel[$lp])); if($vel[$lp] == 0.0) { $validinput = "n"; $errormessage = "Your asteroid does not seem to move between at least two of the observations. Are you sure you have typed the numbers in correctly?"; } } } if($validinput == "y") { // Compare the velocities with the final one (ie probably the // most accurate one). Allow a factor of $errmargin - partly // to take positional uncertainties into account, but also to // deal with telescope drift between observations (I should // really be doing this with RA/Decs extracted from the WCS // but that can come later). $errmargin = 5.0; $errinv = 1.0 / $errmargin; for($lp=1; $lp<($numfits-1); $lp++) { $vchk = $vel[$lp] / $vel[$numfits-1]; if(($xvel[$lp] != 0.0) && ($xvel[$numfits-1] != 0.0)) { $xchk = $xvel[$lp] / $xvel[$numfits-1]; } else { $xchk = 1.0; // Cannot sensibly check if the velocity in this direction is exactly along an axis } if(($yvel[$lp] != 0.0) && ($yvel[$numfits-1] != 0.0)) { $ychk = $yvel[$lp] / $yvel[$numfits-1]; } else { $ychk = 1.0; // Cannot sensibly check if the velocity in this direction is exactly along an axis } // Speed check... if(($vchk > $errmargin) || ($vchk < $errinv)) { $validinput = "n"; $errormessage = "From your data, the asteroid appears to change speed quite a lot. Asteroids cannot do this, so you may have mistaken a cosmic ray for the asteroid, or you may have got the images in the wrong order."; // Direction check } else if( ($xchk > $errmargin) || ($xchk < $errinv) || ($ychk > $errmargin) || ($ychk < $errinv)) { $validinput = "n"; $errormessage = "From your data, the asteroid appears to change direction. Asteroids cannot do this, so you may have mistaken a cosmic ray for the asteroid, or you may have got the images in the wrong order."; } } } // -------------------------------------------------------------------- // We do not yet have all the data, so produce a form for it // (filling in anything where we *do* have the results). if($validinput == "n") { // Repeat the basic query to get the FITS file data $res = mysqli_query($link, $query); print "

Enter your results

\n"; print "

Please fill in all the boxes below.
"; print "If you could not find the asteroid on one of the images, put '-1' as the coordinate.

"; if($errormessage != "") { print "

" . $errormessage . "

\n"; } // Hidden tag for the grpid print "\n"; // Put all this into a table. print "
\n"; // First the generic stuff (i.e. the users name) print " \n"; // Then the X/Y coordinates measure for each observation $fitslp = 1; while($fld = mysqli_fetch_array($res)) { print " \n"; $obsdate = $fld['obsdate']; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; $fitslp = $fitslp + 1; } // Close the table with the "Submit Results" button print " \n"; print " \n"; print "
\n"; print " Your Name:\n"; print " \n"; print " \n"; print "
 
\n"; print " Observation ".$neogroupid."-obs".$fitslp.".fits (Observed at ".$obsdate.")\n"; print "
X Coordinate:Y Coordinate:
\n"; print " Any Comments:\n"; print " \n"; print " \n"; print "
 
\n"; print " \n"; print "
\n"; } else { // -------------------------------------------------------------------- // Hurrah! The form has been filled in successfully. I can now // put the data into the database. // Create a unique ID by creating a random number, putting the // current date/time onto one end and then checking it doesn't // already exist in the database... srand(); $id_r = rand(1000,9999); $id_d = date('ymdHis'); $idnum = $id_d . $id_r; // See if it exists in the database $numres1 = 1; while($numres1 != 0) { $id_r = rand(1000,9999); $idnum = $id_d . $id_r; $query1 = "SELECT idnum FROMM neo_results WHERE idnum='".$idnum."'"; $res1 = mysqli_query($link, $query1); if($res1) { $numres1 = mysqli_num_rows($res1); } else { $numres1 = 0; } } // Insert the gubbins into the database! (Remembering to fix // the username for any dodgy mysql hacks) // NB At the same time, create a message for emailing to David B. $dtnow = date('Y-m-d H:i:s'); $message = "ID: ".$idnum. "\r\n" . "Username: ".mysqli_real_escape_string($link, $username). "\r\n" . "NSO Username (ID number): ".$user->name. " (".$user->uid.")" . "\r\n"; "Observation Group: ".$neogroupid. "\r\n" . "Date/time submitted: ".$dtnow. "\r\n"; // Repeat the basic query to get the FITS file data $res = mysqli_query($link, $query); $fitslp = 1; while($fld = mysqli_fetch_array($res)) { $resquery = "INSERT INTO neo_results VALUES("; $resquery = $resquery . "'".$idnum."',"; $resquery = $resquery . "'".$fitslp."',"; $resquery = $resquery . "'".mysqli_real_escape_string($link, $username)."',"; $resquery = $resquery . "'".$neogroupid."',"; $resquery = $resquery . "'".$fld['fitsfile']."',"; $resquery = $resquery . "'".$x[$fitslp-1]."',"; $resquery = $resquery . "'".$y[$fitslp-1]."',"; $resquery = $resquery . "'".$dtnow."',"; $resquery = $resquery . "'".$dtnow."',"; $resquery = $resquery . "'".mysqli_real_escape_string($link, $notes[$fitslp-1])."')"; mysqli_query($link, $resquery); $message = $message . " ObsNum: ".$fitslp. "\r\n" . " Fitsfile: ".$fld['fitsfile']. "\r\n" . " X: ".$x[$fitslp-1]. "\r\n" . " Y: ".$y[$fitslp-1]. "\r\n" . " Notes: ".$notes[$fitslp-1]. "\r\n"; $fitslp = $fitslp + 1; } // Send the email to David B $to="andy@schoolsobservatory.org.uk"; $subject="AsteroidResult: ".$neogroupid; $headers='From: asteroidauto@schoolsobservatory.org.uk' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); // Write a summary of the data so that the use knows what has happened! print "

Thank you ". $username . "!

\n"; print "

We have got the data you entered and this will be used to improve our knowledge of the orbit of the NEO.

\n"; print "

Don't forget that we will be collecting observations of NEOs for you to work on, "; print "so keep checking the Download page.

\n"; // ++TODO++ Produce some funky stuff for the user to see what // their results actually mean (eg compare them to the predicted // ones, show refined orbits etc etc...) } } ?>