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

feat: allow exporting of figures in a custom resolution #3478

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maartenbreddels
Copy link
Collaborator

@maartenbreddels maartenbreddels commented Mar 3, 2025

Description

This will clone a viewer and display it (invisibly) at a custom resolution.

I am opening this as a draft, because it still requires a few fixes:

  • A UI to change the resolution
  • A working _clone_viewer

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)?

@github-actions github-actions bot added the plugin Label for plugins common to multiple configurations label Mar 3, 2025
@maartenbreddels
Copy link
Collaborator Author

@astrofrog or @kecnry
Do you know a good way to clone a viewer, I was expecting this to work, but it does not, maybe you know why?

import glue_jupyter as gj
points = gj.example_data_xyz(loc=60, scale=30, N=10*1000)
app = gj.jglue(points=points)
s = app.scatter2d(x='x', y='y')


def _clone_viewer(self):
    new_viewer = type(self)(session=app.session)
    d = self.state.as_dict()
    new_viewer.state.update_from_dict(d)


    for this_layer_state, new_layer_state in zip(self.state.layers, new_viewer.state.layers):
        new_layer_state.update_from_dict(this_layer_state.as_dict())
    return new_viewer


s_clone = _clone_viewer(s)
s_clone.figure

This will clone a viewer and display it (invisibly) at a custom resolution
@maartenbreddels maartenbreddels force-pushed the feat_export_custom_resolution branch from abaaad8 to 8d3c991 Compare March 4, 2025 14:33
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 28.81356% with 42 lines in your changes missing coverage. Please review.

Project coverage is 87.68%. Comparing base (cf27560) to head (67c9339).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
jdaviz/configs/default/plugins/export/export.py 32.65% 33 Missing ⚠️
jdaviz/configs/default/plugins/viewers.py 10.00% 9 Missing ⚠️

❌ Your patch check has failed because the patch coverage (28.81%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3478      +/-   ##
==========================================
- Coverage   87.81%   87.68%   -0.14%     
==========================================
  Files         152      156       +4     
  Lines       20742    20949     +207     
==========================================
+ Hits        18215    18369     +154     
- Misses       2527     2580      +53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maartenbreddels maartenbreddels force-pushed the feat_export_custom_resolution branch from 9aec7b9 to 67c9339 Compare March 11, 2025 13:14
@maartenbreddels
Copy link
Collaborator Author

calling layer.update was needed for cloning of the viewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant