[AstroPy] Aplpy FITSFigure does not open any window
Vittorio_Roma2
vittorio.braga at roma2.infn.it
Tue Oct 31 14:22:35 EDT 2017
Dear all
I am having a problem with aplpy.
I am using Python 3.5.2 under ubuntu 16.04 and installed aplpy version 1.1.1
through pip3 install aplpy
The first problem arises when importing aplpy:
import/home/vittorio/.local/lib/python3.5/site-packages/matplotlib/cbook/deprecation.py:106:
MatplotlibDeprecationWarning: The mpl_toolkits.axes_grid module was
deprecated in version 2.1. Use mpl_toolkits.axes_grid1 and
mpl_toolkits.axisartist provies the same functionality instead.
warnings.warn(message, mplDeprecation, stacklevel=1)
I have tried to substitute mpl_toolkits.axes_grid1 with
mpl_toolkits.axes_grid in core.py
but then I got an error (and not a warning) saying that axes_grid1 does
not have some method.
This will just return a failure and stop everything.
Anyways, when I do
>>> fitsfile='somefile.fits'
>>> F=aplpy.FITSFigure(fitsfile)
WARNING: Cannot determine equinox. Assuming J2000. [aplpy.wcs_util]
WARNING: Cannot determine equinox. Assuming J2000. [aplpy.wcs_util]
>>> F.show_grayscale()
INFO: Auto-setting vmin to 3.416e+03 [aplpy.core]
INFO: Auto-setting vmax to 2.212e+04 [aplpy.core]
No window at all is opening. I have also tried giving as input of FITSFIgure
astropy.io.fits.open objects but again, no graphical window shows up.
I have found some workaround, that is, after the above instructions, to give
>>>hdu_list=fits.open(fitsfile)
>>>image_data=hdu_list[0].data
>>>plt.imshow(image_data,'gray',clim=[4500,9000])
>>>plt.show(block=False)
This does open an astrometrized image, with the labels of the X and Y axis
in the right place. However, this does not allow me to use any of the
FITSFigure methods. Neither I can add subplots to put annotations. Finally,
to add markers, I am forced to do another workaround: to
give pixel coordinates like this
>>>plt.scatter(pixcoords[:,0],pixcoords[:,1])
where pixcoords comes from WCS transformations.
I have also tried a workaround, giving,e.g.
>>>F.add_label(0.5,0.5,'ssss',relative=True)
and do the plt.imshow and plt.show later, but this still does not work.
To sum up, while it is true that I can live with the workarounds for some
very basic figures, all of this is slowing down the script and I can't call
any of the FITSFigure methods
Any help would really be appreciated
Best regards, Vittorio
More information about the AstroPy
mailing list