Astro-Catalog
view release on metacpan or search on metacpan
lib/Astro/Catalog/Item.pm view on Meta::CPAN
defined($self->coords)) {
# We need to get a template FK5 SkyFrame to be able to convert
# properly between RA/Dec and X/Y, but we can only do this if
# we load Starlink::AST. So that we don't have a major dependency
# on that module, load it here at runtime.
eval {require Starlink::AST;};
if ($@) {
croak "Attempted to convert from RA/Dec to Y position and cannot load Starlink::AST. Error: $@";
}
my $template = new Starlink::AST::SkyFrame("System=FK5");
my $wcs = $self->wcs;
my $frameset = $wcs->FindFrame($template, "");
unless (defined $frameset) {
croak "Could not find FK5 SkyFrame to do RA/Dec to Y position translation";
}
my ($ra, $dec) = $self->coords->radec();
my ($x, $y) = $frameset->Tran2(
[$ra->radians],
[$dec->radians],
0);
$self->{Y} = $y->[0];
}
return $self->{Y};
}
=item B<wcs>
Return (or set) the WCS associated with the star.
$wcs = $star->wcs;
$star->wcs($wcs);
The WCS is a C<Starlink::AST> object.
=cut
sub wcs {
my $self = shift;
if (@_) {
my $wcs = shift;
unless (defined $wcs) {
$self->{WCS} = undef;
}
elsif (UNIVERSAL::isa($wcs, "Starlink::AST")) {
$self->{WCS} = $wcs;
}
}
return $self->{WCS};
}
=item B<comment>
Return (or set) a comment associated with the star
$comment = $star->comment();
$star->comment($comment_string);
The comment is propogated to the underlying coordinate
object (if one is present) if the comment is updated.
=cut
sub comment {
my $self = shift;
if (@_) {
$self->{COMMENT} = shift;
my $c = $self->coords;
$c->comment($self->{COMMENT}) if defined $c;
}
return $self->{COMMENT};
}
=item B<spectype>
The spectral type of the Star.
$spec = $star->spectype;
=cut
sub spectype {
my $self = shift;
if (@_) {
$self->{SPECTYPE} = shift;
}
return $self->{SPECTYPE};
}
=item B<startype>
The type of star. Usually uses the Simbad abbreviation.
eg. '*' for a star, 'rG' for a Radio Galaxy.
$type = $star->startype;
See also C<longstartype> for the expanded version of this type.
=cut
sub startype {
my $self = shift;
if (@_) {
$self->{STARTYPE} = shift;
}
return $self->{STARTYPE};
}
=item B<longstartype>
The full description of the type of star. Usually uses the Simbad text.
If no text has been provided, a lookup will be performed using the
abbreviated C<startype>.
$long = $star->longstartype;
$star->longstartype("A variable star");
See also C<longstartype> for the expanded version of this type.
( run in 1.145 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )