add coupling between ds9 and asdf dialog - #15
Open
perrygreenfield wants to merge 1 commit into
Open
Conversation
This was referenced Aug 9, 2026
braingram
reviewed
Aug 11, 2026
braingram
left a comment
There was a problem hiding this comment.
I wasn't able to get this to work (see 2 issues in comments). Would you look at those and I can try this again?
| import asdf | ||
| import ds9samp | ||
| import numpy as np | ||
| import psutil |
There was a problem hiding this comment.
This needs to be added as a dependency.
| # Check that there is dialog is present by checking the pid's existance | ||
| if {[CheckPID $asdf_pid] == "running"} { | ||
| # Signal that it should be raised over other windows | ||
| set fid [open "/Users/perry/ds9tmp/ds9cmd" w] |
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.

These changes provide better coupling between ds9 and the ASDF windows.
If the ds9 that generated the ASDF windows is terminated, the ADSF will be removed (within a second).
If the user clicks the file/asdf button when an asdf dialog is already open, it will not create a new one, and
will raise the root asdf window to the top (but currently not other child asdf window such as the image browser; I haven't figured that out yet).
The first is done by passing the Python ASDF code the ds9 pid
The second is done by ds9 storing the Python pid when it creates the Python subprocess.
The Python process institutes a polling mechanism that checks every second (this can be changed) to see if the process associated with the ds9 pid no longer exists, in which case it self destructs (apologies to Mission Impossible).
If the ds9 clicks ASDF when a dialog is already open, it refuses to create a new one. Further more it write a file to the temporary directory used by Python to send images to ds9 to indicate that it wants the dialog to be raised to the top so the user is not confused. I would like it to raise all the children windows, but I am deferring that since the simple solution doesn't seem to work for that. This is done through the same polling mechanism that looks for the special file (which it then deletes). This is a very simple minded communication method, but very portable and does not require inserting things deeper down in ds9.
Currently it is possible for the user to ask for a new image browser window which will be created even if there is already one open.
Addresses issues #5 and #6
No AI tools used.