-
Notifications
You must be signed in to change notification settings - Fork 2
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
Further listification of Monte Carlo iteration #194
Merged
Merged
+752
−640
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading status checks…
to merge basic and Monte Carlo usage (for now) * similarly, use new idiom for kcorr_and_absmag without trying to merge for now * fix bug in moment Monte Carlo -- was using moment1, rather than moment1_monte, to generate moment2 and moment3 * avoid typing variable names multiple times when using list comprehension idiom -- typos can cause silent bugs!
Loading status checks…
put these uses together with setting the boxflux variance
Loading status checks…
rather than earlier in the code * don't replicate parameters that are the same in every call to Monte Carlo iteration
to remove redundant code and collect operations in one place * minor cleanup of moments Monte Carlo * don't pass redundant values to test_broad() * fix debug printing for getlines()
Loading status checks…
…nto monte-list (pull in latest fixes from John)
…code * admit that optimize() returns its input linemodel after modifying it in place. Make a copy in Monte Carlo to avoid need for copies elsewhere in the code.
Loading status checks…
* use 'obsamps' instead of 'obsamp' consistently * simplify line selection in moments code
Loading status checks…
…nte-list
Loading status checks…
…ions (but it's probably not worth trying to deduplicate the code given the number of things we'd have to return from a common function)
Loading status checks…
…nto monte-list to sync with John's latest changes
Thanks again for the contributions @jdbuhler. The long-term maintainability is significantly improved with this PR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extend the use of the new list idiom for Monte Carlo to the operations in emlines, and to kcorr_and_absmag. We have not yet merged the base operations with their Monte Carlo versions, as in our previous PR, because there are some issues with divergent flow control that need to be reviewed first. But this change does simplify several uses of Monte Carlo and avoids having to rename a bunch of local variables in duplicated code. The merge operations desired in the future are marked with FIXME comments.
Speaking of renaming variables, use an abbreviated idiom for the actual list comprehensions that avoids retyping the names of the variables used in each Monte Carlo iteration, since typos in these names can lead to hard-to-find bugs. Advice: always use new names for the items being iterated over when passing them to the Monte Carlo function.
NB: this change incidentally fixes a bug in Monte Carlo computation of moments.