I have been trying to plot the contours of a FITS image over itself in APLpy. The image was created in AIPS, and has dimensions (1024,1024,1,1), viz., right ascension (RA--SIN), declination (DEC--SIN), frequency (FREQ), and Stokes (STOKES). I tried to load the FITS image and plot the contours of this image over itself, using the following commands -

baseimg = aplpy.FITSFigure('FILENAME.FITS') 

This returned the error WCS has more than 2 pixel dimensions, so 'slices' should be set.

So, I specified the dimensions and slices while loading the FITS image, as-

baseimg = aplpy.FITSFigure('FILENAME.FITS', dimensions=[0,1],slices=[0,0])

i.e., specifying RA and DEC as the x and y axes respectively, and using the only available value of Frequency and Stokes as the slice. Trying to plot contour again as-



baseimg.show_contour('FILENAME.FITS', dimensions=[0,1],slices=[0,0])

again gives the same error WCS has more than 2 pixel dimensions, so 'slices' should be set.

I am stumped as to what I am doing wrong here. I am absolutely new to APLpy. Any help is immensely appreciated.

  • $\begingroup$ I’m voting to close this question because it is discussing coding in python, which is better suited on StackOverflow $\endgroup$
    – harada
    Jan 14, 2021 at 2:03
  • 2
    $\begingroup$ @harada This is not a question of coding in python in general. APLpy (the Astronomical Plotting Library in Python - pronounced apple pie) is a Python package module aimed at producing publication-quality plots of astronomical imaging data. I therefore put it here. This forum has several well received questions of astropy too. If you want to migrate it to SO, alright, I would trust your judgement and hope SO could answer such a specific question. But I am against closing this. $\endgroup$ Jan 14, 2021 at 3:27
  • 1
    $\begingroup$ on-topic! @harada consider that question includes the site's python tag which can be found on 84 previous questions, and that "better suited" is not a close reason. As long as a question is not off-topic, OP decides where to post. Python is a tool many (most?) Astronomers use daily to learn about the universe. $\endgroup$
    – uhoh
    Jan 15, 2021 at 2:05
  • 2
    $\begingroup$ @uhoh Okay cool. I've retracted my close vote. Your explanation + the post edits make the intentions of the post more clear, and I agree it should stay open. Sorry for any confusion. $\endgroup$
    – harada
    Jan 15, 2021 at 15:20
  • 1
    $\begingroup$ Thank you @harada. I realise my original post could have been misleading, hence the edits. Thank you very much for the bounty as well! $\endgroup$ Jan 15, 2021 at 19:13


You must log in to answer this question.

Browse other questions tagged .