Evaluating N orbits at N times in monte carlo simulations #664
mahollands
started this conversation in
General
Replies: 1 comment 4 replies
-
I don't think there's a better way than a list comprehension to do this currently. I don't think it's that clunky and I'm surprised it's that slow. Is it slow to just list-comprehend |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm doing some Monte Carlo simulations for orbits within the MW. The time of flight is a free parameter in my model. So for each orbit there is a corresponding time value to evaluate at. However, using the
Orbit.SkyCoord
method evaluates all orbits at all times, and so returns a SkyCoord object with dimensions N^2. Of course, with few orbits/timestamps, I can just useSkyCoord.diagonal()
, but for larger numbers of samples, the SkyCoord takes a long time to evaluate and uses a lot of memory. I have tried doing a list comp over the orbits and time array, which solves the O(N^2) memory issue, but this is clunky and also very slow.Is there a better way to do this, or could one be added (e.g. have a
broadcast_t
argument inOrbit.SkyCoord
)?Beta Was this translation helpful? Give feedback.
All reactions