Skip to content

Commit

Permalink
Fix precision issues in the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed Jul 1, 2024
1 parent 38b7ffd commit 81b1b2e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ d) Other time and position related attributes and methods
... Latitude,
... Galactic)
>>> from astropy.time import Time
>>> from astropy.units import Quantity
>>> # Create a couple sources near zenith
>>> array_location = EarthLocation(lat="-30d43m17.5s", lon="21d25m41.9s", height=1073.0)
Expand All @@ -1191,14 +1192,15 @@ d) Other time and position related attributes and methods
>>> sm.update_positions(time, array_location)
>>> print(sm.time)
2015-03-01 00:00:00.000
>>> print(sm.telescope_location)
(5109342.76037543, 2005241.90402741, -3239939.46926403) m
>>> with np.printoptions(precision=3):
... print(Quantity(sm.telescope_location.geocentric).to_value("m"))
[ 5109342.76 2005241.904 -3239939.469]
>>> # Limit the precision for testing on different platforms
>>> with np.printoptions(precision=3):
>>> with np.printoptions(precision=2):
... print(sm.alt_az)
[[1.571 1.396]
[1.73 0.175]]
[[1.57 1.4 ]
[1.73 0.17]]
>>> # Can directly access direction cosines of the sources
>>> with np.printoptions(precision=1):
Expand Down

0 comments on commit 81b1b2e

Please sign in to comment.