Merged
Conversation
…lly by setup and docs; fixed typo in import
…ng a region and clearing all regions.
…terpreted as pixels. Removed option to set coordinate system in set_center; this must now be done separately. Updated docstrings and tests. Number validator no longer matches numeric strings.
…ses. Refactored region class hierarchy.
…d inconsistent line region size functions
Collaborator
Author
|
@kswang1029 I'm going to go through your comments in more detail, but briefly:
|
…l needs end-to-end testing.
…center for polygons and polylines
…s type entirely (iteraing over the types should only return supported types)
…pling) for rectangle and line. TBD: functions for creating polygons like this from the start; unit tests
…ode center for polylines and polygons. Implemented rotation and translation methods for consistency. Cleaned up unhelpful use of point objects.
…pers to as_poly*, which delete by default. Revise docstrings.
|
Some comments and questions:
# works
vector = regions.add_vector(start=(100, 100), end=('17:56:21.34', '-21:57:23.16'))
# works
ruler = regions.add_ruler(start=(100, 100), end=('17:56:21.34', '-21:57:23.16'))
# does not work
line = regions.add_line(start=(100, 100), end=('17:56:21.34', '-21:57:23.16'))
# ValueError: ('17:56:21.34', '-21:57:23.16') is not a pair of numbers.
vector.set_control_point(1, ('17:56:21.34', '-21:57:23.16'))
# ValueError: ('17:56:21.34', '-21:57:23.16') is not a pair of numbers.
vector.set_control_points([('17:56:21.70', '-21:57:28.16'), ('17:56:21.34', '-21:57:23.16')])
# ValueError: ('17:56:21.70', '-21:57:28.16') is not a pair of numbers.
If the returned image coordinates are like (-1.7976931348623157e+308, -1.7976931348623157e+308), an error should be raised before # Add a point with invalid WCS coordinates
## image.from_world_coordinate_points([("12:12:12.12", "12:12:12.12")])
## [(-1.7976931348623157e+308, -1.7976931348623157e+308)]
point = regions.add_point(center=("12:12:12.12", "12:12:12.12"))
print(point)
# CartaActionFailed: CARTA scripting action .fetchParameter called with parameters (Macro('frameMap[4].regionSet.regionMap[-1]', 'regionType'),) failed: TypeError: Cannot read properties of undefined (reading 'regionType')
print(regions.list())
# CartaActionFailed: CARTA scripting action .fetchParameter called with parameters (Macro('frameMap[4].regionSet.regionMap[-1]', 'regionType'),) failed: TypeError: Cannot read properties of undefined (reading 'regionType')
# A failed region was created with a negative ID.
print(regions.get_value("regionList"))
# [{'id': 0, 'type': 0}, {'id': -1, 'type': 0}]
# This failed region cannot be cleared.
regions.clear()
print(regions.get_value("regionList"))
# [{'id': 0, 'type': 0}, {'id': -1, 'type': 0}] |
Collaborator
Author
|
@izkgao I've gone through your feedback:
|
izkgao
approved these changes
Apr 2, 2026
Collaborator
Author
|
Per Slack discussion, we should create a separate issue for the bounds problem, and make sure that it's fixed everywhere applicable |
kswang1029
approved these changes
Apr 9, 2026
Contributor
|
@confluence ready for merging. |
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 PR implements #80 and adds basic region support to the high-level wrapper. This PR depends on multiple frontend changes made in #2231, so that should be merged first.
Required before this can be moved out of draft:
BasePathMixininto a separate PR (it should be merged first and used to refactor the existing code to use the same composition pattern as the region functionality)Outstanding issues to be addressed before merging
This PR should be tested against the latest release version of CARTA. There will be a separate PR to remove the custom code in response to the dev frontend fixes, once this is merged and a main branch is created.