| 1 | package Astro::Catalog::Query::CMC; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Astro::Catalog::Query::CMC - A query request to the Carlsberg Meridian Catalog | ||||||||||
| 6 | |||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||
| 8 | |||||||||||
| 9 | $gsc = new Astro::Catalog::Query::CMC( | ||||||||||
| 10 | RA => $ra, | ||||||||||
| 11 | Dec => $dec, | ||||||||||
| 12 | Radius => $radius, | ||||||||||
| 13 | Nout => $number_out); | ||||||||||
| 14 | |||||||||||
| 15 | my $catalog = $gsc->querydb(); | ||||||||||
| 16 | |||||||||||
| 17 | =head1 WARNING | ||||||||||
| 18 | |||||||||||
| 19 | This code should be superceeded by the generic Vizier query class. | ||||||||||
| 20 | |||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||
| 22 | |||||||||||
| 23 | The module is an object orientated interface to the online | ||||||||||
| 24 | Carlsberg Meridian Catalogues (CMC11) | ||||||||||
| 25 | |||||||||||
| 26 | Stores information about an prospective query and allows the query to | ||||||||||
| 27 | be made, returning an Astro::Catalog::Query::CMC object. | ||||||||||
| 28 | |||||||||||
| 29 | The object will by default pick up the proxy information from the HTTP_PROXY | ||||||||||
| 30 | and NO_PROXY environment variables, see the LWP::UserAgent documentation for | ||||||||||
| 31 | details. | ||||||||||
| 32 | |||||||||||
| 33 | See L<Astro::Catalog::BaseQuery> for the catalog-independent methods. | ||||||||||
| 34 | |||||||||||
| 35 | =cut | ||||||||||
| 36 | |||||||||||
| 37 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 38 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 39 | 2 | ▶ | use base qw/Astro::Catalog::Transport::REST/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | 2 | ▶ | use File::Spec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 42 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | |||||||||||
| 44 | 2 | ▶ | use Astro::Catalog; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 2 | ▶ | use Astro::Catalog::Item; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | |||||||||||
| 47 | 2 | our $VERSION = '4.38'; | |||||||||
| 48 | 2 | our $DEBUG = 0; | |||||||||
| 49 | |||||||||||
| 50 | =begin __PRIVATE_METHODS__ | ||||||||||
| 51 | |||||||||||
| 52 | =head2 Private methods | ||||||||||
| 53 | |||||||||||
| 54 | These methods are for internal use only. | ||||||||||
| 55 | |||||||||||
| 56 | =over 4 | ||||||||||
| 57 | |||||||||||
| 58 | =item B<_default_remote_host> | ||||||||||
| 59 | |||||||||||
| 60 | =cut | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub _default_remote_host { | ||||||||
|
Subroutine
_default_remote_host: not called CC=1 SCAR=6.9
| |||||||||||
| 63 | 0 | return "vizier.u-strasbg.fr"; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | =item B<_default_url_path> | ||||||||||
| 67 | |||||||||||
| 68 | =cut | ||||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | sub _default_url_path { | ||||||||
|
Subroutine
_default_url_path: not called CC=1 SCAR=6.9
| |||||||||||
| 71 | 0 | return "viz-bin/asu-acl?"; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | =item B<_get_allowed_options> | ||||||||||
| 75 | |||||||||||
| 76 | Returns a hash with keys, being the internal options supported | ||||||||||
| 77 | by this subclass, and values being the key name actually required | ||||||||||
| 78 | by the remote system (and to be included in the query). | ||||||||||
| 79 | |||||||||||
| 80 | =cut | ||||||||||
| 81 | |||||||||||
| 82 | 0 | ▶ | sub _get_allowed_options { | ||||||||
|
Subroutine
_get_allowed_options: not called CC=1 SCAR=6.9
| |||||||||||
| 83 | 0 | my $self = shift; | |||||||||
| 84 | return ( | ||||||||||
| 85 | 0 | ra => '-c.ra', | |||||||||
| 86 | dec => '-c.dec', | ||||||||||
| 87 | radmax => '-c.rm', | ||||||||||
| 88 | nout => '-out.max', | ||||||||||
| 89 | catalog => '-source', | ||||||||||
| 90 | ); | ||||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | =item B<_get_default_options> | ||||||||||
| 95 | |||||||||||
| 96 | Get the default query state. | ||||||||||
| 97 | |||||||||||
| 98 | =cut | ||||||||||
| 99 | |||||||||||
| 100 | 0 | ▶ | sub _get_default_options { | ||||||||
|
Subroutine
_get_default_options: not called CC=1 SCAR=6.9
| |||||||||||
| 101 | return ( | ||||||||||
| 102 | # Internal | ||||||||||
| 103 | 0 | catalog => 'I/282/cmc12', | |||||||||
| 104 | |||||||||||
| 105 | # Target information | ||||||||||
| 106 | ra => undef, | ||||||||||
| 107 | dec => undef, | ||||||||||
| 108 | |||||||||||
| 109 | # Limits | ||||||||||
| 110 | radmax => 5, | ||||||||||
| 111 | nout => 20000, | ||||||||||
| 112 | ); | ||||||||||
| 113 | } | ||||||||||
| 114 | |||||||||||
| 115 | =item B<_parse_query> | ||||||||||
| 116 | |||||||||||
| 117 | Private function used to parse the results returned in an GSC query. | ||||||||||
| 118 | Should not be called directly. Instead use the querydb() assessor method to | ||||||||||
| 119 | make and parse the results. | ||||||||||
| 120 | |||||||||||
| 121 | =cut | ||||||||||
| 122 | |||||||||||
| 123 | 0 | ▶ | sub _parse_query { | ||||||||
|
Subroutine
_parse_query: not called CC=2 SCAR=17.9
| |||||||||||
| 124 | 0 | my $self = shift; | |||||||||
| 125 | |||||||||||
| 126 | 0 | ▶ | print $self->{BUFFER} if $DEBUG; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 127 | return new Astro::Catalog( | ||||||||||
| 128 | Format => 'TST', | ||||||||||
| 129 | Data => $self->{BUFFER}, | ||||||||||
| 130 | 0 | Origin => 'Carlsberg Meridian Catalogue (CMC/11)', | |||||||||
| 131 | ReadOpt => {ra_col => 2, dec_col => 4,} | ||||||||||
| 132 | ); | ||||||||||
| 133 | } | ||||||||||
| 134 | |||||||||||
| 135 | |||||||||||
| 136 | =back | ||||||||||
| 137 | |||||||||||
| 138 | =head2 Translation Methods | ||||||||||
| 139 | |||||||||||
| 140 | The query options stored internally in the object are not necessarily | ||||||||||
| 141 | the form required for a query to a remote server. Methods for converting | ||||||||||
| 142 | from the internal representation to the external query format are | ||||||||||
| 143 | provided in the form of _from_$opt. ie: | ||||||||||
| 144 | |||||||||||
| 145 | ($outkey, $outvalue) = $q->_from_ra(); | ||||||||||
| 146 | ($outkey, $outvalue) = $q->_from_object(); | ||||||||||
| 147 | |||||||||||
| 148 | The base class only includes one to one mappings. | ||||||||||
| 149 | |||||||||||
| 150 | =over 4 | ||||||||||
| 151 | |||||||||||
| 152 | =item B<_translate_one_to_one> | ||||||||||
| 153 | |||||||||||
| 154 | Return a list of internal options (as defined in C<_get_allowed_options>) | ||||||||||
| 155 | that are known to support a one-to-one mapping of the internal value | ||||||||||
| 156 | to the external value. | ||||||||||
| 157 | |||||||||||
| 158 | %one = $q->_translate_one_to_one(); | ||||||||||
| 159 | |||||||||||
| 160 | Returns a hash with keys and no values (this makes it easy to | ||||||||||
| 161 | check for the option). | ||||||||||
| 162 | |||||||||||
| 163 | This method also returns, the values from the parent class. | ||||||||||
| 164 | |||||||||||
| 165 | =cut | ||||||||||
| 166 | |||||||||||
| 167 | 0 | ▶ | sub _translate_one_to_one { | ||||||||
|
Subroutine
_translate_one_to_one: not called CC=1 SCAR=6.9
| |||||||||||
| 168 | 0 | my $self = shift; | |||||||||
| 169 | # convert to a hash-list | ||||||||||
| 170 | return ($self->SUPER::_translate_one_to_one, | ||||||||||
| 171 | 0 | map { $_, undef }(qw/ | |||||||||
| 172 | catalog | ||||||||||
| 173 | /) | ||||||||||
| 174 | ); | ||||||||||
| 175 | } | ||||||||||
| 176 | |||||||||||
| 177 | 2 | 1; | |||||||||
| 178 | |||||||||||
| 179 | __END__ | ||||||||||