clean up discmodel basics#3
Merged
michael-petersen merged 4 commits intoJul 1, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR cleans up and hardens the discmodel package with a focus on reproducibility and more robust handling of optional dependencies, while also simplifying packaging/test configuration.
Changes:
- Refactors
DiscGalaxyinitialization to use an instance-provided seed instead of reseeding NumPy’s global RNG. - Expands/adjusts tests around optional dependencies (
flex,lintsampler) and adds a regression test to ensure initialization doesn’t reset global RNG state. - Packaging/config cleanup: simplified
setup.py, adjustedpytest.iniimport path behavior, and improved version fallback in__init__.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_optional_imports.py | Adds direct tests for optional import check helpers (but current monkeypatching logic introduces recursion). |
| tests/test_discmodel.py | Adds pytest usage, validates phasespace init N, adds RNG non-interference test, and skips optional-dependency tests when deps are missing. |
| src/discmodel/discmodel.py | Adds seed parameter and uses an instance RNG for initial sampling; improves error handling in make_expansion; removes dead/commented code. |
| src/discmodel/init.py | Makes __version__ robust when package metadata isn’t available (e.g., source checkout). |
| setup.py | Switches to declarative setuptools configuration by calling setup() with no args. |
| pytest.ini | Ensures src is on pythonpath for tests. |
| pyproject.toml | Updates the project homepage URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
michael-petersen
merged commit Jul 1, 2026
bd8624d
into
ObservationalExpansions:main
17 of 19 checks passed
This file contains hidden or 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
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.
This pull request introduces several improvements to the
discmodelpackage, focusing on reproducibility, improved test coverage, and code cleanup. The most significant change is the refactoring of random number generation inDiscGalaxyto use an instance-specific random seed, ensuring reproducible results without affecting global random state. Additional enhancements include more robust error handling, expanded tests for optional dependencies, and various code and configuration cleanups.