Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default sun position method to accurate and other minor improvements #36

Merged
merged 7 commits into from
Dec 7, 2023

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Nov 26, 2023

Description

With the speed improvements in sot/chandra_aca#162, it is now reasonable to use the "accurate" Sun position method as the default. The "accurate" method is only 60% slower than "fast", but end-to-end the attitudes() function and kadi states generation is still a factor of 2 faster than current flight.

The pitch, nominal_roll and off_nominal_roll functions now have a method kwarg to specify the sun position method.

This PR also improves a number of docstrings and converts them to numpydoc format.

Required dependent PRs

Interface impacts

position_at_jd was renamed to position_fast_at_jd to clarify that this function does not respect the sun_position_method_default configuration value.

Testing

Changes the position_at_jd function name to position_fast_at_jd. The former name was misleading and I lost some time because of thinking it would compute accurace positions.

Unit tests

  • Mac
(ska3-perf) ➜  ska_sun git:(fast-and-accurate) git rev-parse HEAD                          
e24c81774ad938ef2b158f8dfc15e423139dc534
(ska3-perf) ➜  ska_sun git:(fast-and-accurate) pytest
=============================================== test session starts ===============================================
platform darwin -- Python 3.10.8, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/aldcroft/git, configfile: pytest.ini
plugins: timeout-2.1.0, anyio-3.6.2
collected 16 items                                                                                                

ska_sun/tests/test_sun.py ................                                                                  [100%]

=============================================== 16 passed in 2.31s ================================================

Independent check of unit tests by [REVIEWER NAME]

  • [PLATFORM]:

Functional tests

See the included PR36 notebook.

@taldcroft taldcroft changed the title Add sun position which combines fast and accurate methods Change default sun position method to accurate and other minor improvements Dec 2, 2023
@taldcroft taldcroft marked this pull request as ready for review December 2, 2023 13:48
@taldcroft taldcroft requested review from jeanconn and javierggt and removed request for jeanconn December 2, 2023 13:49
Copy link
Contributor

@javierggt javierggt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked the tests and the notebooks. The changes make sense to me.

While you get "just" a 60% improvement from the fast method, in my machine the slow method reliably takes about 10 times the fast one. Running the same notebook, %timeit run_func(ska_sun.position, times) takes 81 msec, and %timeit run_func(ska_sun.position_fast, times) takes 8.1 msec.

Still, I do not know what are the use cases to determine whether that is ok.

@javierggt
Copy link
Contributor

looking at it a bit better, so I compare similar methods, the following takes 81 msec in the accurate case, amd 16 msec in the fast case

%%timeit
with ska_sun.conf.set_temp("sun_position_method_default", "fast"):
    run_func(ska_sun.position, times)

so that's a factor of 5.

Still, it can be acceptable.

@taldcroft
Copy link
Member Author

@javierggt - huh. First question is whether you had all the latest branches of kadi, chandra_maneuver and chandra_aca installed. There can even be problems with chandra_maneuver and namespace borking. At this point the latest master for all of those should be good.

Beyond that, we have sunk so much into this and are so deep that we may have to accept the performance unless it is truly show-stopper.

@javierggt
Copy link
Contributor

Ah! I had the latest chandra_aca, but not the latest kadi and chandra_maneuver, so that can be it.

@taldcroft taldcroft merged commit 7b563a0 into master Dec 7, 2023
2 checks passed
@taldcroft taldcroft deleted the fast-and-accurate branch December 7, 2023 15:41
@javierggt javierggt mentioned this pull request Jan 11, 2024
@javierggt javierggt mentioned this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants