multicolorfits.McfSession#
- class multicolorfits.McfSession(n_panels=4)[source]#
Full editing session: N image panels plus compose settings.
Methods cover loading and aligning FITS layers, rendering the combined image / previews, saving FITS or figures, exporting transparent cutouts, and writing a standalone recreation script (
export_script()).Examples
>>> s = McfSession(n_panels=3) >>> s.load_files(['ir.fits', 'r.fits', 'b.fits'], ... colors=['#BE599E', '#DEA215', '#77C0F9']) >>> rgb = s.render_combined()
Methods
__init__([n_panels])active_indices()Indices of panels that currently have data loaded.
active_panels()Panels that currently have data loaded.
add_panel([color, label])Append an empty panel slot (up to
MAX_PANELS).align_panels([target, reference, method, scale])Reproject all loaded panels onto a single common grid so they can be combined.
apply_bare_plot_style([transparent])Configure this session for publication / image-only output.
apply_palette(name)Assign colors from a curated (or perceptual) palette to the loaded panels, in panel order.
colorblind_report([min_distance])Check whether the loaded panels' colors stay distinguishable under color-vision deficiency (protan/deutan/tritan simulation).
data_shape()(ny, nx) of the first loaded panel, or None.
display_to_data_pixel(ix, iy, img_w, img_h)Map a cursor position on a displayed RGB image (origin upper-left, size
img_wximg_h) to data pixel coordinates (origin lower).export_script()Generate a standalone Python script that reproduces the current combined image with the multicolorfits scripting API.
export_transparent_cutout([size, savepath, ...])Render the combined image and build a transparent-sky RGBA cutout.
fits_save_targets()Describe the FITS outputs the GUIs can offer, in menu order: the combined RGB cube, plus for each loaded layer a raw 2D-data option and a display-ready colorized-RGB option.
grid_report()Check whether all loaded panels share a common pixel grid (so they can be combined directly).
legend_entries()(color, label) pairs for the loaded panels, for the combined-figure channel legend.
load_files(paths[, colors, labels])Load FITS paths into successive panels (growing the session if needed, up to
MAX_PANELS).load_state(path_or_dict[, base_dir, ...])Restore a session saved with
save_state()or a state dict.palette_colors_for(name, n)Resolve
nhex colors for a palette name.panel_colors()Current hex colors of the loaded panels, in panel order.
params_text()Human-readable summary of the current plot parameters.
plot_component_mosaic(**kwargs)Combined image plus colorized component frames (shared WCS).
remove_panel(index)Remove the panel at index (indices after it shift down).
render_combined([inverse, preview, dtype, ...])Combine all active panels into the final multicolor RGB image.
render_combo_swatch([size])Render the composite-mode-aware color-combination swatch: one circle per active panel (in its channel color), arranged so they overlap, with the overlap regions showing the honest combined colors.
render_combo_swatch_colors(colors[, labels, ...])Like
render_combo_swatch()but for an arbitrary color list (preview).reset()Unload all panels and restore default compose settings.
rotate_panel_hues(delta_deg[, base_colors])Rotate active panel colors around the hue wheel while preserving relative spacing.
sample_at_pixel(x, y)Sample raw data values at integer pixel
(x, y)(origin lower).save_component_fits(index, savepath[, kind, ...])Save a single loaded panel to FITS.
save_fits_target(kind[, index, savepath, ...])Dispatch a FITS save described by
fits_save_targets().save_rgb_fits(savepath[, inverse, overwrite])Save the combined image as a display-ready RGB FITS cube.
save_state(path)Save the full session state (file paths, scaling, colors, compose settings) to a JSON file, so a session can be restored later with load_state().
set_n_panels(n)Grow or shrink the panel list to exactly n slots.
to_dict()to_state_dict([session_dir])Full session state as a JSON-serializable dict.
Attributes
STATE_VERSIONcommon_headerMcfHeader of the first active panel (all images share a pixel grid).