Skip to content

Correction to frame standardization - #704

Open
sedonaprice wants to merge 2 commits into
astropy:mainfrom
sedonaprice:bugfix-range-frame-standardization
Open

Correction to frame standardization#704
sedonaprice wants to merge 2 commits into
astropy:mainfrom
sedonaprice:bugfix-range-frame-standardization

Conversation

@sedonaprice

Copy link
Copy Markdown
Contributor

Fixes #703.

Changes the method SphericalSkyRegion._standardize_frame(), to return an instance, not a frame, and to first check if the frame is already an instance of BaseCoordinateFrame.

Test case for that issue now works as expected:

from astropy import units as u
from regions import RangeSphericalSkyRegion

reg1 = RangeSphericalSkyRegion(
    frame="icrs",
    latitude_range=[0 * u.deg, 1 * u.deg],
)
reg2 = RangeSphericalSkyRegion(
    frame="icrs",
    latitude_range=[0.5 * u.deg, 1.5 * u.deg],
)
reg1 & reg2

returns

<CompoundSphericalSkyRegion(region1=Region: RangeSphericalSkyRegion
frame: icrs
longitude_range: None
latitude_range: [<Quantity 0. deg>, <Quantity 1. deg>], region2=Region: RangeSphericalSkyRegion
frame: icrs
longitude_range: None
latitude_range: [<Quantity 0.5 deg>, <Quantity 1.5 deg>], operator=<built-in function and_>)>

Change to return an instance, not a frame, and to check if the frame is already an instance of BaseCoordinateFrame.
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.

BUG: RangeSphericalSkyRegion frame isn't correct, so compound regions with range fail

1 participant