Astro::Catalog::IO::JCMT - JCMT catalog I/O for Astro::Catalog
$cat = Astro::Catalog::IO::JCMT->_read_catalog(\@lines); $arrref = Astro::Catalog::IO::JCMT->_write_catalog($cat, %options); $filename = Astro::Catalog::IO::JCMT->_default_file();
This class provides read and write methods for catalogs in the JCMT pointing catalog format. The methods are not public and should, in general, only be called from the Astro::Catalog write_catalog and read_catalog methods.
Astro::Catalog
write_catalog
read_catalog
Method to take a general target name and clean it up so that it is suitable for writing in a JCMT source catalog. This routine is used by the catalog writing code but can also be used publically in order to make sure that a target name to be written to the catalog is guaranteed to match that used in another location (e.g. when writing an a document to accompany the catalog which refers to targets within it).
The source name can be truncated.
$cleaned = Astro::Catalog::IO::JCMT->clean_target_name($dirty);
Will return undef if the argument is not defined.
Punctuation such as "," and ";" are replaced with underscores. ".", "()" and "+-" are allowed.
Returns the location of the default JCMT pointing catalog at the JCMT itself. This is purely for convenience of the caller when they are at the JCMT and wish to use the default catalog without having to know explicitly where it is.
$filename = Astro::Catalog::IO::JCMT->_default_file();
Returns empty list/undef if the file is not available.
If the environment variable ASTRO_CATALOG_JCMT is defined (and exists) this will be used as the default.
Parses the catalog lines and returns a new Astro::Catalog object containing the catalog entries.
$cat = Astro::Catalog::IO::JCMT->_read_catalog(\@lines, %options);
Supported options (with defaults) are:
telescope => Name of telescope to associate with each coordinate entry (defaults to JCMT). If the telescope option is specified but is undef or empty string, no telescope is used. incplanets => Append planets to catalog entries (default is true) inccomments => Read comment lines into misc entries (default: false)
Write the catalog to an array and return it. Returning a reference to an array provides more flexibility to the caller.
$ref = Astro::Catalog::IO::JCMT->_write_catalog($cat, %options);
Spaces are removed from source names. The contents of the catalog are sanity checked.
Add a comment header to the start of the catalog. [default: true]
Check for duplicates. Remove if the coordinates match. Add suffix to disambiguate otherwise. [default: true]
Format a value for inclusion in a JCMT format catalog.
Parse a line from a JCMT format catalog and return a corresponding Astro::Catalog::Item object. Returns empty list if the line can not be parsed or refers to a comment line (so that map can be used in the caller).
Astro::Catalog::Item
$star = Astro::Catalog::IO::JCMT->_parse_line($line, $tel, \%status_buffer, \%options);
where $line is the line to be parsed and (optional) $tel is an Astro::Telescope object to be associated with the coordinate objects.
$line
$tel
Astro::Telescope
A reference to a hash can be provided to track parsing status between lines. This is currently used to store comments read from the catalog.
The line is parsed using a pattern match.
Coordinates are stored as Astro::Coords objects inside Astro::Catalog::Item objects.
Astro::Coords
The following global variables can be modified to control the state of the module:
Controls debugging messages. Default state is false.
The following constants are available for querying:
The maximum length of sourcenames writable to a JCMT source catalog.
Copyright (C) 1999-2003 Particle Physics and Astronomy Research Council. All Rights Reserved.
Tim Jenness <tjenness@cpan.org>
To install Astro::Catalog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Astro::Catalog
CPAN shell
perl -MCPAN -e shell install Astro::Catalog
For more information on module installation, please visit the detailed CPAN module installation guide.