[show private | hide private] [frames | no frames]

## Class AngSep

The AngSep class lets the user compare the angular separation between different `position.Position`s without having to think too much about units.

Each AngSep object is created with a particular length in a particular set of units. These are then converted into an internal representation which is used for all math and comparisons.

All unit checks are performed by checking the first few letters of the unit string, to provide more flexibility for the user. (eg, "arc" "arcs" "arcsec" "arcseconds" will all evaluate to arcseconds.)

All math and comparisons can be done either between two AngSep objects, or between an AngSep object and a number. In the latter case, the number is assumed to have the same units as the AngSep object.

# Example:

```>>> #Default units are arcsec
>>> a=angsep.AngSep(5)
>>> a
5.000000 arcsec

>>> #The usual arithmetic works
>>> b=angsep.AngSep(3)
>>> a+b
8.000000 arcsec

>>> a*3
15.000000 arcsec```
```>>> #Use AngSep together with Position
>>> p1=P.Position('12:34:45.23 45:43:21.12')
>>> p2=P.Position('12:34:47.34 45:43:23.0')
>>> sep=p1.angsep(p2)
>>> eps=angsep.AngSep(30,units='arcsec')
>>> p1.within(p2,eps)
True

>>> p2.within(p1,20)
False```

Note: Angular Separations are inherently positive: negative separations have no physical meaning, and are forbidden.

Method Summary
AngSep ```__init__(self, value, units)```
```__add__(self, other)```
```__eq__(self, other)```
```__ge__(self, other)```
```__gt__(self, other)```
```__le__(self, other)```
```__lt__(self, other)```
```__mul__(self, other)```
```__ne__(self, other)```
```__radd__(self, other)```
string `__repr__(self)`
```__rmul__(self, other)```
```__rsub__(self, other)```
```__sub__(self, other)```
Boolean ```approx(self, other, epsilon)```
True if "self" and "other" are equal to within "epsilon".
float `arcsec(self)`
Return separation in arcsec
float `degrees(self)`
Return separation in degrees
float `radians(self)`
None ```setunits(self, units)```
Sets the units of the public representation, and converts the publically visible value to those units
None `_calcinternal(self)`
Sets the internal representation

Instance Variable Summary
string `units`: units in which the magnitude is expressed (arcsec, degrees, or radians)
number `value`: magnitude of the angular separation
number (degrees) `_internal`: internal representation of the separation

Method Details

### __init__(self, value, units='arcsec')(Constructor)

Parameters:
`value` - magnitude of the angular separation
(type=number)
`units` - arcsec or degrees
(type=string)
Returns:
AngSep
Raises:
`ValueError` - if value < 0. Negative separations are physically meaningless and thus forbidden.

Returns:
string

### approx(self, other, epsilon)

True if "self" and "other" are equal to within "epsilon". "epsilon" is considered to have the same units as self.
Parameters:
`other`
(type=AngSep or number (units of self))
`epsilon`
(type=AngSep or number (units of self))
Returns:
Boolean

Note: This is not implemented as 'abs(self-other)<epsilon' because of the prohibition on negative separations.

### arcsec(self)

Returns:
separation in arcsec
(type=float)

### degrees(self)

Returns:
separation in degrees
(type=float)

Returns:
(type=float)

### setunits(self, units)

Sets the units of the public representation, and converts the publically visible value to those units
Parameters:
`units` - radians, arcsec, or degrees
(type=string)
Returns:
None

### _calcinternal(self)

Sets the internal representation
Returns:
None
Raises:
`ValueError` - if units are not rad|arcsec|degrees

Instance Variable Details

### units

units in which the magnitude is expressed (arcsec, degrees, or radians)
Type:
string

### value

magnitude of the angular separation
Type:
number

### _internal

internal representation of the separation
Type:
number (degrees)

 Generated by Epydoc 2.1 on Mon Feb 12 15:01:04 2007 http://epydoc.sf.net