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

Making n sub intervals a config class parameter #1090

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

Conversation

Little-Ryugu
Copy link
Collaborator

Fixes #1079.

Changed n_sub_intervals in simulation_driver.py to be a config class parameter in simulationConfigs

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?

Made n_sub_intervals an attribute for simulationConfigs and updated unit tests to include it.
@Little-Ryugu Little-Ryugu requested a review from mschwamb January 10, 2025 16:04
@@ -111,6 +114,7 @@ def _validate_simulation_configs(self):
self.ar_fov_buffer = cast_as_float(self.ar_fov_buffer, "ar_fov_buffer")
self.ar_picket = cast_as_int(self.ar_picket, "ar_picket")
self.ar_healpix_order = cast_as_int(self.ar_healpix_order, "ar_healpix_order")
self.n_sub_intervals = cast_as_int_or_set_default(self.n_sub_intervals, "n_sub_intervals", 101)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why can't you just do
self.n_sub_intervals = 101 # we set this to a default 101?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@matthewholman any particular reason we hide the n_sub_intervals from the configuration file but all the healpix order to be changed?

Copy link
Collaborator

@mschwamb mschwamb Jan 10, 2025

Choose a reason for hiding this comment

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

With the latest updates we can expose to the user which is how @Little-Ryugu is implementing it but it would default to 101? If we keep it this way, @Little-Ryugu I don't think you need a new function is there a way to use cast_as_int or check if it's none (like the trailing loss flag which is only sometimes used) and then set the value to the default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no reason to hide that from the user, as long as there is a default value.

Copy link
Collaborator

@mschwamb mschwamb Jan 10, 2025

Choose a reason for hiding this comment

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

what is this parameter so I can add it to the documentation @matthewholman ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was afraid you would ask. That is the number of sub-intervals used in evaluating a Lagrange interpolation function to make sure fast-movers are not missed. It's pretty arbitrary.

@@ -111,6 +114,7 @@ def _validate_simulation_configs(self):
self.ar_fov_buffer = cast_as_float(self.ar_fov_buffer, "ar_fov_buffer")
self.ar_picket = cast_as_int(self.ar_picket, "ar_picket")
self.ar_healpix_order = cast_as_int(self.ar_healpix_order, "ar_healpix_order")
self.n_sub_intervals = cast_as_int_or_set_default(self.n_sub_intervals, "n_sub_intervals", 101)
Copy link
Collaborator

@mschwamb mschwamb Jan 10, 2025

Choose a reason for hiding this comment

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

To keep the same format. I'd make the variable ar_n_sub_intervals

Copy link
Collaborator

@mschwamb mschwamb Jan 10, 2025

Choose a reason for hiding this comment

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

(edited above to fix my typo)

Copy link
Collaborator

@mschwamb mschwamb left a comment

Choose a reason for hiding this comment

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

Some suggestions depending on what @matthewholman prefers

Renamed n_sub_intervals to ar_n_sub_intervals and set it's default value at the start instead of None. Also added the parameter to the log.
Copy link
Collaborator

@mschwamb mschwamb left a comment

Choose a reason for hiding this comment

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

Looks good to me

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.

deal with this comment or make n_sub_intervals a config class parameter
3 participants