Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions coordinates_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import print_function
Expand Down Expand Up @@ -267,6 +267,11 @@ def string(self, unit=DEGREE, decimal=False, sep=" ", precision=5, pad=False):
c = HorizontalCoordinates(alt, az, epoch=timeobj)


# Coordinates located on the Earth (for instance, the location of an observatory)
# can also be represented.
c = LatitudeLongitude(lat, lon)


# Coordinate Factory
# ------------------
'''
Expand Down Expand Up @@ -335,6 +340,21 @@ class CustomCoordinate(BaseCoordinate):
mycoord2 = c.convert_to(CustomCoordinate)


# Conversions from celestial to horizontal
# ----------------------------------------
#
# It is possible to convert to alt/az if one does specify a location and time.

kpno = LatitudeLongitude(31.9583, -111.5967, unit=(u.degree, u.degree))
obstime = astropy.time.Time('2014-01-15 01:02:03', scale='utc')
altaz = c.convert_to(HorizontalCoordinate, location=kpno, time=obstime)

# Because the above conversion is a particularly common one, there is
# a more convenient syntax as well:

altaz = c.observe_from(kpno, obstime)


# Separations
# -----------
'''
Expand Down Expand Up @@ -419,4 +439,4 @@ class CustomCoordinate(BaseCoordinate):

# CartesianPoint objects can be added and subtracted, which are vector/elementwise
# they can also be given as arguments to a coordinate system
csum = ICRSCoordinates(c1.cartesian + c2.cartesian)
csum = ICRSCoordinates(c1.cartesian + c2.cartesian)