Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors the cosmology module in the autogalaxy package to support JAX and remove the dependency on astropy. The changes improve the time delay calculation by using explicit unit conversions (kpc) and supporting array backends (CPU/GPU) via the xp parameter.
Changes:
- Updated cosmology imports from
autogalaxy.cosmology.wraptoautogalaxy.cosmology.model - Removed references to "AstroPy" from docstrings across multiple files
- Refactored time delay calculation to use kpc units and explicit SI constants for better clarity and JAX compatibility
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| autolens/analysis/analysis/lens.py | Updated import statement to use new cosmology module path |
| autolens/analysis/analysis/dataset.py | Updated docstring to remove AstroPy reference |
| autolens/lens/tracer.py | Updated docstrings to remove AstroPy references (2 locations) |
| autolens/lens/tracer_util.py | Major refactor of time delay calculation with improved clarity, JAX support via xp parameter, and proper unit handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 refactors the cosmology module in the
autogalaxypackage, with full support for JAX and removing the use ofastropy.This means all cosmology calculations, such as angular diameter distances, are computing use code written in the source code and not computed via
astroypy. This makes JAX integration easier and makes the code more lightweight by not needing astropy.It removes the legacy
lensing.pyandwrap.pyfiles, consolidates cosmology-related classes intomodel.py, and updates all references throughout the codebase. The configuration YAML has also been streamlined to use new cosmology class names. Additionally, a calculation inconvert.pyis improved for clarity and efficiency.Cosmology import and docstring updates:
autolens/analysis/analysis/lens.pyfromautogalaxy.cosmology.wraptoautogalaxy.cosmology.modelforPlanck15.Time delay calculation refactor:
time_delays_fromfunction inautolens/lens/tracer_util.pyto:xpfor GPU/CPU compatibility.API consistency improvements:
xparray backend parameter to the angular diameter distance function in the ray-tracing utility.