pleiszenburg / hapsira

hapsira - :rocket: Astrodynamics in Python - a poliastro fork
https://hapsira.readthedocs.io
MIT License
22 stars 1 forks source link

Documentation issue on Hapsira Quickstart #13

Open cjpascoa opened 3 weeks ago

cjpascoa commented 3 weeks ago

First of all: Thank you for your work.

The issue is in "Studying trajectories: Ephem objects -->"

🐞 TypeError: time_range() takes 1 positional argument but 2 were given

The following code gives the previous error -->

from hapsira.twobody.sampling import EpochsArray, TrueAnomalyBounds, EpochBounds from hapsira.util import time_range from astropy.time import Time

start_date = Time("2022-07-11 05:05", scale="utc") end_date = Time("2022-07-11 07:05", scale="utc")

One full revolution

ephem1 = iss.to_ephem()

Explicit times given

ephem2 = iss.to_ephem(strategy=EpochsArray(epochs=time_range(start_date, end_date)))

Automatic grid, true anomaly limits

ephem3 = iss.to_ephem(strategy=TrueAnomalyBounds(min_nu=0 << u.deg, max_nu=180 << u.deg))

Automatic grid, epoch limits

ephem4 = iss.to_ephem(strategy=EpochBounds(min_epoch=start_date, max_epoch=end_date)).

πŸ’‘ Possible solutions

It looks like the function "time_range" should be called with one parameter -->

cjpascoa commented 3 weeks ago

Further on I checked the function on hapsira.util

hapsira.util.time_range(start, *, num_values=50, spacing=None, end=None, format=None, scale=None)ΒΆ

Generates range of astronomical times.
New in version 0.8.0.
Parameters:
        start ([Time](https://docs.astropy.org/en/stable/api/astropy.time.Time.html#astropy.time.Time) or [Quantity](https://docs.astropy.org/en/stable/api/astropy.units.Quantity.html#astropy.units.Quantity)) – Start time.
        num_values ([int](https://docs.python.org/3/library/functions.html#int), optional) – Number of equal spaced time values to be generated, default to 50.
        spacing ([Time](https://docs.astropy.org/en/stable/api/astropy.time.Time.html#astropy.time.Time) or [Quantity](https://docs.astropy.org/en/stable/api/astropy.units.Quantity.html#astropy.units.Quantity), optional) – Spacing between periods, optional.
        end ([Time](https://docs.astropy.org/en/stable/api/astropy.time.Time.html#astropy.time.Time) or equivalent, optional) – End date.
Returns:
    result – Array of time values.
Return type:
    [Time](https://docs.astropy.org/en/stable/api/astropy.time.Time.html#astropy.time.Time)