NAME
Astro::Catalog::Query::SkyCat - Generate SkyCat catalog query clients
SYNOPSIS
DESCRIPTION
On load, automatically parse the SkyCat server specification file from ~/.skycat/skycat.cfg
, if available, and dynamically generate query classes that can send queries to each catalog server and parse the results.
METHODS
Constructor
- new
-
Simple constructor. Forces read of config file if one can be found and the config has not been read previously. If no config file can be located the query object can not be instantiated since it will not know the location of any servers.
$q = new Astro::Catalog::Query::SkyCat(catalog => 'gsc', %options); $q = new Astro::Catalog::Query::SkyCat(catalog => 'gsc@eso', %options);
The
catalog
field must be present, otherwise the new object will not know which remote server to use and which options are mandatory in the query. Note that the remote catalog can not be changed after the object is instantiated. In general it is probably not wise to try to change the remote host via either thequery_url
orurl
methods unless you know what you are doing. Modifying yourskycat.cfg
file is safer.Currently only one config file is supported at any given time. If a config file is changed (see the
cfg_file
class method) the current config is overwritten automatically.It is not possible to override the catalog file in the constructor. Use the
cfg_file
class method instead.Obviously a config per object can be supported but this is probably not that helpful. This will be reconsidered if demand is high.
Accessor methods
- _selected_catalog
-
Catalog name selected by the user and currently configured for this object. Not to be used outside this class..
General methods
configure
-
Configure the object. This calls the base class configure , after it has made sure that a sky cat config file has been read (otherwise we will not be able to vet the incoming arguments.
- _build_query
-
Construct a query URL based on the options.
$url = $q->_build_query();
- _parse_query
-
All the SkyCat servers return data in TST format. Need to make sure that column information is passed into the TST parser.
- _get_allowed_options
-
This method declares which options can be configured by the user of this service. Generated automatically by the skycat config file and keyed to the requested catalog.
- _get_default_options
-
Get the default options that are relevant for the selected catalog.
%defaults = $q->_get_default_options();
- _get_supported_init
Class methods
These methods are not associated with any particular object.
- cfg_file
-
Location of the skycat config file. Default location is
$SKYCAT_CFG
, if defined, else$HOME/.skycat/skycat.cfg
, or$PERLPREFIX/etc/skycat.cfg
if there isn't a version in the users home directoryThis could be made per-class if there is a demand for running queries with different catalogs. This would also move the config contents into the query object itself.
NOTES
'directory' entries are not followed by default although the class can be configured to do so by setting
$Astro::Catalog::Query::SkyCat::FOLLOW_DIRS = 1;
to true.
This class could simply read the catalog config file and allow queries on explicit servers directly rather than going to the trouble of auto-generating a class per server. This has the advantage of allowing a user to request USNO data from different servers rather than generating a single USNO class. ie
my $q = new Astro::Catalog::Query::SkyCat(
catalog => 'usnoa@eso',
target => 'HL Tau',
radius => 5);
as opposed to
my $q = new Astro::Catalog::Query::USNOA(
target => 'HL Tau',
radius => 5 );
What to do with catalog mirrors is an open question. Of course, convenience wrapper classes could be made available that simply delegate the calls to the SkyCat class.
SEE ALSO
SkyCat FTP server. [URL goes here]
SSN75 [http://www.starlink.rl.ac.uk/star/docs/ssn75.htx//ssn75.html] by Clive Davenhall.
BUGS
At the very least for testing, an up-to-date skycat.cfg file should be distributed with this module. Whether it should be used by this module once installed is an open question (since many people will not have a version in the standard location).
COPYRIGHT
Copyright (C) 2001-2003 University of Exeter and Particle Physics and Astronomy Research Council. 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
Tim Jenness <tjenness@cpan.org>, Alasdair Allan <aa@astro.ex.ac.uk>