Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Python Tools for Analysis and Visualization of Astronomical Data
    • Tools from Space Telescope Science Institute:
      • numarray A replacement for the Numeric package; offers similar array manipulation functionality as matlab or IDL.
      • PyFITS A nice interface for accessing data in FITS files.
      • numdisplay Steer image display using ds9 or ximtool from Python.
      • PyRAF Python replacement for the IRAF command language.
    • matplotlib A default plotting package for Python?\\\\
      An example plot:
      Code Block
      titletest_plot.py
      from matplotlib.matlab import *
      
      def join(x, sign=1):
          x1 = list(x)
          x2 = list(sign*x)
          x1.reverse()
          x1.extend(x2)
          return array(x1)
      
      func = "x**3 - x + 1"
      f = eval("lambda x: " + func)
      
      x = arange(-2, 8, 0.01)
      y2 = f(x)
      indx = where(y2 > 0)
      x = x[indx]
      y = sqrt(y2[indx])
      x = join(x)
      y = join(y, -1)
      
      figure(1, figsize=(6, 6))
      clf()
      plot(x, y, 'k')
      xymax = 20
      plot([0, 0], [-xymax, xymax], ':b', [-xymax, xymax], [0, 0], ':g')
      
      xx = arange(-1, 8)
      yy = sqrt(f(xx))
      indx = where((yy % 1) == 0)
      plot(xx[indx], yy[indx], "D")
      
      xlabel(r'$x$')
      ylabel(r'$y$')
      eq = '$y^2 = ' + func.replace('**', '^').replace('*', '') + '$'
      legend((eq, '$x=0$', '$y=0$'))
      
      xlim(-1.5, 2)
      ylim(-2, 2)
      

      Here is the result:\\\\
      Image Removed Image Added\\\\
      An example of image display using this package:\\\\
      Code Block
      titledc1_image.py
      import pyfits
      from matplotlib.matlab import *
      
      dc1_map = pyfits.open("dc1_counts_map.fits")
      dc1_map.info()
      
      im = dc1_map[0].data.copy()
      
      clf()
      figure(1, figsize=(8, 4))
             
      imshow(log10(im[0] + 1e-5))
      

      and the resulting image:\\\\
      Image Removed Image Added