Astro-Catalog
view release on metacpan or search on metacpan
lib/Astro/Catalog/Query/USNOA2.pm view on Meta::CPAN
package Astro::Catalog::Query::USNOA2;
=head1 NAME
Astro::Catalog::Query::USNOA2 - A query request to the USNO-A2.0 Catalog
=head1 SYNOPSIS
$usno = new Astro::Catalog::Query::USNOA2(
Coords => new Astro::Coords(),
Radius => $radius,
Bright => $magbright,
Faint => $magfaint,
Sort => $sort_type,
Number => $number_out);
my $catalog = $usno->querydb();
=head1 DESCRIPTION
The module is an object orientated interface to the online USNO-A2.0
catalog at the ESO/ST-ECF archive site.
Stores information about an prospective USNO-A2.0 query and allows the query to
be made, returning an Astro::Catalog::USNOA2::Catalog object.
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.
See L<Astro::Catalog::BaseQuery> for the catalog-independent methods.
=cut
use strict;
use warnings;
use base qw/Astro::Catalog::Transport::REST/;
use File::Spec;
use Carp;
use Astro::Coords;
use Astro::Catalog;
use Astro::Catalog::Item;
use Astro::Flux;
use Astro::Fluxes;
use Astro::FluxColor;
use Number::Uncertainty;
our $VERSION = '4.38';
=begin __PRIVATE_METHODS__
=head2 Private methods
These methods are for internal use only.
=over 4
=item B<_default_remote_host>
=cut
sub _default_remote_host {
return "archive.eso.org";
}
=item B<_default_url_path>
=cut
sub _default_url_path {
return "skycat/servers/usnoa_res?";
}
=item B<_get_allowed_options>
Returns a hash with keys, being the internal options supported
by this subclass, and values being the key name actually required
by the remote system (and to be included in the query).
=cut
sub _get_allowed_options {
my $self = shift;
return (
ra => 'ra',
dec => 'dec',
object => 'object',
radmax => 'radmax',
magbright => 'magbright',
magfaint => 'magfaint',
sort => 'sort',
nout => 'nout',
format => 'format',
);
}
=item B<_get_default_options>
Get the default query state.
=cut
sub _get_default_options {
return (
ra => undef,
dec => undef,
lib/Astro/Catalog/Query/USNOA2.pm view on Meta::CPAN
name => $star->id(),
));
}
# Quality
my $quality = $separated[10];
$star->quality( $quality );
# Field
my $field = $separated[11];
$star->field( $field );
# GSC
my $gsc = $separated[12];
if ($gsc eq "+") {
$star->gsc("TRUE");
}
else {
$star->gsc("FALSE");
}
# Distance
my $distance = $separated[13];
$star->distance( $distance );
# Position Angle
my $pos_angle = $separated[14];
$star->posangle( $pos_angle );
}
# Calculate error
# Error are calculated as follows
#
# Delta.R = 0.15*sqrt( 1 + 10**(0.8*(R-19)) )
# Delta.B = 0.15*sqrt( 1 + 10**(0.8*(B-19)) )
my ($power, $delta_r, $delta_b);
# delta.R
$power = 0.8*( $separated[8] - 19.0 );
$delta_r = 0.15* (( 1.0 + ( 10.0 ** $power ) ) ** (1.0/2.0));
# delta.B
$power = 0.8*( $separated[9] - 19.0 );
$delta_b = 0.15* (( 1.0 + ( 10.0 ** $power ) ) ** (1.0/2.0));
# calcuate B-R colour and error
# Error is calculated as follows
#
# Delta.(B-R) = sqrt( Delta.R**2 + Delta.B**2 )
my $b_minus_r = $separated[9] - $separated[8];
# delta.(B-R)
my $delta_bmr = ( ( $delta_r ** 2.0 ) + ( $delta_b ** 2.0 ) ) ** (1.0/2.0);
$star->fluxes(new Astro::Fluxes(
new Astro::Flux(
new Number::Uncertainty(
Value => $separated[8],
Error => $delta_r ),
'mag', "R"),
new Astro::Flux(
new Number::Uncertainty(
Value => $separated[9],
Error => $delta_b),
'mag', "B"),
new Astro::FluxColor(
lower => "R",
upper => "B",
quantity => new Number::Uncertainty(
Value => $b_minus_r,
Error => $delta_bmr)),
));
# Push the star into the catalog
# only push the star if the Astro::Coords object is
# correctly defined. The Dec might be bogus since the
# USNO-A2 catalog has its seconds field out of
# normal range (0-59.9) in some cases.
if ($star->coords()) {
$catalog->pushstar($star);
}
# increment counter
$counter = $counter + 1;
}
# reset $line to correct place
$line = $counter;
}
}
# set the field centre
$catalog->fieldcentre(%field);
return $catalog;
}
=back
=head2 Translation Methods
The query options stored internally in the object are not necessarily
the form required for a query to a remote server. Methods for converting
from the internal representation to the external query format are
provided in the form of _from_$opt. ie:
($outkey, $outvalue) = $q->_from_ra();
($outkey, $outvalue) = $q->_from_object();
Currently translations are a bit thin on the ground...
=cut
# None special for subclass
1;
__END__
=end __PRIVATE_METHODS__
=head1 SEE ALSO
L<Astro::Catalog::Query>, L<Astro::Catalog::GSC::Query>
=head1 COPYRIGHT
Copyright (C) 2001 University of Exeter. All Rights Reserved.
( run in 0.886 second using v1.01-cache-2.11-cpan-5a3173703d6 )