{ "cells": [ { "cell_type": "markdown", "id": "38070048", "metadata": {}, "source": [ "# Getting started (scripting)\n", "\n", "Stretch, colorize, and combine FITS layers with the v3 session API. For the\n", "full NGC 602 narrative (OpenFITS download, WCS rotation, inverse backgrounds)\n", "see [ngc602_same_grid](ngc602_same_grid.py). Conceptual guides:\n", "[color compositing](../guide/color_compositing.md),\n", "[intensity scaling](../guide/intensity_scaling.md),\n", "[session model](../guide/session_model.md),\n", "[WCS & alignment](../guide/wcs_and_alignment.md)." ] }, { "cell_type": "code", "execution_count": null, "id": "a345dc55", "metadata": {}, "outputs": [], "source": [ "import multicolorfits as mcf\n", "from multicolorfits.figures import make_combined_figure" ] }, { "cell_type": "markdown", "id": "4d09d75d", "metadata": {}, "source": [ "## Minimal `McfSession` recipe\n", "\n", "Replace the paths with three registered FITS files on your machine. Layers\n", "must share a pixel grid (use **Align layers…** in the GUI or `align_stack`\n", "when they do not)." ] }, { "cell_type": "code", "execution_count": null, "id": "d5cf9777", "metadata": {}, "outputs": [], "source": [ "# s = mcf.McfSession(n_panels=3)\n", "# s.load_files(\n", "# ['layer_a.fits', 'layer_b.fits', 'layer_c.fits'],\n", "# colors=['#BE599E', '#DEA215', '#77C0F9'],\n", "# labels=['A', 'B', 'C'],\n", "# )\n", "# s.compose.combine_mode = 'lab' # recommended alternative to classic RGB sum\n", "# s.compose.combine_blend = 'screen'\n", "# s.compose.gamma = 2.2\n", "# s.compose.title = 'My target'\n", "# s.compose.show_legend = True\n", "# s.compose.show_combo_swatch = True # overlap preview matches combine_mode\n", "#\n", "# rgb = s.render_combined() # full float64 for export\n", "# # rgb = s.render_combined(preview=True) # fast float32 path while iterating\n", "# fig, ax = make_combined_figure(s, combined=rgb)\n", "# fig.savefig('combined.png', dpi=150, bbox_inches='tight')" ] }, { "cell_type": "markdown", "id": "6982479c", "metadata": {}, "source": [ "## One-shot helper (arrays already aligned)" ] }, { "cell_type": "code", "execution_count": null, "id": "f22c150a", "metadata": {}, "outputs": [], "source": [ "# rgb = mcf.combine_layers(\n", "# [data_a, data_b, data_c],\n", "# colors=['#BE599E', '#DEA215', '#77C0F9'],\n", "# colorspace='lab', blend='screen', gamma=2.2)" ] }, { "cell_type": "markdown", "id": "bb97d2f3", "metadata": {}, "source": [ "## GUI and export\n", "\n", "```python\n", "mcf.gui(session=s) # browser GUI (needs [web] or [all])\n", "# mcf.gui_qt(session=s) # desktop GUI (needs [qt] or [all])\n", "s.save_state('session.json')\n", "print(s.export_script()) # recreate the plot without the GUI\n", "```\n", "\n", "Need more than four layers? Both GUIs ship with **+ Add panel** (up to 16),\n", "or call `s.add_panel()` in scripts." ] }, { "cell_type": "code", "execution_count": null, "id": "15cd8808", "metadata": {}, "outputs": [], "source": [ "print('multicolorfits', mcf.__version__)" ] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent", "kernelspec": { "display_name": "Python 3", "name": "python3" }, "main_language": "python" } }, "nbformat": 4, "nbformat_minor": 5 }