Skip to main content

Launch and interact with SAOImageDS9 using Astropy SAMP

Project description

astropy-samp-ds9

Launch and interact with SAOImageDS9, using the SAMP protocol and client libraries provided by Astropy SAMP.

Installation

Using PyPI astropy-samp-ds9.

pip install astropy-samp-ds9

Example

  • single ds9 instance (managing its own hub)
from astropy_samp_ds9.launcher import DS9

ds9 = DS9(title='hello world')
res = ds9.get('version')
ds9.set('cmap cool', 'scale zscale', 'zoom to fit')
ds9.set('mosaicimage wcs {my.fits}')
res = ds9.get('iexam key coordinate')

/export/home/mdcb/tmp/lbcb.20241204.123735.fits

  • ds9 instance(s) attached to an external hub. Those can be attached, re-attached, and controlled from different sessions.
from astropy_samp_ds9.hublauncher import DS9Hub
from astropy_samp_ds9.launcher import DS9

hub = DS9Hub(name='myhub')
samp_hub_file = hub.samp_hub_file

ds9red = DS9(title='red channel', kill_ds9_on_exit=False, samp_hub_file=samp_hub_file)
ds9blue = DS9(title='blue channel', kill_ds9_on_exit=False, samp_hub_file=samp_hub_file)

Environment

  • DS9_EXE

This package requires SAOImageDS9 >= 8.7b1. By default, it uses ds9 that must satisfy this version and found in your PATH.

If you have several ds9 installations on your machine, or ds9 is not in your path, use the DS9_EXE environment to specify the ds9 executable location. For example: export DS9_EXE=/usr/local/ds9/8.7/bin/ds9

  • SAMP_HUB_PATH

The directory used to store SAMP_HUB files. By default, it will use $HOME/.samp-ds9/, and create this directory as needed.

  • SAMP_HUB_EXE

The samp_hub executable provided by astropy. By default, it will use samp_hub that must be in your PATH.

Miscellaneous

More advanced features include: exit handler, use pre-existing SAMP hub, etc. As of now, the documention is lacking and still WIP. Read the code!

################################# /usr/lib64/python3.12/site-packages/astropy/samp/hub.py

def _call_and_wait(self, private_key, recipient_id, message, timeout):

    raise SAMPProxyError(1, "Timeout expired!")

replace with SAMPProxyTimeout to differentiate anything from a timeout #################################

XXX

add an option (force_start) to wipe clean any hub/ds9 rather than attempt re-use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astropy-samp-ds9-0.1.12.tar.gz (19.1 kB view details)

Uploaded Source

File details

Details for the file astropy-samp-ds9-0.1.12.tar.gz.

File metadata

  • Download URL: astropy-samp-ds9-0.1.12.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.10

File hashes

Hashes for astropy-samp-ds9-0.1.12.tar.gz
Algorithm Hash digest
SHA256 dc85a89d2cc248e36a30784ab773c160c7ccdb740c86f11038061a775af3ea44
MD5 30f23590aee3f41ec079790b877c5842
BLAKE2b-256 26264c206d0afceac66b5a5f45a2f46ec2d102fad3dae98642ea71649e76f489

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page