Should/could I be using NumPy? #800
Replies: 1 comment
-
I am not sure whether it would be easy to convince NumPy to run efficient operations over different bodies. Skyfield can be efficient with an array of times because each planet has a big array of positions, and Skyfield can have NumPy produce 100 positions with no more Python code than producing 1 position—so the only additional expense of the 99 more positions is the floating point math that's kicked off, which is a fast set of operations when compared to running further Python code. But two different planets have two different time-indexed arrays that aren't lined up next to each other in memory in a way that would make them easy to traverse—in fact they probably have different step sizes, since fast planets with tight orbits store more data points than slow planets with big lazy orbits. But maybe there's some way I'm not thinking of that would let n planets be pre-broadcast into some kind of common array that would then only need to be operated on once? I'm open to ideas, and I know that there are folks with much more NumPy experience! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I initially wrote my
Python
program callingPyEphem
to compute the rise/set/azimuth/altitude for planets/minor planets/comets/stars/satellites. The process is very simple, for example, for planets (in pseudocode):Ditto for the other bodies.
Along comes
Skyfield
and I abstract so that I can switch to run eitherPyEphem
orSkyfield
. At no time have I usedNumPy
; never needed it and was completely oblivious, particularly givenSkyfield
was rapidly becoming functionally closerPyEphem
. After reading this comment I wondered if there's a better way to write my code when callingSkyfield
, particularly if I'm looping over bodies at the same date/time (and lat/long/elev).Rather than pass each body (of the same type) one by one, instead, somehow, pass in a list of bodies (with or without the help of
NumPy
). I have seen mention of using multiple date/times within a singleTime
object, but this is the opposite to what I want: multiple objects for a given date/time.Beta Was this translation helpful? Give feedback.
All reactions