Skip to content

APE23 - PR 1: New frame and coordinate classes, and their integration - #1

Open
jeffjennings wants to merge 16 commits into
mainfrom
ape23_dataless_frames
Open

jeffjennings wants to merge 16 commits into
mainfrom
ape23_dataless_frames

Conversation

@jeffjennings

@jeffjennings jeffjennings commented Apr 7, 2026 •

Copy link
Copy Markdown
Owner

Description

This is the first PR intended to implement the changes outlined in APE23 to remove data storage (representations) from coordinate frames. The PR includes:

  • Addition of new ABC classes BaseFrame and BaseCoordinate
  • Addition of new Coordinate class, a lightweight and performant alternative to SkyCoord
  • Addition of new, data-less frame classes *Frame
  • Addition of new RepresentationFunctionTransform and RepresentationFunctionTransformWithFiniteDifference for use with data-less frames
  • Update of SkyCoord to be compatible with new classes
  • Effective deprecation (though continued support during deprecation cycle) of BaseCoordinateFrame and legacy frame classes. By 'effective' deprecation I mean they can be removed from the codebase at the end of the deprecation cycle without breaking anything for code that uses the new design.

Note that while the PR currently adds many more lines than it subtracts, once the legacy frame classes, BaseCoordinateFrame, and the temporary support for them is removed, this difference will shrink significantly.

The commits are in general progressive, grouping major changes together.

There are inline TODOs of the form "# TODO: APE23 ..." that are above code blocks that can be removed or highly simplified once the legacy frames and BaseCoordinateFrame can eventually be removed.

New class hierarchy

ABC
├── BaseFrame
│   ├── AltAzFrame
│   ├── ICRSFrame(BaseRADecFrame(BaseFrame))
│   ├── (etc.)
│
└── BaseCoordinate
    ├── Coordinate(BaseCoordinate, MaskableShapedLikeNDArray)
    └── SkyCoord(BaseCoordinate, MaskableShapedLikeNDArray)

# To be deprecated:
BaseCoordinateFrame(BaseFrame, BaseCoordinate, MaskableShapedLikeNDArray)
├── ICRS(BaseCoordinateFrame, ICRSFrame) 
├── AltAz(BaseCoordinateFrame, AltAzFrame)
└── (etc.)

Class object locations

The below shows where objects originally on SkyCoord and/or BaseCoordinateFrame have been moved, and new objects added. Comments next to each object state where it was (on SC and/or BCF) before APE changes.

Abbreviations:

BF - BaseFrame
BCF - BaseCoordinateFrame
BC - BaseCoordinate
C - Coordinate
SC - SkyCoord

1) Objects now on BC (inherited by SC and C):

# abstract methods:
frame                               # BCF, SC
data                                # BCF
transform_to                        # BCF, SC
__replace__                         # new

# properties:
frame_attributes                    # new
representation_type                 # (the getter) BCF, SC
differential_type                   # (the getter) BCF, SC
representation_component_names      # BCF
representation_component_units      # (also now on BF) BCF 
cartesian                           # BCF, SC
cylindrical                         # BCF, SC
spherical                           # BCF, SC
sphericalcoslat                     # BCF, SC
velocity                            # BCF, SC
proper_motion                       # BCF, SC
radial_velocity                     # BCF, SC
mask                                # SC
masked                              # BCF, SC
size                                # new

# functions:
get_mask                            # BCF, SC
get_representation_component_names  # (also added to BF) BCF
get_representation_component_units  # (also added to BF) BCF
represent_as                        # BCF
is_transformable_to                 # BCF, SC
is_equivalent_frame                 # BCF, SC
position_angle                      # BCF, SC
separation                          # BCF, SC
separation_3d                       # BCF, SC
spherical_offsets_to                # SC
spherical_offsets_by                # SC
directional_offset_by               # SC
to_string                           # SC
to_table                            # (SC wraps) BCF, SC

_prepare_unit_sphere_coords         # SC
_apply_to_frame                     # new 
_data_repr                          # BCF 
_get_frame_props                    # new 

register_property                   # new 

__eq__                              # BCF, SC
__ne__                              # BCF, SC
__dir__                             # BCF, SC

2) Objects now on C:

frame                               # (abstract from BC) BCF, SC
data                                # (abstract from BC) BCF, SC
transform_to                        # (abstract from BC) BCF, SC
__replace__                         # (abstract from BC) new

shape                               # BCF, SC

_apply                              # (also on SC; different implementation) BCF, SC
__repr__                            # (also on SC; different implementation) BCF, SC
__getattr__                         # (also on SC; different implementation) BCF, SC

3) Objects added or moved to SC:

__replace__                         # (abstract from BC) new
realize_frame                       # (still on BCF for legacy frames) BCF
replicate                           # (still on BCF for legacy frames) BCF
replicate_without_data              # (raises NotImplementedError; still on BCF for legacy frames) BCF

cache                               # BCF
is_frame_attr_default               # (wraps version on BF) BCF

4) Objects now on BF (handling frame metadata):

get_representation_cls              # BCF
set_representation_cls              # BCF
get_representation_component_names  # BCF
get_representation_component_units  # BCF
representation_component_names      # BCF
representation_component_units      # BCF
representation_info                 # BCF

representation_type                 # (getter) BCF
differential_type                   # (getter) BCF

is_equivalent_frame                 # BCF
is_transformable_to                 # BCF
is_frame_attr_default               # BCF
get_frame_attr_defaults             # BCF (classmethod)

transform_data_to                   # new
  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant