Pixel Clarity for Python#
A fast viewer for large astronomical images, mosaics, cubes and tables, in a Jupyter notebook or in a browser tab from any Python program. The data stays on the server: a process next to the kernel reads it (local files, S3 objects and URLs by range requests, arrays and tables in the kernel) and the browser receives only the tiles, rows and values it shows. A 4k × 4k detector, a mosaic of many detectors or a catalog of millions of rows stays quick to look at, even over an ordinary internet connection.
pip install pixel-clarity
import pixel_clarity as pc
pc.show("image.fits") # a file on the server
pc.show("s3://bucket/path/image.asdf") # read where it is, no download
pc.show(array, cmap="magma", scale="asinh", limits="99.5") # an array in the kernel
pc.rgb("red.fits", "green.fits", "blue.fits") # three filters as color
pc.mosaic("exposure/") # images placed on the sky
pc.table("catalog.parquet") # sorted, filtered and plotted on the server
Every image viewer on these pages is live. Click one to pan, zoom, change the stretch, hover for
values and sky coordinates, and draw regions. Each is the page the code above it writes with
share(), read in your browser with nothing installed.
Where to start#
New to it? Getting started installs it and walks through a first image.
Used it before? What’s new in version 0.9: pictures saved from code with
pc.save_png, figures for papers and talks, and Load all for huge images.
Then pick a topic from the list on the left, or one of these:
Opening your data: files of every format, URLs and S3, arrays and astropy objects in the kernel.
Color and stretch: scale functions, limits, colormaps and Auto enhance.
Mosaics and color images: many detectors, many filters, one view.
Coordinates and regions: from a catalog to circles on the sky, and back.
Profiles and spectra: values along a line or a band, a spectrum extracted along its trace with the sky taken off.
Tables and catalogs: millions of rows, filtered and plotted on the server.
Saving pictures: PNGs of images and mosaics from code, many at a time, as the viewer shows them.
Sharing a view: a web page anyone can open, from a single call.