Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Make propagation faster #16

Open
astrojuanlu opened this issue Oct 3, 2020 · 1 comment
Open

Make propagation faster #16

astrojuanlu opened this issue Oct 3, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@astrojuanlu
Copy link

Hi! I'm the creator and lead developer of poliastro, one of spacetech-ssa dependencies. I am thrilled to see it being used in this project 😍

I noticed that predict_orbit is using .apply on a function that repeatedly calls the cowell method for a given value of elapsed_seconds:

def _propagate_orbit(elapsed_seconds):
"""Propagates the closed over orbit into the future by
`elapsed_seconds` and returns the resulting state vector
of the new orbit with the position measured in meters and the
velocity measured in meters per second.
:param elapsed_seconds: The number of seconds into the future to
propagate the orbit to
:type elapsed_seconds: float
:return: The 6 element state vector of the propagated orbit
:rtype: pd.Series
"""
prop_orbit = orbit.propagate(elapsed_seconds*u.s,
method=cowell,
ad=J2_perturbation,
J2=Earth.J2.value,
R=Earth.R.to(u.km).value)

future_rows[physics_cols] = future_rows.elapsed_seconds.apply(orbit_propagator)

Instead of using Orbit.propagate, poliastro.twobody.propagation.propagate offers a lower level interface that accepts an array of times, and calls the propagator in a tight loop:

https://docs.poliastro.space/en/stable/api/safe/twobody/propagation.html#poliastro.twobody.propagation.propagate

This is just some low hanging fruit I noticed while skimming at the code, but there are probably other things that could be optimized, some of which are already in our roadmap. Would be happy to collaborate with the project :)

@calstad
Copy link
Contributor

calstad commented Oct 23, 2020

@astrojuanlu Thanks for the tip and thank you for creating poliastro. Sorry I let this issue fall through the cracks! I will take a look soon at your suggestion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants