Astro::SIMBAD::Result::Object - A individual astronomical object


Astro-SIMBAD documentation Contained in the Astro-SIMBAD distribution.

Index


Code Index:

NAME

Top

Astro::SIMBAD::Result::Object - A individual astronomical object

SYNOPSIS

Top

  $object = new Astro::SIMBAD::Result::Object( Name   => $object_name,
                                               Type   => $object_type,
                                               Long   => $long_type,
                                               Frame => \@coord_frame,
                                               RA     => $ra,
                                               Dec    => $declination,
                                               Spec   => $spectral_type,
                                               URL    => $url );

DESCRIPTION

Top

Stores meta-data about an individual astronomical object in the Astro::SIMBAD::Result object returned by an Astro::SIMBAD::Query object.

REVISION

Top

$Id: Object.pm,v 1.3 2005/06/08 01:38:17 aa Exp $

METHODS

Top

Constructor

new

Create a new instance from a hash of options

  $paper = new Astro::SIMBAD::Result::Object(  );

returns a reference to an SIMBAD astronomical object.

Accessor Methods

name

Return (or set) the name of the object

   $name = $object->name();
   $object->name( $name );

Query types: list, object

target

Return (or set) the target name of the object. Available whenever a target is specified in the query. The returned value is identical to the query parameter, except that it is normalized (spaces replaced with '+' characters). This is useful because name() may return a different designation than the target that is supplied as a query parameter.

   $target = $object->target();
   $object->target( $target );

Query types: list, object

type

Return (or set) the (short) type of the object

   $type = $object->type();
   $object->type( $type );

Query types: list

long

Return (or set) the (long) type of the object

   $long_type = $object->long();
   $object->long( $long_type );

Query types: list, object

frame

Return (or set) the system the R.A. and DEC stored in the object are defined in, e.g. Co-ordinate Frame FK5, Epoch 1950 and Equinox 2000

   @system = $object->frame();
   $object->frame( \@system );

where @system would be [ "FK5", 1950.0, 2000.0 ]. If called in a scalar context will return a string of the form "FK5 1950/2000" to

Query types: list, object

ra

Return (or set) the R.A. of the object

   $ra = $object->ra();
   $object->ra( $ra );

Query types: list, object

dec

Return (or set) the Declination of the object

   $dec = $object->dec();
   $object->dec( $dec );

Query types: list, object

spec

Return (or set) the Spectral Type of the object

   $spec_type = $object->spec();
   $object->spec( $spec_type );

Query types: list, object

url

Return (or set) the followup URL for the object where more information can be found via SIMBAD, including pointers to reduced data.

   $url = $object->url();
   $object->url( $url );

bmag

Return (or set) the B-magnitude of the object

   $bmag = $object->bmag();
   $object->bmag( $bmag );

Query types: list, object

vmag

Return (or set) the V-magnitude of the object

   $vmag = $object->vmag();
   $object->vmag( $vmag );

Query types: list, object

ident

Return (or append) the array of object identifiers

   @ident = $object->ident();
   $object->ident( @ident );

Query types: object

pm

Return (or set) the proper motion of the object in mas/year

   @pm = $object->pm();
   $object->pm( @pm );

Query types: object

plx

Return (or set) the parallax of the object

   $plx = $object->plx();
   $object->plx( $plx );

Query types: object

radial

Return (or set) the radial velocity (km/s) of the object

   $radial = $object->radial();
   $object->radial( $radial );

Query types: object

redshift

Return (or set) the redshift of the object

   $redshift = $object->redshift();
   $object->redshift( $redshift );

Query types: object

General Methods

configure

Configures the object from multiple pieces of information.

  $object->configure( %options );

Takes a hash as argument with the following keywords:

COPYRIGHT

Top

AUTHORS

Top

Alasdair Allan <aa@astro.ex.ac.uk>,


Astro-SIMBAD documentation Contained in the Astro-SIMBAD distribution.
package Astro::SIMBAD::Result::Object;

# ---------------------------------------------------------------------------

#+
#  Name:
#    Astro::SIMBAD::Result:Object

#  Purposes:
#    Perl wrapper for the SIMBAD database

#  Language:
#    Perl module

#  Description:
#    This module wraps the SIMBAD online database.

#  Authors:
#    Alasdair Allan (aa@astro.ex.ac.uk)

#  Revision:
#     $Id: Object.pm,v 1.3 2005/06/08 01:38:17 aa Exp $

#  Copyright:
#     Copyright (C) 2001 University of Exeter. All Rights Reserved.

#-

# ---------------------------------------------------------------------------

# L O A D   M O D U L E S --------------------------------------------------

use strict;
use vars qw/ $VERSION /;

'$Revision: 1.3 $ ' =~ /.*:\s(.*)\s\$/ && ($VERSION = $1);

# C O N S T R U C T O R ----------------------------------------------------

sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;

  # bless the query hash into the class
  my $block = bless { NAME    => undef,
		      TARGET  => undef,
                      TYPE    => undef,
                      LONG    => undef,
                      FRAME   => [],
                      RA      => undef,
                      DEC     => undef,
                      SPEC    => undef,
                      URL     => undef,
		      BMAG    => undef,
		      VMAG    => undef,
		      IDENT   => [],
		      PM      => [],
		      PLX     => undef,
		      RADIAL  => undef,
		      REDSHIFT=> undef,
		  }, $class;

  # If we have arguments configure the object
  $block->configure( @_ ) if @_;

  return $block;

}

# A C C E S S O R  --------------------------------------------------------

sub name {
  my $self = shift;
  if (@_) {
    $self->{NAME} = shift;
  }
  return $self->{NAME};
}

sub target {
  my $self = shift;
  if (@_) {
    $self->{TARGET} = shift;
  }
  return $self->{TARGET};
}

sub type {
  my $self = shift;
  if (@_) {
    $self->{TYPE} = shift;
  }
  return $self->{TYPE};
}

sub long {
  my $self = shift;
  if (@_) {
    $self->{LONG} = shift;
  }
  return $self->{LONG};
}

sub frame {
  my $self = shift;

  if (@_) {
    # take a local copy to avoid "copy of copy" problems
    my $frame = shift;
    @{$self->{FRAME}} = @{$frame};
  }
   
  my $stringify = 
     "${$self->{FRAME}}[0] ${$self->{FRAME}}[1]/${$self->{FRAME}}[2]";
     
  return wantarray ? @{$self->{FRAME}} : $stringify;
}

sub ra {
  my $self = shift;
  if (@_) {
    $self->{RA} = shift;
  }
  return $self->{RA};
}

sub dec {
  my $self = shift;
  if (@_) {
    $self->{DEC} = shift;
  }
  return $self->{DEC};
}

sub spec {
  my $self = shift;
  if (@_) {
    $self->{SPEC} = shift;
  }
  return $self->{SPEC};
}

sub url {
  my $self = shift;
  if (@_) {
    $self->{URL} = shift;
  }
  return $self->{URL};
}

sub bmag {
  my $self = shift;
  if (@_) {
    $self->{BMAG} = shift;
  }
  return $self->{BMAG};
}

sub vmag {
  my $self = shift;
  if (@_) {
    $self->{VMAG} = shift;
  }
  return $self->{VMAG};
}

sub ident {
  my $self = shift;
  if (@_) {
    my $idarray = shift;
    @{$self->{IDENT}} = @{$idarray};
  }
  return $self->{IDENT};
}

sub pm {
  my $self = shift;
  if (@_) {
    push @{$self->{PM}}, @_[0..1];
  }
  return $self->{PM};
}

sub plx {
  my $self = shift;
  if (@_) {
    $self->{PLX} = shift;
  }
  return $self->{PLX};
}

sub radial {
  my $self = shift;
  if (@_) {
    $self->{RADIAL} = shift;
  }
  return $self->{RADIAL};
}

sub redshift {
  my $self = shift;
  if (@_) {
    $self->{REDSHIFT} = shift;
  }
  return $self->{REDSHIFT};
}

# C O N F I G U R E -------------------------------------------------------

sub configure {
  my $self = shift;

  # return unless we have arguments
  return undef unless @_;

  # grab the argument list
  my %args = @_;

  # Loop over the allowed keys storing the values
  # in the object if they exist
  for my $key (qw / Name Type Long Frame RA Dec Spec URL /) {
      my $method = lc($key);
      $self->$method( $args{$key} ) if exists $args{$key};
  }

}


# T I M E   A T   T H E   B A R  --------------------------------------------

# L A S T  O R D E R S ------------------------------------------------------

1;