Plotting PUNCH data#

How to plot PUNCH data using built-in plotting tools

So you’ve downloaded a PUNCH FITS file, and you want to display it in Python in a simple way. We’ve encapsulated a flexible plotting function within the punchbowl repository that users can use and build on.

First we’ll load a set of libraries. This is minimal, but will provide a sample file to use for plotting, and the plotting function itself.

from punchbowl.data.sample import PUNCH_CAM
from punchbowl.data.visualize import plot_punch
Files Downloaded:   0%|          | 0/1 [00:00<?, ?file/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:   0%|          | 0.00/18.2M [00:00<?, ?B/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:   1%|          | 105k/18.2M [00:00<00:17, 1.04MB/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:   8%|▊         | 1.50M/18.2M [00:00<00:02, 7.89MB/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:  29%|██▊       | 5.21M/18.2M [00:00<00:00, 20.6MB/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:  50%|█████     | 9.17M/18.2M [00:00<00:00, 27.9MB/s]

PUNCH_L3_CAM_20251022223629_v0h.fits:  82%|████████▏ | 14.9M/18.2M [00:00<00:00, 38.3MB/s]


Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  1.38file/s]
Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  1.37file/s]

Next we’ll plot the data. Note that you can provide as input either a path to a FITS file directly, or alternatively a loaded NDCube object.

plt, ax = plot_punch(PUNCH_CAM)
PUNCH CAM 2025/10/22 22:36:29 UT

This is using the default parameters, but the function is flexible to plot in a few different ways. For example, let’s say we want a minimal plot of just the data, but still with some annotation.

plt, ax = plot_punch(PUNCH_CAM, axes_off=True)
plotting data

For a more complex example let’s bring down the vmax value a bit, relabel the axes, and turn off the colorbar.

plt, ax = plot_punch(PUNCH_CAM, vmax=5e-13, axes_labels=(r'$X_{im}$', r'$Y_{im}$'), colorbar=False)
PUNCH CAM 2025/10/22 22:36:29 UT

A variety of other plotting elements and options can be controlled - for full details see the function docstring or ask the SOC.

Total running time of the script: (0 minutes 10.374 seconds)

Gallery generated by Sphinx-Gallery