Skip to content

Feature/mesh refactor#217

Merged
Jammy2211 merged 40 commits intomainfrom
feature/mesh_refactor
Feb 20, 2026
Merged

Feature/mesh refactor#217
Jammy2211 merged 40 commits intomainfrom
feature/mesh_refactor

Conversation

@Jammy2211
Copy link
Owner

@Jammy2211 Jammy2211 commented Feb 19, 2026

This pull request primarily updates mesh and mapper imports to reflect new module locations. It moves modules from structures/mesh to pixelization/mesh_grid and makes mesh geometry a property of a Mapper, whereas before it was set up and passed through the source code.

This, in turn, means the MapperGrids object is removed and going from a mesh (e.g. a RectangularAdaptDensity to a mapper (e.g. MapperRectangular) is more streamlined, using mesh.mapper_from(). This replaces the mapper factory.

It also refactors how the Settings object is imported and used throughout the inversion modules, replacing the older SettingsInversion import and default construction with a unified Settings class from the top-level settings module. Additionally, it

Refactoring and Unification of Settings:

Mesh and Mapper Import Updates:

  • Updated mesh and mapper imports in autoarray/__init__.py to use new module paths under inversion.pixelization.mesh_grid, removing old imports from structures.mesh.

Fixture and Test Utility Simplification:

  • Refactored fixture functions in autoarray/fixtures.py to use the new mesh and mapper interfaces, removing outdated or redundant functions, and consolidating the creation of mesh grids and mappers for tests. [1] [2] [3]

Configuration Cleanup:

  • Removed the unused positive_only_uses_p_initial option from the inversion section of the configuration file general.yaml.

These changes modernize and standardize the configuration and mesh handling interfaces, making the codebase easier to maintain and extend.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the Settings and mesh/mapper infrastructure in autoarray by consolidating the SettingsInversion class into a unified Settings class, relocating mesh-related modules from structures/mesh to inversion/pixelization/mesh_grid, and modernizing the mapper creation interface from mapper_grids_from to mapper_from.

Changes:

  • Unified settings management by replacing SettingsInversion with Settings throughout the codebase
  • Relocated mesh grid classes from structures.mesh to inversion.pixelization.mesh_grid
  • Refactored mapper creation to use mapper_from method with direct parameter passing instead of MapperGrids wrapper
  • Removed unused configuration options (positive_only_uses_p_initial, tolerance, maxiter)
  • Updated test fixtures and test files to use new interfaces

Reviewed changes

Copilot reviewed 75 out of 78 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
autoarray/settings.py Renamed from SettingsInversion to Settings, removed positive_only_uses_p_initial, tolerance, and maxiter parameters
autoarray/__init__.py Updated imports to reference new mesh_grid module locations, removed old mesh and mapper_grids imports
autoarray/fixtures.py Refactored fixtures to use new mapper creation interface; contains critical bugs in make_delaunay_mesh_grid_9
autoarray/inversion/pixelization/mesh_grid/*.py New location for mesh grid classes (Mesh2DRectangular, Mesh2DDelaunay) with updated constructors
autoarray/inversion/pixelization/mappers/*.py Updated mappers to accept individual parameters instead of MapperGrids object
autoarray/inversion/inversion/*.py Updated all inversion classes to use Settings instead of SettingsInversion
test_autoarray/inversion/regularizations/*.py Updated tests to create mesh geometry objects directly
test_autoarray/inversion/pixelization/*.py Tests reorganized and updated to use new mesh_grid module locations
autoarray/config/general.yaml Removed positive_only_uses_p_initial configuration option
Comments suppressed due to low confidence (1)

autoarray/init.py:81

  • Duplicate imports detected: Mesh2DRectangular and Mesh2DDelaunay are imported twice from the same module (inversion.pixelization.mesh_grid.rectangular and inversion.pixelization.mesh_grid.delaunay). The imports appear on lines 43-44 and again on lines 80-81.

While Python will handle this gracefully (the second import will simply overwrite the first), it's redundant and can cause confusion. Remove one set of these imports.

from .inversion.pixelization.mesh_grid.rectangular import Mesh2DRectangular
from .inversion.pixelization.mesh_grid.delaunay import Mesh2DDelaunay

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Jammy2211 Jammy2211 changed the base branch from feature/knn_mesh to main February 20, 2026 17:39
@Jammy2211 Jammy2211 merged commit 8d930a7 into main Feb 20, 2026
8 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