Skip to content

Commit

Permalink
Merge 3efb992 into 875a4c9
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Dec 4, 2014
2 parents 875a4c9 + 3efb992 commit 55e2473
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion spectral_cube/spectral_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from astropy import units as u
from astropy.extern import six
from astropy.io.fits import PrimaryHDU, ImageHDU, Header, Card
from astropy.io.fits import PrimaryHDU, ImageHDU, Header, Card, HDUList
from astropy import log
from astropy import wcs

Expand Down Expand Up @@ -1716,6 +1716,36 @@ def to_pvextractor(self):

return PVSlicer(self)

def to_ds9(self, ds9id=None, newframe=False):
"""
Send the data to ds9 (this will create a copy in memory)
Parameters
----------
ds9id: None or string
The DS9 session ID. If 'None', a new one will be created.
To find your ds9 session ID, open the ds9 menu option
File:XPA:Information and look for the XPA_METHOD string, e.g.:
XPA_METHOD: 86ab2314:60063
You would then calll this function as ``cube.to_ds9('86ab2314:60063')``
newframe: bool
Send the cube to a new frame or to the current frame?
"""
import ds9

if ds9id is None:
dd = ds9.ds9(start=True)
else:
dd = ds9.ds9(target=ds9id, start=False)

if newframe:
dd.set('frame new')

dd.set_pyfits(HDUList(self.hdu))

return dd


@property
def header(self):
# Preserve non-WCS information from previous header iteration
Expand Down

0 comments on commit 55e2473

Please sign in to comment.