The ATNF Pulsar Data Archive provides access to pulsar observations';
echo 'made with the Parkes radio Telescope. Data older than ';
echo ' months is';
echo 'publicly available, and can be accessed by simply providing your email';
echo 'address. More recent data is proprietry, and can only be accessed by';
echo 'those who were involved in the proposal. We plan to do this via the';
echo 'OPAL system, but this is';
echo 'currently not enabled. In the interim, those who have previously';
echo 'obtained a login for the Data Archive can use that option below';
echo '(making sure to check the "Data Archive login" button!).
';
}
function OutputQueryFormHeader( $min_date_text, $max_date_text )
{
global $PHP_SELF;
echo '';
echo '
';
echo '
ATNF Pulsar Data Archive
';
echo '
This archive provides access to pulsar observations taken at the Parkes radio telescope between the dates of ';
echo '' . $min_date_text . ' and ' . $max_date_text . '.
';
echo '
See the Users Guide link for more details.
';
echo '
';
echo '';
echo '';
echo '';
echo '';
echo ' | ';
echo '';
echo 'Instructions';
echo ' | ';
echo '';
echo ' ';
echo ' | ';
echo '';
echo 'Users Guide';
echo ' | ';
echo '
';
echo '
';
echo '
';
echo '
';
echo 'Instructions
';
echo 'To hide, click "Instructions" again. ';
echo '- Display Parameters
';
echo '- Check the fields you want shown in the results table. Suggested columns are checked by default
';
echo '- The results can be ordered by one of the parameters in the "Order By" drop-down list
';
echo '- Coordinates
';
echo '- The sky position can be specified by a Pulsar name or a RA/Dec position. ';
echo 'The pulsar name takes precedence. The search radius must be given.
';
echo '- Filter Options
';
echo '- Results can be limited to observations just from a particular project - use the Project ID box
';
echo '- The date range can be specified - the defaults are the range of dates in the archive.
';
echo '- Either timing data (particular pulsar) or survey data can be specified. Or both!
';
echo '- The type of instrument can be specified. Default is any type.
';
echo '- More than one frequency band can be specified.';
echo '
- Display Other
';
echo '- Calibraton observations taken within a given time period of the queried observations can also be shown and downloaded. Check the box to do so, and specify the time interval.
';
echo '
';
echo '
';
}
OutputHeader();
// The fields to display in the results
if( isset( $_SESSION['fields'] ) )
$selected_fields = $_SESSION['fields'];
else
$selected_fields = Array( "filename", "src_name", "project_id", "raj", "decj",
"data_type", "obsfreq", "bw", "scanlen", "date", "ut", "nsub", "nchan" );
// set some form defaults
isset($_SESSION['pulsar_name']) ? $pulsar_name = $_SESSION['pulsar_name'] : $pulsar_name = '';
isset($_SESSION['project_id']) ? $project_id = $_SESSION['project_id'] : $project_id = '';
isset($_SESSION['obs_mode']) ? $obs_mode = $_SESSION['obs_mode'] : $obs_mode = '';
isset($_SESSION['data_type']) ? $data_type = $_SESSION['data_type'] : $data_type = '';
isset($_SESSION['orderBy']) ? $orderBy = $_SESSION['orderBy'] : $orderBy = '';
isset($_SESSION['orderDir']) ?$orderDir = $_SESSION['orderDir'] : $orderDir = 'asc';
isset($_SESSION['survey']) ? $survey = $_SESSION['survey'] : $survey = '';
isset($_SESSION['rahour']) ? $rahour = $_SESSION['rahour'] : $rahour = '';
isset($_SESSION['ramin']) ? $ramin = $_SESSION['ramin'] : $ramin = '';
isset($_SESSION['rasec']) ? $rasec = $_SESSION['rasec'] : $rasec = '';
isset($_SESSION['decdeg']) ? $decdeg = $_SESSION['decdeg'] : $decdeg = '';
isset($_SESSION['decmin']) ? $decmin = $_SESSION['decmin'] : $decmin = '';
isset($_SESSION['decsec']) ? $decsec = $_SESSION['decsec'] : $decsec = '';
isset($_SESSION['radius']) ? $radius = $_SESSION['radius'] : $radius = 60;
isset($_SESSION['bandname']) ? $bandname = $_SESSION['bandname'] : $bandname = Array();
isset($_SESSION['from_day']) ? $from_day = $_SESSION['from_day'] : $from_day = '';
isset($_SESSION['from_month']) ?$from_month = $_SESSION['from_month'] : $from_month = '';
isset($_SESSION['from_year']) ? $from_year = $_SESSION['from_year'] : $from_year = '';
isset($_SESSION['to_day']) ? $to_day = $_SESSION['to_day'] : $to_day = '';
isset($_SESSION['to_month']) ? $to_month = $_SESSION['to_month'] : $to_month = '';
isset($_SESSION['to_year']) ? $to_year = $_SESSION['to_year'] : $to_year = '';
isset($_SESSION['cals_within_mins']) ? $cals_within_mins = $_SESSION['cals_within_mins'] : $cals_within_mins = 30;
isset($_SESSION['cals']) ? $cals = $_SESSION['cals'] : $cals = 'cals';
try {
$now_day = date("j");
$now_month = date("n");
$now_year = date("Y");
$all_params_id = "all_params";
$all_others_id = "all_others";
//$link = db_connect();
$db = new PulsarArchiveDB();
$db->connect( DB_SERVER . ':' . DB_PORT, DB_USERNAME, DB_PASS, DB_NAME );
//$link = db_connect_admin();
//loadNewTables();
//////////////////////////////
// Initialise error messages
//
$date_error = "";
///////////////////////////////////
// Find out the first and last dates
//$query = "select min(mjd), max(mjd) from ".OBSERVATIONS_TABLE;
$min_mjd = '';
$max_mjd = '';
$db->GetMinMaxMJD( $min_mjd, $max_mjd );
// Convert from MJD to JD
$min_jd = $min_mjd + 2400000.5;
$max_jd = $max_mjd + 2400000.5;
// convert the mjd to a date
$min_jd = floor($min_jd);
$max_jd = ceil($max_jd);
$min_unix = jdtounix($min_jd);
$max_unix = jdtounix($max_jd);
$min_date_text = date("j F Y", $min_unix);
$max_date_text = date("j F Y", $max_unix);
$minDay = date("j",$min_unix);
$minMonth = date("n",$min_unix);
$minYear = date("Y",$min_unix);
$maxDay = date("j",$max_unix);
$maxMonth = date("n",$max_unix);
$maxYear = date("Y",$max_unix);
// proprietry date limit
$today_mjd = cal_to_jd ( CAL_GREGORIAN, date("n"), date("j"), date("Y") ) - 2400000.5;
$prop_mjd = $today_mjd - PROPRIETRY_PERIOD_DAY;
$prop_unix = jdtounix($prop_mjd+2400000.5);
$prop_date_text = date("j F Y", $prop_unix);
// Clear any old form inputs in session cache
init();
//////////////////////////////////////////////
// Get the field names to fill form checkboxes
$fields = $db->GetObservationFields();
$field_names = Array("filename" => "Filename",
"src_name" => "Source Name",
"project_id" => "Project ID",
"raj" => "RA (J2000, hh:mm:ss)",
"decj" => "Dec (J2000, dd:mm:ss)",
"data_type" => "Data Type",
"obsfreq" => "Frequency",
"bw" => "Bandwidth",
"scanlen" => "Scan Length",
"date" => "UT Date",
"ut" => "UT Time",
"MJD" => "MJD",
"rajd" => "RA (J2000, degs)",
"decjd" => "Dec (J2000, degs)",
"gl" => "Gal. Long. (degs)",
"gb" => "Gal. Lat. (degs)",
"BMAJ" => "Beamsize: BMAJ",
"BMIN" => "Beamsize: BMIN",
"BPA" => "Beam: BPA",
"dm" => "D.M.",
"period" => "Period",
"nchan" => "# channels",
"npol" => "# polarisations",
"nbin" => "# bins",
"nsub" => "# subintegrations",
"tsamp" => "Sample time",
"nbits" => "# bits per sample",
"nbeam" => "# beams",
"cnfg" => "Configuration",
"inst" => "Instrument",
"rcvr" => "Receiver",
"hdrver" => "PSRFITS version",
"survey" => "Survey name",
"telescope" => "Telescope",
"site" => "Site ID",
"obsrvr" => "Observer ID" );
/////////////////////////////////////////////////
// Load search form parameters if they have been stored.
//
///////////////////////////////////////////////
// Get the data types available in the database
//
$data_types = $db->GetDataTypes();
///////////////////////////////////////////////
// If the user clicked on the logout button
if (isset($HTTP_GET_VARS['command'])) {
$command = $HTTP_GET_VARS['command'];
if ($command == 'logout') {
//unset($_SESSION['auth_code']);
//unset($_SESSION['username']);
$_SESSION = array();
}
if ($command == 'Login') {
echo 'we are logging in';
exit;
}
}
// if we have already authenticated
// use our stored authentication details
// otherwise
// if we have received a login attempt
// process it
$auth_code = false;
if( isset( $_SESSION['auth_code'] ) && $_SESSION['auth_code'] == OK )
{
$auth_code = $_SESSION['auth_code'];
$username = $_SESSION['username'];
}
else
{
if( isset( $HTTP_POST_VARS['action'] ) && $HTTP_POST_VARS['action'] == 'Login' )
{
$username = $HTTP_POST_VARS["opalEmail"];
$password = $HTTP_POST_VARS["opalPassword"];
$type = $HTTP_POST_VARS['authenticateType'];
if($type == "anon"){
$username = $HTTP_POST_VARS["email"];
$auth_code = OK;
logger_login( $username, 'Anonymous', 'success' );
}
else
{
$auth_code = authenticate($username, $password);
if( $auth_code == OK )
logger_login( $username, 'Opal', 'success' );
else
logger_login( $username, 'Opal', 'failure' );
//$auth_code = newAuthenticate();
}
}
}
// Initial state where no username or password supplied OR bad login state
if ($auth_code != OK) {
OutputLoginForm();
} else {
$_SESSION['username'] = $username;
$_SESSION['auth_code'] = $auth_code;
$_SESSION['logintype'] = $HTTP_POST_VARS['authenticateType'];
isset( $HTTP_GET_VARS['actions'] ) ? $actions = $HTTP_GET_VARS['actions'] : $actions = Array();
if ($actions == "new_query") {
init();
}
else if ($actions == "error") {
// $date_error = "You are only authorised to access data > 18 months old";
}
OutputQueryFormHeader( $min_date_text, $max_date_text );
?>
getCode(), $e->getMessage(), '' );
echo '
' .
'
' .
'A database error was encountered
' .
'the details of the error have been logged, please contact the system administrator for futher assistance
' .
'' .
'';
}
?>