HpVis

A modern HEALPix viewer

HpVis is a viewer for HEALPix maps. The projection and the pixel lookup happen per pixel on the GPU, so a nside 2048 map still turns under your mouse.

Qt 6 · OpenGL · C++20
FITS · NPY · NPZ
AGPL-3.0
HpVis main window
Fig. 1 — The main window click to enlarge

§1Features

Viewing

  • 14 projections: Mollweide, Hammer, Aitoff, Equirectangular, Mercator, Sinusoidal, Lambert cylindrical, Gall-Peters, Werner, Orthographic, Azimuthal equidistant, Lambert azimuthal, Gnomonic and Stereographic
  • Seen from the inside (the sky) or the outside (a globe)
  • Galactic, Ecliptic and Equatorial frames, converted on the GPU from the map's own COORDSYS, or a free trackball
  • Interactive sky rotation with sliders, poles and right-click recentering
  • Zoom, pan, pinch, touchpad gestures, shift-drag to zoom to a region, double-click to reset
  • Minimap and graticule with adjustable spacing and color
  • Pixel grid of any nside (1 to 8192), with optional pixel numbers
  • RING and NESTED pixel ordering

Files and workspace

  • FITS, NumPy .npy and .npz files
  • Toolbar choosers for HDU and column, or array and row
  • Several maps open at once in tabs
  • File explorer dock, drag and drop, recent files
  • Sessions: the open files come back at the next start
  • Streaming of very large maps (up to nside 8192) that loads full-resolution tiles as you zoom

Color

  • 15 built-in colormaps, plus your own from CSV or JSON files
  • Linear, logarithmic and asinh scales, with a softening control
  • Adjustable color range and percentile auto-range that clips extreme pixels
  • Color bar, background and unseen-pixel colors
  • Reverse any colormap

Masks

  • Load several masks, toggle and invert them, then hide or dim the masked pixels
  • Mask Builder: threshold, galactic cut and disc rules, joined with AND, OR or Subtract
  • Edge taper, and the sky fraction with w2 and w4 shown as you edit
  • Paint a mask by hand
  • Open a built mask as a map and save it as FITS

Statistics

  • Min, max, mean, rms and standard deviation of the map
  • Statistics of a region: rectangle, ellipse, polygon or great-circle line
  • Histogram with bins, density, log axis, outlier clipping and mask options
  • Compare histograms of two maps as an overlay, ratio or difference
  • FITS header viewer

Power spectrum

  • TT, and TE, EE, BB, TB, EB when the HDU has Q and U
  • Mask correction with the MASTER method (NaMaster), with C1, C2 or smooth apodization
  • Bandpowers, and E/B purification
  • Divide by the pixel window and by a Gaussian or custom beam
  • Theory curves (Planck 2018 best fit), optionally binned with the bandpower windows
  • Compare other maps as an overlay, ratio or difference, or load curves from a file
  • Cross-spectrum of two maps, a null test with no noise bias
  • Export to CSV, PNG, SVG or PDF

Tools

  • Operate on Maps: add, subtract, multiply, divide, mean, absolute difference, maximum, minimum, or any expression of several maps
  • Change Resolution, by averaging pixels or through the harmonics
  • Beam smoothing (Gaussian or custom window, or deconvolve) and multipole filters (low-pass, high-pass, band-pass, band-stop)
  • Derivatives (Laplacian, gradient magnitude) and E and B maps of a polarized map
  • Unit conversion between K, mK, uK (CMB or Rayleigh-Jeans) and Jy/sr, MJy/sr
  • Data Transform: nonlinear functions applied to the values
  • Generate Random Map: Gaussian or uniform noise, or a CMB realization (T, or T, Q, U)
  • Every result opens as a new tab and saves as FITS

Export and interface

  • Save the view as PNG, JPEG or BMP, or copy it to the clipboard
  • Plots as PNG, or vector SVG and PDF in screen colors or black on white
  • Command line: render to a file, list HDUs, print statistics, no window needed
  • Settings dialog for the defaults of new maps
  • Menus grouped by topic with icons, and a rebindable shortcut for almost every command

§2Figures

Orthographic projection
Fig. 2 — Orthographic projection click to enlarge
Map expression evaluation
Fig. 3 — Expressions over several maps click to enlarge

§3Libraries used

§4Command line

# open a map
$ hpvis samples/wmap_W_iqu_nside32.fits
# pick a look
$ hpvis -p orthographic -m inferno -g map.fits
# render to a file, no window
$ hpvis --mask mask.fits --output out.png map.fits
# what's inside?
$ hpvis --info map.fits
$ hpvis --hdu 2 --column 3 maps.npz
--projection--colormap--cscale--orientation--view--graticule--mask--output--info--stats

Every option is described in the usage guide.

§5Dependencies and installation

Dependencies

HEALPix C++, libsharp, NaMaster and CLASS are built from the vendored sources, so you only install the rest from your distribution.

Dependency Needed for
C and C++20 compiler (GCC or Clang) everything
CMake 3.22+, make, pkg-config build system
Qt 6.8+ (Core, Gui, Widgets, OpenGLWidgets, Concurrent, Graphs, Svg) interface
OpenMP parallel code
CFITSIO reading and writing FITS files (system package)
libzip reading .npz files (system package)
autoconf, automake, libtool building the vendored HEALPix, libsharp and NaMaster
GSL, FFTW3 (with OpenMP), a CBLAS implementation NaMaster power spectra
git fetching the submodules
pandoc (optional) generating the man page

Install the packages

Arch Linux

sudo pacman -S base-devel cmake git pkgconf qt6-base qt6-graphs cfitsio libzip gsl fftw cblas-openblas autoconf automake libtool pandoc

Debian / Ubuntu

sudo apt install build-essential cmake git pkg-config qt6-base-dev qt6-graphs-dev libgl-dev libcfitsio-dev libzip-dev libgsl-dev libfftw3-dev libopenblas-dev autoconf automake libtool pandoc

Fedora

sudo dnf install gcc-c++ cmake git pkgconf-pkg-config qt6-qtbase-devel qt6-qtgraphs-devel cfitsio-devel libzip-devel gsl-devel fftw-devel openblas-devel autoconf automake libtool pandoc

Package names vary between distributions and releases. If one is not found, search for the library name.

Build

git clone --recurse-submodules https://github.com/dheerajshenoy/hpvis
cd hpvis
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
./build/hpvis

The first build is slow because it compiles HEALPix and NaMaster. If you cloned without --recurse-submodules, run git submodule update --init --recursive. Pass -DWITH_NAMASTER=OFF to build without power spectrum support.

Install

sudo cmake --install build

# or without root
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$HOME/.local
cmake --build build -j && cmake --install build

This installs the hpvis binary, the bundled shared libraries in lib/hpvis/ and the man page. For a prefix in your home directory, make sure $HOME/.local/bin is in your PATH. More in the installation guide, including troubleshooting.