NAME

Astro::Coords::Offset - Represent an offset from a base position

SYNOPSIS

use Astro::Coords::Offset;

my $offset = new Astro::Coords::Offset( 10, 20,
                                        system => 'J2000',
                                        projection => "TAN" );

my $offset = new Astro::Coords::Offset( $ang1, $ang2,
                                        system => 'J2000',
                                        projection => "TAN" );

my ($a1, $a2) = $offset->offsets;
my $arcsec = $a1->arcsec;

DESCRIPTION

Sometimes, it is necessary for a position to be specified that is offset from the base tracking system. This class provides a means of specifying an offset in a particular coordinate system and using a specified projection.

METHODS

Constructor

new

Create a new Offset object. The first two arguments must be the offsets in arcseconds or Astro::Coords::Angle objects. The projection and tracking system can be specified as optional hash arguments (defaulting to TAN and J2000 respectively).

my $off = new Astro::Coords::Offset( 10, -20 );

my $off = new Astro::Coords::Offset( @off, system => "AZEL",
                                           projection => "SIN");

my $off = new Astro::Coords::Offset( @off, system => "AZEL",
                                           projection => "SIN",
                                           posang => $pa,
                                   );

Accessor Methods

offsets

Return the X and Y offsets.

@offsets = $self->offsets;

as Astro::Coords::Angle objects.

xoffset

Returns just the X offset.

$x = $off->xoffset;
yoffset

Returns just the Y offset.

$x = $off->yoffset;
system

Coordinate system of this offset. Can be different to the coordinate system of the base position.

Allowed values are J2000, B1950, AZEL plus others specified by the JAC TCS XML (see "SEE ALSO" section at end). TRACKING is special since it can change, depending on which output coordinate frame is in use. See the tracking_system attribute for more details.

"Az/El" is treated as "AZEL" for backwards compatibility reasons.

posang

Position angle of this offset as an Astro::Coords::Angle object. Position angle follows the normal "East of North" convention.

$off->posang( 45 );
$pa = $off->posang;

If a number is supplied it is assumed to be in degrees (this matches the common usage in the JCMT TCS XML DTD).

By default returns a position angle of 0 deg.

projection

Return (or set) the projection that should be used for this offset. Defaults to tangent plane. Allowed options are TAN, SIN or ARC.

tracking_system

In some cases, the offset can be specified to be relative to the system that the telescope is currently using to track the source. This does not necessarily have to be the same as the coordinate frame that was originally used to specify the target. For example, it is perfectly acceptable to ask a telescope to go to a certain Az/El and then ask it to track in RA/Dec.

This method allows the tracking system to be specified independenttly of the offset coordinate system. It will only be used if the offset is specified to use "TRACKING" (but it allows the system to disambiguate an offset that was defined as "TRACKING B1950" from an offset that is simply "B1950".

The allowed types are the same as for system except that "TRACKING" is not permitted.

General Methods

invert

Return a new offset object with the sense of the offset inverted.

$inv = $offset->invert;
clone

Create a cloned copy of this offset.

$clone = $offset->clone;
offsets_rotated

This can be thought of as a version of offsets which returns offsets which have been rotated through the position angle. It uses the offsets method internally to fetch the stored values. Results are Astro::Coords::Angle objects.

($x_rotated, $y_rotated) = $offset->offsets_rotated();

It is assumed that the coordinate system has the first coordinate being positive to the East in order to match the definiton of the posang given above.

distance

Calculate the total distance implied by the offsets. Returned as an Astro::Coords::Angle object.

$dist = $offset->distance;

SEE ALSO

The allowed offset types are designed to match the specification used by the Portable Telescope Control System configuration XML. See http://www.jach.hawaii.edu/JACdocs/JCMT/OCS/ICD/006 for more on this.

AUTHOR

Tim Jenness <tjenness@cpan.org>

COPYRIGHT

Copyright 2002-2006 Particle Physics and Astronomy Research Council. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,Suite 330, Boston, MA 02111-1307, USA