The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Astro::SIMBAD::Query - Object definining an prospective SIMBAD query.

SYNOPSIS

  $query = new Astro::SIMBAD::Query( Target  => $object,
                                     RA      => $ra,
                                     Dec     => $dec,
                                     Error   => $radius,
                                     Units   => $radius_units,
                                     Frame   => $coord_frame,
                                     Epoch   => $coord_epoch,
                                     Equinox => $coord_equinox,
                                     Proxy   => $proxy,
                                     Timeout => $timeout,
                                     URL     => $alternative_url );

  my $results = $query->querydb();

  $other = new Astro::SIMBAD::Query( Target  => $object );

DESCRIPTION

Stores information about an prospective SIMBAD query and allows the query to be made, returning an Astro::SIMBAD::Result object. Minimum information needed for a sucessful query is an R.A. and Dec. or an object Target speccification, other variables will be defaulted.

The Query object supports two types of queries: "list" (summary) and "object" (detailed). The list query usually returns multiple results; the object query is expected to obtain only one result, but returns extra data about that target. An object query is performed if the target name is specified and the Error radius is 0; otherwise, a list query is done.

The object will by default pick up the proxy information from the HTTP_PROXY and NO_PROXY environment variables, see the LWP::UserAgent documentation for details.

REVISION

$Id: Query.pm,v 1.14 2005/06/08 01:38:17 aa Exp $

METHODS

Constructor

new

Create a new instance from a hash of options

  $query = new Astro::SIMBAD::Query( Target  => $object,
                                     RA      => $ra,
                                     Dec     => $dec,
                                     Error   => $radius,
                                     Units   => $radius_units,
                                     Frame   => $coord_frame,
                                     Epoch   => $coord_epoch,
                                     Equinox => $coord_equinox,
                                     Proxy   => $proxy,
                                     Timeout => $timeout,
                                     URL     => $alternative_url );

returns a reference to an SIMBAD query object.

Accessor Methods

querydb

Returns an Astro::SIMBAD::Result object for an inital SIMBAD query

   $results = $query->querydb();
proxy

Return (or set) the current proxy for the SIMBAD request.

   $query->proxy( 'http://wwwcache.ex.ac.uk:8080/' );
   $proxy_url = $query->proxy();
timeout

Return (or set) the current timeout in seconds for the SIMBAD request.

   $query->timeout( 30 );
   $proxy_timeout = $query->timeout();
url

Return (or set) the current base URL for the ADS query.

   $url = $query->url();
   $query->url( "simbad.u-strasbg.fr" );

if not defined the default URL is simbad.u-strasbg.fr

agent

Returns the user agent tag sent by the module to the ADS server.

   $agent_tag = $query->agent();
RA

Return (or set) the current target R.A. defined for the SIMBAD query

   $ra = $query->ra();
   $query->ra( $ra );

where $ra should be a string of the form "HH MM SS.SS", e.g. 21 42 42.66

Dec

Return (or set) the current target Declination defined for the SIMBAD query

   $dec = $query->dec();
   $query->dec( $dec );

where $dec should be a string of the form "+-HH MM SS.SS", e.g. +43 35 09.5 or -40 25 67.89

Target

Instead of querying SIMBAD by R.A. and Dec., you may also query it by object name. Return (or set) the current target object defined for the SIMBAD query

   $ident = $query->target();
   $query->target( "HT Cas" );

using an object name will override the current R.A. and Dec settings for the Query object (if currently set) and the next querydb() method call will query SIMBAD using this identifier rather than any currently set co-ordinates.

Error

The error radius to be searched for SIMBAD objects around the target R.A. and Dec, the radius defaults to 10 arc seconds, with the radius unit being set using the units() method.

   $error = $query->error();
   $query->error( 20 );
Units

The unit for the error radius to be searched for SIMBAD objects around the target R.A. and Dec, the radius defaults to 10 arc seconds, with the radius itself being set using the error() method

   $error = $query->units();
   $query->units( "arcmin" );

valid unit types are "arcsec", "arcmin" and "deg".

use_list_query

When searching by coordinates, or if the radius is nonzero, we perform a "list query" that is expected to return multiple results. However, if searching for a target by name, and the error radius is zero, it is pretty clear that we want a specific target. In that case, we use a more detailed "object query."

This method returns true if the criteria are such that we will use a list query and false if it is an object query.

Frame

The frame in which the R.A. and Dec co-ordinates are given

   $frame = $query->frame();
   $query->frames( "FK5" );

valid frames are "FK5" and "FK4", if not specified it will default to FK5.

Epoch

The epoch for the R.A. and Dec co-ordinates

   $epoch = $query->epoch();
   $query->epoch( "1950" );

defaults to 2000

Equinox

The equinox for the R.A. and Dec co-ordinates

   $equinox = $query->equinox();
   $query->equinox( "2000" );

defaults to 2000

Queryurl

Returns the URL used to query the Simbad database

General Methods

configure

Configures the object, takes an options hash as an argument

  $query->configure( %options );

Does nothing if the array is not supplied.

COPYRIGHT

Copyright (C) 2001 University of Exeter. All Rights Reserved.

This program was written as part of the eSTAR project and is free software; you can redistribute it and/or modify it under the terms of the GNU Public License.

AUTHORS

Alasdair Allan <aa@astro.ex.ac.uk>,