Quick example notebook for radiopadre

The example below show how to use the radiopadre machinery.

You must select "Cell|Run All" from the above menu to (re)run the notebook, and wait for it to finish rendering.

This particular notebook is built for the example data directory in the radiopadre github repo. But it will probably work well enough with any directory containing fits files and images.


In [ ]:
### mandatory init
%matplotlib inline
from radiopadre import DirList
### 
# dirs is a directory list object
# It recursively includes all directories under your results directory 
# dirs.show() will have the same effect
dirs = DirList('data')
dirs

In [ ]:
root = dirs[0]
root.fits  # gives list of FITS files in directory #0 above

In [ ]:
# displays thumbnails for all FITS files in directory #0
root.fits.thumbs()

In [ ]:
root.fits.thumbs(zoom=2)

In [ ]:
# gives list of FITS files matching the pattern
root.fits("*restored*")

In [ ]:
root.fits("*restored*").show()
root.fits("*restored*").thumbs()

In [ ]:
# list of images (PNG, JPG, etc.) in directory #3
root.images

In [ ]:
# clickable thumbnails of same
root.images.thumbs(ncol=6)

In [ ]:
# first FITS file in directory #0. Stokes axis is unrolled by default (if it exists), but this can be controlled by
# invoking dirs[0].fits[0].show() with some extra arguments. Try this on a file with an actual Stokes axis...
root.fits[0]

In [ ]:
# and this shows how to invoke show() on a FITS file with some explicit arguments to control the rendering
root.fits[0].show(unroll=None,vmin=0,vmax=.1,zoom=4)

In [ ]:
# just some info about the given file
root.fits[0].info()

In [ ]:
# A more elaborate rendering of the same file using aplpy. Note that .fullpath gives you the path to the file.
# aplpy is quite slow so we don't use it by default for all files, but this example shows you how to do
# a proper rendering
import aplpy
import matplotlib.pyplot as plt

fig = aplpy.FITSFigure(root.fits[0].fullpath,slices=[0,0])
fig.show_colorscale(cmap='gist_heat',vmin=0,vmax=.1)
fig.add_colorbar()