Expand description
§HEALPix Plotter
A Rust library for rendering HEALPix celestial maps in multiple projections (Mollweide, Hammer, Gnomonic).
§Overview
This library reads astronomical data from FITS files containing HEALPix sky maps and generates publication-quality visualizations in PDF and PNG formats. Key features include:
- Multiple projections: Mollweide, Hammer, and Gnomonic
- 80+ colormaps: matplotlib and custom colormaps
- Data scaling: linear, logarithmic, symlog, asinh, and histogram equalization
- HEALPix support: RING and NEST ordering, sparse and dense maps
- Output formats: High-quality PDF via Cairo and PNG via image crate
- Customization: full control over colors, scale, gamma, graticules, and more
§Quick Start
ⓘ
use map2fig::plot::plot_mollweide_auto;
use map2fig::params::MollweideParams;
let params = MollweideParams {
fits_file: "map.fits".to_string(),
output_file: "map.pdf".to_string(),
..Default::default()
};
plot_mollweide_auto(params);§Main Plotting Functions
- plot_mollweide_png - Render Mollweide projection to PNG
- plot_mollweide_pdf - Render Mollweide projection to PDF
- plot_mollweide_auto - Render Mollweide with automatic format selection
- plot_gnomonic_png - Render Gnomonic projection to PNG
- plot_gnomonic_pdf - Render Gnomonic projection to PDF
- plot_gnomonic_auto - Render Gnomonic with automatic format selection
- plot_hammer_png - Render Hammer projection to PNG
- plot_hammer_pdf - Render Hammer projection to PDF
- plot_hammer_auto - Render Hammer with automatic format selection
§Core Types
- scale::Scale - Data scaling method (linear, log, symlog, asinh, histogram)
- NegMode - Handling strategy for negative/masked values
- Colormap - Color palette for mapping data values to colors
- colormap::get_colormap - Get a colormap by name
- healpix::HealpixMeta - HEALPix metadata from FITS file
- PixelMask - Boolean mask for pixel filtering
§Data Processing
- healpix::read_healpix_meta - Read HEALPix metadata from FITS
- fits::read_healpix_column - Read HEALPix data from FITS file
- healpix::downgrade_healpix_map - Resample HEALPix map to different resolution
- scale::validate_scale_config - Validate scaling parameters
Re-exports§
pub use cli::Args;pub use cli::PlotConfig;pub use colormap::Colormap;pub use colormap::available_colormaps;pub use colormap::get_colormap;pub use data_array::DataArray;pub use fits::read_healpix_column;pub use fits::read_healpix_column_cached;pub use mask::PixelMask;pub use pdf_optimize::PdfOptimizationConfig;pub use pdf_optimize::estimate_pdf_complexity;pub use plot::plot_gnomonic_auto;pub use plot::plot_gnomonic_pdf;pub use plot::plot_gnomonic_png;pub use plot::plot_hammer_auto;pub use plot::plot_hammer_pdf;pub use plot::plot_hammer_png;pub use plot::plot_mollweide_auto;pub use plot::plot_mollweide_pdf;pub use plot::plot_mollweide_png;pub use scale::validate_scale_config;pub use constants::*;
Modules§
- benchmark
- PDF Rendering Benchmarks and Performance Analysis
- cli
- cli_
builder - CLI argument builder utilities for constructing plot parameters.
- colorbar
- colormap
- constants
- data_
array - Adaptive data type wrapper that preserves FITS column precision.
- diagnostics
- Performance diagnostics and profiling module.
- executor
- Plot execution module - handles projection selection and rendering.
- fits
- FITS file reading and data extraction.
- gnomonic
- gnomonic_
graticule - Graticule rendering for gnomonic projections
- graticule
- hammer
- healpix
- HEALPix coordinate system and data sampling utilities.
- latex
- LaTeX-like text rendering for mathematical expressions
- latex_
render - layout
- mask
- mmap_
reader - Memory-mapped FITS file reader
- mollweide
- params
- Parameter bundling structs for plot functions.
- pdf_
optimize - pipeline
- plot
- projection
- render
- rotation
- Coordinate rotations for astronomy.
- scale
- Data scaling and value normalization for visualization.
- setup
- Setup module - handles application initialization.
- simd
- SIMD vectorization module for high-performance batch operations.
- simd_
wide - True vector SIMD using the
widecrate for f64x2 operations
Structs§
- Batched
Cairo Image Sink - Batched Cairo pixel sink - groups pixels by color to reduce fill() calls.
- Cairo
Raster Sink - Sink for rendering pixels to a Cairo drawing context.
- PngSink
- Sink for rendering pixels directly to an in-memory PNG image buffer.
- RgbaArg
- RGBA color specified as comma-separated integers 0–255.
Enums§
- NegMode
- Strategy for handling negative, masked, or invalid pixel values in HEALPix maps.
- Pixel
Value - Pixel value classification during data-to-color mapping.
Traits§
- Pixel
Sink - Trait for pixel rendering backends.
Functions§
- generate_
index_ map - Generate a simple index map for testing.