skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.38k stars 208 forks source link

`VectorFunction.at()`: docstring allows for `t` to be a list of times, but the method only allows a single `Time` object #855

Closed nic-planet closed 1 year ago

nic-planet commented 1 year ago

I believe there's a discrepancy between the doc-string and the method's functionality.

    def at(self, t):
        """At time ``t``, compute the target's position relative to the center.

        If ``t`` is an array of times, then the returned position object
        will specify as many positions as there were times.  
        ...
        """
        if not isinstance(t, Time):
            raise ValueError('please provide the at() method with a Time'
                             ' instance as its argument, instead of the'
                             ' value {0!r}'.format(t))

I wonder if this is maybe indicating ongoing work to make at() accept more than one time, or if there's an alternative way to achieve the same without calling at several times?

brandon-rhodes commented 1 year ago

Could you share some example code testing it with a time array so that we can see the result? The Skyfield docs should explain how to create a time array in case you don't already have one.

https://rhodesmill.org/skyfield/time.html

nic-planet commented 1 year ago

Oh ok. I did not find this documentation, instead was looking at the VectorFunctions docs and the section specific to satellite position https://rhodesmill.org/skyfield/earth-satellites.html. So I assumed I needed to pass on a Python list of Time objects and was not aware that a single Time object can hold an array of dates.

So mostly a "me" problem, but would it be worth I create a doc MR with a pointer from the satellite section to the time section?

brandon-rhodes commented 1 year ago

So mostly a "me" problem, but would it be worth I create a doc MR with a pointer from the satellite section to the time section?

I've been thinking about your question, and I think that it would be easier for you to suggest where in the docs the pointer might fit best; then I can quickly add it without your having to try jumping into documentation writing yourself.

Should maybe the first example in the doc of getting a position then show getting n positions from n times?

nic-planet commented 1 year ago

OK that's even better - and I think having an example with n positions would be exactly the way to point people into the right direction.