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

Optional integrate #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Optional integrate #1

wants to merge 7 commits into from

Conversation

KatKiker
Copy link

@KatKiker KatKiker commented Oct 7, 2024

Fixes # .

Adds a config parameter ar_use_integrate that uses the rebound integrate method instead of assist's integrate_and_interpolate. This is important for accuracy for close approaches and fast movers.

Review Checklist for Source Code Changes

  • Does pip install still work?
  • Have you written a unit test for any new functions?
  • Do all the units tests run successfully?
  • Does Sorcha run successfully on a test set of input files/databases?
  • Have you used black on the files you have updated to confirm python programming style guide enforcement?

Copy link

@akoumjian akoumjian left a comment

Choose a reason for hiding this comment

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

Unfortunately because of the way they structured this, it looks like it requires drilling down the option to the lower level function. I would recommend instead of extracting use_integrate and pushing it down, I would update all those functions to take the config object instead. Then inside integrate_light_time, look for the ar_use_integrate option and use it.

At least then it's not a single option being passed down but a config. I would put in your final PR that they could also consider creating a global CONFIG which could be accessed without passing it down, or moving to a class based structure so it can be referenced via self.

@KatKiker
Copy link
Author

KatKiker commented Oct 8, 2024

Unfortunately because of the way they structured this, it looks like it requires drilling down the option to the lower level function. I would recommend instead of extracting use_integrate and pushing it down, I would update all those functions to take the config object instead. Then inside integrate_light_time, look for the ar_use_integrate option and use it.

At least then it's not a single option being passed down but a config. I would put in your final PR that they could also consider creating a global CONFIG which could be accessed without passing it down, or moving to a class based structure so it can be referenced via self.

Can do! I wasn't sure which would be preferable to them, passing through the entire config or extracting just the value that was needed.

@KatKiker
Copy link
Author

KatKiker commented Oct 8, 2024

Unfortunately because of the way they structured this, it looks like it requires drilling down the option to the lower level function. I would recommend instead of extracting use_integrate and pushing it down, I would update all those functions to take the config object instead. Then inside integrate_light_time, look for the ar_use_integrate option and use it.

At least then it's not a single option being passed down but a config. I would put in your final PR that they could also consider creating a global CONFIG which could be accessed without passing it down, or moving to a class based structure so it can be referenced via self.

The benefit of passing just the use_integrate value is that it can be set to a default, meaning none of the tests or other instances of the function being called need to be updated. I'm not sure the same can be said for passing config. (That is to say- I feel like setting config as Optional (default None presumably) could be confusing and possibly messy, but maybe that's just what needs to happen. Alternatively, if not optional, then it would be a breaking change)

@akoumjian
Copy link

akoumjian commented Oct 8, 2024

A less than ideal option would be that the config value sets an os.environ value and we read that environment variable in during the function that calls assist.

That might be the least instrusive...

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