Problems with tutorial: Display the calexp (calibrated exposure)

Hello everyone :slight_smile:
I’m currently using the science Pipelines of LSST (version 21) through an account in a cluster (called Leftraru) from a High Performance Computing Lab (called NLHPC), and have trouble with the step of Display the calexp (calibrated exposure) from the part 3 (Getting started tutorial part 3: displaying exposures and source tables output by processCcd.py — LSST Science Pipelines) of the Getting started with the LSST Science Pipelines — LSST Science Pipelines

When I try to utilize the command display.mtv(calexp) I get the following error:

>>> display.mtv(calexp)
Traceback (most recent call last):
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/display_ds9/21.0.0+8829bf0056/python/lsst/display/ds9/ds9.py", line 272, in ds9Cmd
    ret = xpa.set(None, getXpaAccessPoint(), cmd, "", "", 0)
lsst.pex.exceptions.wrappers.IoError: 
  File "python/lsst/display/ds9/xpa.cc", line 115, in const char* lsst::display::ds9::{anonymous}::XPASet1(XPA, char*, char*, char*, char*, int)
    XPASet returned 0 {0}
lsst::pex::exceptions::IoError: 'XPASet returned 0'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/display_ds9/21.0.0+8829bf0056/python/lsst/display/ds9/ds9.py", line 292, in initDS9
    ds9Cmd("iconify no; raise", False)
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/display_ds9/21.0.0+8829bf0056/python/lsst/display/ds9/ds9.py", line 277, in ds9Cmd
    raise Ds9Error("XPA: %s, (%s)" % (e, cmd))
lsst.display.ds9.ds9.Ds9Error: XPA: 
  File "python/lsst/display/ds9/xpa.cc", line 115, in const char* lsst::display::ds9::{anonymous}::XPASet1(XPA, char*, char*, char*, char*, int)
    XPASet returned 0 {0}
lsst::pex::exceptions::IoError: 'XPASet returned 0'
, (;iconify no; raise)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/afw/21.0.0+fdf35455f6/python/lsst/afw/display/interface.py", line 551, in mtv
    self._impl._mtv(data.getImage(), data.getMask(), wcs, title)
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/display_ds9/21.0.0+8829bf0056/python/lsst/display/ds9/ds9.py", line 410, in _mtv
    initDS9(i == 0)
  File "/home/jahumada/lsst_stack-v21/stack/miniconda3-py37_4.8.2-cb4e2dc/Linux64/display_ds9/21.0.0+8829bf0056/python/lsst/display/ds9/ds9.py", line 312, in initDS9
    raise NameError("ds9 doesn't appear to be on your path")
NameError: ds9 doesn't appear to be on your path

I have trouble understanding if there must be a change of path in some script (and if so, in which one? :o), or if this error is raised because there isn’t a ds9 interface in the cluster (this cluster can only be accessed via the terminal)
If you have any suggestions on how to avoid this error, I’ll be happy to try them out :slight_smile:

Thanks a lot!
Paula.

Running the Science Pipelines on a machine other than the one where you are displaying is a rather advanced configuration. It is generally easier to install the Science Pipelines and ds9 on your local machine instead. But if you need to run remotely, there are (at least) two major alternatives.

If your local machine has an X Windows server and you can install and run ds9 on the remote server, you could forward the ds9 display to your local machine (e.g. with ssh -X). You may need to consult other documentation for how to set things like the DISPLAY environment variable to accomplish this. If you then run the tutorial from the same shell, it should work as written. This way of running things is generally slower.

If you can install and run ds9 on your local machine, then you will need to forward the XPA communications protocol from the remote server to your local machine. LSST Applications: How to display images gives some hints on how to do this. This way of running things will generally be more interactive, but the required port forwarding is more complicated.

Thanks, I will try that those solutions and see which works :slight_smile:

There’s also more information in this topic, although you might have to adapt it for your situation: Using an lsst-dev stack w/ local ipython & ds9 tutorial

Ok :), thanks a lot!!
I was wondering if it is possible to directly visualize a processed image (from the LSST pipeline) in ds9, without using the Display environment ?

Yes, you can load an LSST FITS file into ds9 directly, but I think it’s more difficult to display the mask planes.

Hi! in the end I figured a way to visualize the calexp setting the Default Backend to be matplotlib, that way I can also see the mask. In this jupyter notebook it shows how to do it: StackClubCourse/DataProductsToScience.ipynb at master · LSSTScienceCollaborations/StackClubCourse · GitHub
Thanks a lot for your help! :slight_smile: