Skip to content

clean up discmodel basics#3

Merged
michael-petersen merged 4 commits into
ObservationalExpansions:mainfrom
michael-petersen:main
Jul 1, 2026
Merged

clean up discmodel basics#3
michael-petersen merged 4 commits into
ObservationalExpansions:mainfrom
michael-petersen:main

Conversation

@michael-petersen

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements to the discmodel package, focusing on reproducibility, improved test coverage, and code cleanup. The most significant change is the refactoring of random number generation in DiscGalaxy to 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.

Copilot AI review requested due to automatic review settings July 1, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 DiscGalaxy initialization 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, adjusted pytest.ini import 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.

Comment thread tests/test_optional_imports.py
Comment thread tests/test_optional_imports.py
Comment thread tests/test_optional_imports.py
Comment thread tests/test_optional_imports.py
Comment thread src/discmodel/discmodel.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread setup.py
Comment thread src/discmodel/discmodel.py
Comment thread src/discmodel/discmodel.py
@michael-petersen
michael-petersen merged commit bd8624d into ObservationalExpansions:main Jul 1, 2026
17 of 19 checks passed
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