punchbowl.data.visualize#
Attributes#
Functions#
|
Generate PUNCH colormap. |
|
Create radial distance array. |
|
Filter data with radial distance function. |
|
Create an RGB composite from a MZP cube. |
|
Frame rendering helper function. |
|
Create an animation from a sequence of PUNCH data. |
|
Plot a PUNCH NDCube data object. |
Module Contents#
- punchbowl.data.visualize._cmap_punch() matplotlib.colors.LinearSegmentedColormap[source]#
Generate PUNCH colormap.
- punchbowl.data.visualize.cmap_punch#
- punchbowl.data.visualize.cmap_punch_r#
- punchbowl.data.visualize.radial_distance(h: int, w: int, center: tuple[int, int] | None = None, radius: float | None = None) numpy.ndarray[source]#
Create radial distance array.
- punchbowl.data.visualize.radial_filter(data: numpy.ndarray) numpy.ndarray[source]#
Filter data with radial distance function.
- punchbowl.data.visualize.generate_mzp_to_rgb_map(data_cube: numpy.ndarray, gamma: float = 0.7, frac: float = 0.125, s_boost: float = 2.25) numpy.ndarray[source]#
Create an RGB composite from a MZP cube.
- Parameters:
data_cube (NDData-like or numpy array) – Expected shape: (3, ny, nx) Channels correspond to M, Z, P images.
gamma (float) – Power-law exponent to apply to each channel.
frac (float) – Fractional scaling applied after median normalization.
s_boost (float) – HSV saturation boost factor (>1 increases color saturation).
- Returns:
rgb_sat (ndarray (ny, nx, 3)) – Float RGB array in [0,1] with enhanced saturation.
color_image (ndarray (3, ny, nx)) – 8-bit RGB image before HSV saturation.
- punchbowl.data.visualize._render_frame(args: tuple[int, pathlib.Path | ndcube.NDCube, str, dict]) pathlib.Path[source]#
Frame rendering helper function.
- punchbowl.data.visualize.animate_punch(data_list: list[pathlib.Path | ndcube.NDCube], output_path: str | pathlib.Path, fps: int = 10, n_jobs: int | None = None, persistence: bool = False, **plot_kwargs: dict) None[source]#
Create an animation from a sequence of PUNCH data.
- Parameters:
data_list (list of Path or NDCube) – PUNCH data to animate
output_path (str or Path) – Output path to write generated animation (.mp4)
fps (int, optional) – Frames per second
n_jobs (int or None, optional) – Number of parallel processes (None uses all available cores)
persistence (bool, optional) – Toggle for persistence of vision animation, which updates each frame in valid data areas, keeping a running value elsewhere. False by default.
**plot_kwargs – Additional formatting arguments passed to plot_punch
- punchbowl.data.visualize.plot_punch(data: pathlib.Path | ndcube.NDCube, layer: int = 0, cmap: str | matplotlib.colors.Colormap | None = cmap_punch, norm: matplotlib.colors.Normalize | None = PowerNorm, vmin: float = 1e-14, vmax: float = 1e-12, gamma: float = 1 / 2.2, figsize: tuple[float, float] = (10, 8), axes_labels: tuple[str, str] = ('Helioprojective longitude', 'Helioprojective latitude'), axes_off: bool = False, annotate: bool = True, grid_spacing: int = 15, grid_alpha: float = 0.25, title_prefix: str | None = None, colorbar: bool = True, colorbar_label: str = 'Mean Solar Brightness (MSB)', persistence_array: numpy.ndarray | ndcube.NDCube | None = None, trim_edge: float | tuple[float, float] | list[float, float] | None = None, save_path: str | pathlib.Path | None = None, dpi: int = 300) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]#
Plot a PUNCH NDCube data object.
- Parameters:
data (Path | NDCube) – PUNCH data to plot, either a filepath or an NDCube
layer (int) – Data layer to plot when using three-dimensional data cubes
cmap (str or Colormap, optional) – Colormap to use for plot
norm (Normalize, optional) – Normalization function for image
vmin (float, optional) – Normalization vmin value
vmax (float, optional) – Normalization vmax value
gamma (float, optional) – Normalization gamma scaling value
figsize (tuple, optional) – Figure size
axes_labels (tuple[str, str], optional) – Axes labels (x, y)
axes_off (bool, optional) – Remove axes and labels
annotate (bool, optional) – Toggles display of corner annotation when axes_off is True
grid_spacing (int, optional) – Coordinate grid spacing in degrees, removes grid for None
grid_alpha (float, optional) – Coordinate grid transparency (1: opaque, 0: transparent)
title_prefix (str, optional) – Prefix to prepend to plot title
colorbar (bool, optional) – Toggle for plotting colorbar
colorbar_label (str, optional) – Label to use for the colorbar
persistence_array (np.ndarray or NDCube or None) – When not None, data is plotted where valid atop this existing array.
trim_edge (float, tuple[float, float], list[float, float], None) – Option to trim the edges of low-noise mosaic products to the specified fractional radial distance. One input value trims the outer boundary only, while two trim both the inner and outer boundaries. A reasonable set of values are (0.13, 0.68) for the inner and outer boundaries.
save_path (str or Path, optional) – When provided, saves the figure to file directly without plotting on screen
dpi (int, optional) – DPI for output plots saved to file
- Return type:
tuple of (figure, axes)