Skip to content
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

Enhance From File catalog loading to support more columns and improve Clear Table functionality #3359

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

haticekaratay
Copy link
Contributor

@haticekaratay haticekaratay commented Dec 16, 2024

Description

This pull request introduces:
Catalog Loading from File:
- Users can now load catalog data (e.g., .ecsv files) directly into the table.
Improved Clear Table Functionality:
- The "Clear Table" button now clears the table, removes markers, and resets selected rows in the viewer.

Screen.Recording.2024-12-15.at.10.42.00.PM.mov

Fixes #

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@haticekaratay haticekaratay added this to the 4.1 milestone Dec 16, 2024
@github-actions github-actions bot added imviz plugin Label for plugins common to multiple configurations labels Dec 16, 2024
@haticekaratay haticekaratay marked this pull request as ready for review December 19, 2024 04:12
@haticekaratay haticekaratay changed the title WIP: Add functionality to load catalogs from a file Add functionality to load catalogs from a file Dec 19, 2024

elif isinstance(item, (np.float32, np.float64)):
return float(item)
elif isinstance(item, u.Quantity):
Copy link
Contributor

Choose a reason for hiding this comment

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

This way we lost the unit info, is that important?

Also I wonder if we can take advantage of the JsonCsutomEncoder that astropy already has for some of these: https://github.com/astropy/astropy/blob/93b6f551b9ed00c4a422b754eae0261f1a7552c9/astropy/utils/misc.py#L366

assert imviz_helper.viewers['imviz-0']._obj.state.x_max == 958.38461
assert imviz_helper.viewers['imviz-0']._obj.state.y_min == 278.86265
assert imviz_helper.viewers['imviz-0']._obj.state.y_max == 378.8691
assert imviz_helper.viewers['imviz-0']._obj.state.x_min == 1022.5631800000001
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did the test results change?

CHANGES.rst Outdated
@@ -21,6 +21,8 @@ Imviz
- Catalog Search plugin now exposes a maximum sources limit for all catalogs and resolves an edge case
when loading a catalog from a file that only contains one source. [#3337]

- Catalog Search plugin now supports loading catalog data directly from files. [#3359]
Copy link
Member

Choose a reason for hiding this comment

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

can we clarify somehow that this adds support for the additional columns (otherwise I worry we might get confused that this is when support for loading from file was first introduced at all)?

@pllim
Copy link
Contributor

pllim commented Dec 19, 2024

We should also probably add a section in user docs to document exactly what format of such file the plugin can actually ingest?

@kecnry
Copy link
Member

kecnry commented Dec 19, 2024

We should also probably add a section in user docs to document exactly what format of such file the plugin can actually ingest?

Already exists and probably still relevant: https://jdaviz.readthedocs.io/en/latest/imviz/plugins.html#catalog-search. Any specific changes you think are needed?

@pllim
Copy link
Contributor

pllim commented Dec 19, 2024

Re: doc -- OK I was confused by the title of PR and change log. Nvm

@@ -88,13 +89,15 @@ def __init__(self, *args, **kwargs):
def _file_parser(path):
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs say that the label column must exist, but we don't actually enforce that so you are able to load with just the sky_centroid column. This results in the Object ID column = N/A, so I think we should add a condition here so we make sure that column also exists.

@rosteen rosteen modified the milestones: 4.1, 4.2 Dec 23, 2024
@haticekaratay haticekaratay changed the title Add functionality to load catalogs from a file Enhance From File catalog loading to support more columns and improve Clear Table functionality Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imviz plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants