Skip to content

moon_phase_angle slow for large time arrays #211

Closed

Description

@kvyh

I found that when I tried to use MoonIlluminationConstraint when scheduling, it was very slow. When running a profiler on the code, I found that for an array of 90 times:
moon_coord = get_moon(...).transform_to(altaz_frame) took 26 seconds
sun_coord = get_sun(t).transform_to(altaz_frame) took 7 seconds
sun_coord.separation(moon_coord) took 9 seconds.

The information is cached (so it only has to do this once for all targets), but it takes nearly .5 seconds per time which adds up for large time ranges and fine time resolutions. Is there a way to speed this up while retaining precision? Otherwise, for finer time resolutions it may be beneficial to have an interpolation method so that only a fraction of the times need to be calculated.

Activity

  1. reopened this on Aug 5, 2016
  2. kvyh commented on Aug 5, 2016

    @kvyh
    ContributorAuthor

    #213 solves part of the problem, but MoonIlluminationConstraint still calls Observer.moon_altaz which didn't get changed in it.

  3. StuartLittlefair commented on Feb 9, 2017

    @StuartLittlefair
    Contributor

    This is fixed in #286 and #285.

    Benchmarking on #286 I find that for 100 times:

    moon_coord = get_moon(...).transform_to(altaz_frame) takes 461 ms
    illumination = np.array(moon_illumination(times)) takes 344 ms

    the total call to evaluate a MoonIlluminationConstraint for 100 times and a scalar target is 780ms. For two targets the vectorisation in the above PRs means it still only takes 811 ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions