Skip to content

Commit

Permalink
bugfix: try to deal with doctest failures (on travis only?) in sat mo…
Browse files Browse the repository at this point in the history
…dule
  • Loading branch information
Benjamin Winkel committed Jul 22, 2017
1 parent 6dc3c5c commit fbd9113
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docs/protection/index.rst
Expand Up @@ -27,8 +27,8 @@ The function `~pycraf.protection.ra769_limits` returns a
`~astropy.table.Table` object that resembles (Table 1 and 2) from
`ITU-R Rec. RA.769 <https://www.itu.int/rec/R-REC-RA.769-2-200305-I/en>`_::

>>> from pycraf import protection
>>> protection.ra769_limits()
>>> from pycraf import protection # doctest: +SKIP
>>> protection.ra769_limits() # doctest: +SKIP
<Table length=21>
frequency bandwidth T_A ... Slim_nu Efield Efield_norm
MHz MHz K ... dB(W / (Hz m2)) dB(uV2 / m2) dB(uV2 / m2)
Expand Down
34 changes: 16 additions & 18 deletions docs/satellite/index.rst
Expand Up @@ -27,7 +27,7 @@ The first step to calculate a satellite's position is to obtain a so-called
.. note::

The TLEs are usually published once a day, because the contained
parameters rapidly change; drag forces cause rapid changes in the orbits
parameters quickly change; drag forces cause rapid changes in the orbits
of almost all satellites.

On most websites that offer TLEs (e.g., `Celestrak <http://celestrak.com/>`_)
Expand All @@ -39,9 +39,8 @@ in fact three-line strings are used, where the first line just contains the name
1 25544U 98067A 13165.59097222 .00004759 00000-0 88814-4 0 47
2 25544 51.6478 121.2152 0011003 68.5125 263.9959 15.50783143834295
For convenience, `~pycraf.satellite` follows this format. To calculate the
horizontal coordinates of the ISS at current time, download the current TLE
and do::
The pycraf package follows this format. To calculate the horizontal
coordinates of the ISS at a given time, download the current TLE and do::

>>> import datetime
>>> import numpy as np
Expand All @@ -59,24 +58,23 @@ and do::
>>> # create a SatelliteObserver instance
>>> sat_obs = satellite.SatelliteObserver(location)

>>> # query current time
>>> obstime = time.Time(datetime.datetime.utcnow())
>>> dt = datetime.datetime(2010, 7, 22, 8, 38, 57)
>>> obstime = time.Time(dt)

>>> sat_obs.azel_from_sat(tle_string, obstime)
(<Quantity 108.10045415963617 deg>,
<Quantity -45.48590640535226 deg>,
<Quantity 9560.504553253912 km>)
>>> az, el, dist = sat_obs.azel_from_sat(tle_string, obstime)
>>> print('az, el, dist: {:.1f}, {:.1f}, {:.0f}'.format(az, el, dist))
az, el, dist: -165.5 deg, 7.4 deg, 1713 km

>>> # can also use arrays of obstime
>>> mjd = 55123. + np.array([0.123, 0.99, 50.3])
>>> obstime2 = time.Time(mjd, format='mjd')
>>> sat_obs.azel_from_sat(tle_string, obstime2)
(<Quantity [ 28.39693587,-143.17010479, -6.97428002] deg>,
<Quantity [-43.16852656,-21.46811918,-36.77340433] deg>,
<Quantity [ 9388.29246437, 5675.03921204, 8361.28408463] km>)

.. note::

Of course, your results will differ, because the actual time has changed.
>>> az, el, dist = sat_obs.azel_from_sat(tle_string, obstime2)
>>> az
<Quantity [ 28.39693587,-143.17010479, -6.97428002] deg>
>>> el
<Quantity [-43.16852656,-21.46811918,-36.77340433] deg>
>>> dist
<Quantity [ 9388.29246437, 5675.03921204, 8361.28408463] km>

The `~pycraf.satellite.SatelliteObserver.azel_from_sat` method also accepts
a `sgp4.io.Satellite` object. This could be created by using the
Expand Down

0 comments on commit fbd9113

Please sign in to comment.