File Coverage

blib/lib/Astro/Catalog/Query/Vizier.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Astro::Catalog::Query::Vizier;
2              
3             =head1 NAME
4              
5             Astro::Catalog::Query::Vizier - A query request to the Vizier catalogs
6              
7             =head1 SYNOPSIS
8              
9             $gsc = new Astro::Catalog::Query::2MASS( Catalog => '2MASS',
10             RA => $ra,
11             Dec => $dec,
12             Radius => $radius,
13             Nout => $number_out,
14             Target => $object,
15             );
16              
17             my $catalog = $gsc->querydb();
18              
19             =head1 DESCRIPTION
20              
21             The module is an object orientated interface to the online
22             Vizier catalogs. Multiple catalogues can be specified using a
23             comma-separated list.
24              
25             Stores information about an prospective query and allows the query to
26             be made, returning an Astro::Catalog::Query::Vizier object.
27              
28             The object will by default pick up the proxy information from the HTTP_PROXY
29             and NO_PROXY environment variables, see the LWP::UserAgent documentation for
30             details.
31              
32             See L for the catalog-independent methods.
33              
34             =cut
35              
36             # L O A D M O D U L E S --------------------------------------------------
37              
38 1     1   7735983 use 5.006;
  1         8  
  1         146  
39 1     1   10 use strict;
  1         4  
  1         162  
40 1     1   118 use warnings;
  1         14  
  1         186  
41 1     1   10 use base qw/ Astro::Catalog::Transport::REST /;
  1         2  
  1         1676  
42             use vars qw/ $VERSION /;
43              
44             use File::Spec;
45             use Carp;
46              
47             # generic catalog objects
48             use Astro::Catalog;
49             use Astro::Catalog::Star;
50              
51             $VERSION = "4.31";
52              
53             =head1 REVISION
54              
55             $Id: Vizier.pm,v 1.1 2003/08/04 10:52:28 timj Exp $
56              
57             =begin __PRIVATE_METHODS__
58              
59             =head2 Private methods
60              
61             These methods are for internal use only.
62              
63             =over 4
64              
65             =item B<_default_remote_host>
66              
67             Need to allow the host to be specified.
68              
69             =cut
70              
71             sub _default_remote_host {
72             return "vizier.u-strasbg.fr";
73             }
74              
75             =item B<_default_url_path>
76              
77             asu-acl will generate TST format catalogues. asu-xml will generate
78             AstroRes format XML. We assume TST for the moment.
79              
80             =cut
81              
82             sub _default_url_path {
83             return "viz-bin/asu-acl?";
84             }
85              
86             =item B<_get_allowed_options>
87              
88             Returns a hash with keys, being the internal options supported
89             by this subclass, and values being the key name actually required
90             by the remote system (and to be included in the query).
91              
92             =cut
93              
94             sub _get_allowed_options {
95             my $self = shift;
96             # Need to add magfaint and magbright
97             return (
98             ra => '-c.ra',
99             dec => '-c.dec',
100             radmax => '-c.rm.max',
101             radmin => '-c.rm.min',
102             nout => '-out.max',
103             # sort => '-sort',
104             object => '-c.obj',
105              
106             catalog => '-source',
107             # outcols => '-out.all',
108             );
109             }
110              
111              
112             =item B<_get_default_options>
113              
114             Get the default query state.
115              
116             =cut
117              
118             sub _get_default_options {
119             return (
120             # Internal
121             catalog => '2MASS',
122              
123             # Target information
124             ra => undef,
125             dec => undef,
126             object => undef,
127              
128             # Limits
129             radmin => 0,
130             radmax => 5,
131             nout => 20000,
132             # sort => 'RA', # do not know the allowed options
133              
134             # outcols => '', # need to check
135             );
136             }
137              
138             =item B<_parse_query>
139              
140             Private function used to parse the results returned in an GSC query.
141             Should not be called directly. Instead use the querydb() assessor method to
142             make and parse the results.
143              
144             =cut
145              
146             sub _parse_query {
147             my $self = shift;
148              
149             print $self->{BUFFER};
150             return new Astro::Catalog( Format => 'TST', Data => $self->{BUFFER},
151             Origin => 'Vizier',
152             ReadOpt => {
153             id_col => 0,
154             ra_col => 1,
155             dec_col => 2,
156             }
157             );
158             }
159              
160              
161             =back
162              
163             =head2 Translation Methods
164              
165             The query options stored internally in the object are not necessarily
166             the form required for a query to a remote server. Methods for converting
167             from the internal representation to the external query format are
168             provided in the form of _from_$opt. ie:
169              
170             ($outkey, $outvalue) = $q->_from_ra();
171             ($outkey, $outvalue) = $q->_from_object();
172              
173             The base class only includes one to one mappings.
174              
175             =over 4
176              
177             =item B<_translate_one_to_one>
178              
179             Return a list of internal options (as defined in C<_get_allowed_options>)
180             that are known to support a one-to-one mapping of the internal value
181             to the external value.
182              
183             %one = $q->_translate_one_to_one();
184              
185             Returns a hash with keys and no values (this makes it easy to
186             check for the option).
187              
188             This method also returns, the values from the parent class.
189              
190             =cut
191              
192             sub _translate_one_to_one {
193             my $self = shift;
194             # convert to a hash-list
195             return ($self->SUPER::_translate_one_to_one,
196             map { $_, undef }(qw/
197             catalog
198             outcols
199             /)
200             );
201             }
202              
203             =back
204              
205             =end __PRIVATE_METHODS__
206              
207             =head1 NOTES
208              
209             See http://vizier.u-strasbg.fr/doc/asu.html for all the options
210             supported by Vizier (although they will be the translated form
211             rather than the abstracted arguments used by C.
212              
213             =head1 COPYRIGHT
214              
215             Copyright (C) 2001 University of Exeter. All Rights Reserved.
216             Some modifications copyright (C) 2003 Particle Physics and Astronomy
217             Research Council. All Rights Reserved.
218              
219             This program was written as part of the eSTAR project and is free software;
220             you can redistribute it and/or modify it under the terms of the GNU Public
221             License.
222              
223             =head1 AUTHORS
224              
225             Alasdair Allan Eaa@astro.ex.ac.ukE,
226             Tim Jenness Etjenness@cpan.orgE
227              
228             =cut
229              
230             # L A S T O R D E R S ------------------------------------------------------
231              
232             1;