[AstroPy] A question about contour maps

Michael S. Kelley msk@astro.umd....
Mon Nov 7 09:28:23 CST 2011


Hi Jean-Baptiste,

I'm not sure what kind of projection you are interested in, but, at
the most basic level, you can do a weighted 2D histogram on your data
list.  For example:

import numpy as np
import matplotlib.pyplot as mpl
ra = np.random.randn(1000)
dec = np.random.randn(1000) + 10
w = np.random.randn(1000)**2
h = np.histogram2d(dec, ra, bins=100, weights=w)
mpl.clf()
mpl.imshow(h[0], extent=np.r_[h[2][[0, -1]], h[1][[0, -1]]], cmap=mpl.cm.gray_r)
mpl.plot(ra, dec, 'rx')
mpl.draw()

- Mike Kelley

On Mon, Nov 7, 2011 at 9:58 AM, Jean-Baptiste Marquette <marquett@iap.fr> wrote:
> Dear AstroPy people,
>
> I have an ASCII table with RA/DEC coordinates and the values of a given parameter at those positions. I would like to plot a contour map of this parameter on an image with RA/DEC coordinates. I was able create a blank image using pyfits. I guess I could use the APLpy FITSFigure.show_contour method if my data were organized as a FITS file.
> How to export from ASCII to FITS?
>
> Thanks for your help,
> Jean-Baptiste Marquette
> _______________________________________________
> AstroPy mailing list
> AstroPy@scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>



-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Michael S Kelley
Department of Astronomy
University of Maryland -- College Park
301-405-3796


More information about the AstroPy mailing list