NAME

Astro::Catalog - A generic API for stellar catalogues

SYNOPSIS

$catalog = new Astro::Catalog( Stars   => \@array );
$catalog = new Astro::Catalog( Cluster => $file_name );
$catalog = new Astro::Catalog( Scalar      => $scalar );

DESCRIPTION

Stores generic meta-data about an astronomical catalogue. Takes a hash with an array refernce as an arguement. The array should contain a list of Astro::Catalog::Star objects. Alternatively it takes a file name of an ARK Cluster format catalogue.

REVISION

$Id: Catalog.pm,v 1.10 2003/07/19 02:16:23 aa Exp $

METHODS

Constructor

new

Create a new instance from a hash of options

$catalog = new Astro::Catalog( Stars       => \@array );
$catalog = new Astro::Catalog( Cluster     => $file_name );
$catalog = new Astro::Catalog( Scalar      => $scalar );

returns a reference to an Astro::Catalog object. Where $scalar is a scalar holding a string representing an ARK Cluster Format file.

Output Methods

write_catalog

Will write the catalogue object to an standard ARK Cluster format file

$status = $catalog->write_catalog( $file_name, \@mags, \@colour );

returns zero on sucess and non-zero if the write failed. Only magnitudes and colours passed in the array will be written to the file, e.g.

my @mags = ( 'R' );
my @colour = ( 'B-R', 'B-V' );
$status = $catalog->write_catalog( $file_name, \@mags, \@colour );

will write a catalogue with R, B-R and B-V.

Accessor Methods

sizeof

Return the number of stars in the catalogue.

$num = $catalog->sizeof();
pushstar

Push a new star onto the end of the Astro::Catalog object

$catalog->pushstar( $star );

returns the number of stars now in the Catalog object.

popstar

Pop a star from the end of the Astro::Catalog object

$star = $catalog->popstar();

the method deletes the star and returns the deleted Astro::Catalog::Star object.

popstarbyid

Return the Astro::Catalog::Star objects that have the given ID.

@stars = $catalog->popstarbyid( $id );

The method deletes the stars and returns the deleted Astro::Catalog::Star objects. If no star exists with the given ID, the method returns undef.

If called in scalar context this method returns an array reference, and if called in list context returns an array of Astro::Catalog::Star objects.

stars

Return a list of all the Astro::Catalog::Star objects stored in the results object.

@stars = $catalog->stars();
starbyindex

Return the Astro::Catalog::Star object at index $index

$star = $catalog->starbyindex( $index );

the first star is at index 0 (not 1). Returns undef if no arguements are provided.

fieldcentre

Set the field centre and radius of the catalogue (if appropriate)

$catalog->fieldcentre( RA     => $ra,
                       Dec    => $dec,
                       Radius => $radius );
get_ra

Return the RA of the catalogue field centre

$ra = $catalog->get_ra();
get_dec

Return the Dec of the catalogue field centre

$dec = $catalog->get_dec();
get_radius

Return the radius of the catalogue from the field centre

$radius = $catalog->get_radius();

General Methods

configure

Configures the object from multiple pieces of information.

$catalog->configure( %options );

Takes a hash as argument with the list of keywords.

freeze

Method to return a blessed reference to the object so that we can store ths object on disk using Data::Dumper module.