Skip to content

Add get_image and get_image_label #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 7, 2025
Merged

Add get_image and get_image_label #71

merged 6 commits into from
Jul 7, 2025

Conversation

eteq
Copy link
Member

@eteq eteq commented Jun 29, 2025

As discussed with @mwcraig at the coordination meeting. For now we are setting no type limitations on the returned image since backends often have different internal representations.

Edit: fixes #59

@eteq eteq changed the title Add get_image Add get_image and get_image_label Jun 29, 2025
@eteq eteq requested a review from mwcraig June 29, 2025 21:23
Copy link
Member

@mwcraig mwcraig left a comment

Choose a reason for hiding this comment

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

Thanks -- comments are inline.

assert isinstance(self.image.get_image_labels(), tuple)

self.image.load_image(data, image_label="test")
assert len(self.image.get_image_labels()) == 2
Copy link
Member

Choose a reason for hiding this comment

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

Interesting; logically I would have thought of this as being 1.

Is this too complicated: None only counts as an image label if it has data associated with it

So the idea would be that if, like in this example, the only loaded data was for an image label you set, the get_image_labels returns just the image label you have used.

Doing this would return two image labels:

# Assume we are starting with a clean slate

assert self.image.get_image_labels() is None  # or maybe == []

# Load an image without a label, which means the label is `None`
self.image.load_image(data)

# Load a second image with an explicit label
self.image.load_image(data, label="test")

assert len(self.image.get_image_labels()) == 2  # None and "test"

Copy link
Member

Choose a reason for hiding this comment

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

Tracking this in #74

@mwcraig mwcraig merged commit 826da47 into astropy:main Jul 7, 2025
7 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.

Add a way to get image labels
2 participants