Open mbmccoy opened 1 year ago
I have just a few minutes today to look at this issue, so I've not yet reached a conclusion, but wanted to at least add a note that this is an interesting idea, and I will ponder whether it might be added in the future. I'm a bit dismayed already by the amount of code that the array feature forced into the codebase, so my first reaction is to not want to add more. I wonder if this could be added as an additional case handled by the existing loop, or whether it really requires an additional copy of the loop logic. Now I kind-of wish that I had looked into NumPy array broadcasting as the native approach here, since then users could select the behavior they want by either having their date array have shape (1, N,)
, in which case a convolution with a satellite array of dimension M
would produce the same M×N
product that's returned today, but a shape (M,)
would have broadcast naturally by assigning one date to each satellite.
Maybe the library could switch to that approach under the covers, then also keep offering the current API as a wrapper around it.
I'd like implement an additional API for "zipped" parallel computation with the SatrecArray. The current computation uses the "outer product" of the Satrecs and the julian dates, generating a total of
len(satrec_array) * len(jds)
state vectors. This is not efficient if when want each Satrec propagated to a different time, e.g., we want to computeOur options for this use case are:
The changes required to implement a new method are fairly minimal and I'd be happy to make a PR. Basically, I propose that we have a new API on
SatrecArray
. In the python version, it would look like this:As you can see, the code above is almost identical to the existing code in
model.py
. I believe it's similarly easy to add a method towrapper.cpp
to support this API.Feedback requests
In light of this, I'd like feedback on the following:
sgp4_zip
? I'm not super fond of it, but I'm having trouble thinking of a better one. Perhapssgp4_vectorized
, but that's a little overloaded since both methods onSatrecArray
are vectorized.sgp4/__init__.py
for documentation,sgp4/model.py
for python implementation,sgp4/tests.py
for tests,sgp4/wrapper.py
for delegation to the C-implementation, and finallyextension/wrapper.cpp
for the C-implementation itself. Is there anything else to be done?Thanks in advance.