{ "cells": [ { "cell_type": "markdown", "id": "f8082810", "metadata": {}, "source": [ "# NGC 602 — same pixel grid\n", "\n", "Download IR / R / B OpenFITS products from\n", "[Chandra OpenFITS](http://chandra.harvard.edu/photo/openFITS/multiwavelength_data.html).\n", "The frames already share a grid. Full narrative:\n", "[examples/ngc602](../examples/ngc602.md)." ] }, { "cell_type": "code", "execution_count": null, "id": "7ce853bd", "metadata": {}, "outputs": [], "source": [ "import multicolorfits as mcf\n", "from multicolorfits.figures import make_combined_figure\n", "\n", "FILES = [\n", " './ngc602_ir.fits',\n", " './ngc602_optical_R.fits',\n", " './ngc602_optical_B.fits',\n", "]\n", "COLORS = ['#BE599E', '#DEA215', '#77C0F9'] # purple / orange / blue\n", "LABELS = ['IR', 'R', 'B']" ] }, { "cell_type": "markdown", "id": "5c305203", "metadata": {}, "source": [ "## Session + Lab compositing" ] }, { "cell_type": "code", "execution_count": null, "id": "09d5da13", "metadata": {}, "outputs": [], "source": [ "# s = mcf.McfSession(n_panels=3)\n", "# s.load_files(FILES, colors=COLORS, labels=LABELS)\n", "# s.compose.combine_mode = 'lab'\n", "# s.compose.combine_blend = 'screen'\n", "# s.compose.gamma = 2.2\n", "# s.compose.title = 'NGC 602'\n", "# s.compose.show_legend = True\n", "# s.compose.show_combo_swatch = True\n", "#\n", "# rgb = s.render_combined()\n", "# fig, ax = make_combined_figure(s, combined=rgb)\n", "# fig.savefig('n602_POB_lab.png', dpi=150, bbox_inches='tight')" ] }, { "cell_type": "markdown", "id": "c5330795", "metadata": {}, "source": [ "White canvas without the legacy hex-invert + `inverse=True` path:\n", "\n", "```python\n", "s.compose.combine_background = 'white' # or 'transparent'\n", "```\n", "\n", "Interactive finishing:\n", "\n", "```python\n", "mcf.gui(session=s)\n", "print(s.export_script())\n", "```" ] }, { "cell_type": "markdown", "id": "98e94f2e", "metadata": {}, "source": [ "## Classic low-level pipeline\n", "\n", "Still fully supported for v2-compatible scripts." ] }, { "cell_type": "code", "execution_count": null, "id": "f1f48f85", "metadata": {}, "outputs": [], "source": [ "# import astropy.io.fits as pyfits\n", "#\n", "# ir, irhdr = pyfits.getdata(FILES[0], header=True)\n", "# R, Rhdr = pyfits.getdata(FILES[1], header=True)\n", "# B, Bhdr = pyfits.getdata(FILES[2], header=True)\n", "#\n", "# layers = []\n", "# for data, color in zip([ir, R, B], COLORS):\n", "# grey = mcf.to_grey_rgb(data, rescalefn='linear')\n", "# layers.append(mcf.colorize_image(grey, color, colorintype='hex'))\n", "#\n", "# pob_rgb = mcf.combine_multicolor(layers, gamma=2.2)\n", "# pob_lab = mcf.combine_multicolor_colorspace(\n", "# layers, colorspace='lab', blend='screen', gamma=2.2)\n", "#\n", "# mcf.plot_combined_rgb(\n", "# pob_lab, irhdr, 'NGC 602', 'n602_POB.jpg',\n", "# tickcolor='#D9D5C5', labelcolor='k', facecolor='w', minorticks=True)" ] }, { "cell_type": "markdown", "id": "e9156217", "metadata": {}, "source": [ "## North-up WCS\n", "\n", "OpenFITS NGC 602 is rotated ~90° from north. Either edit a dummy header and\n", "`reproject_image`, or (with `[reproject]`) align to ICRS from the session / GUI:\n", "\n", "```python\n", "s.align_panels(target='icrs') # or GUI: Align layers… → ICRS\n", "```\n", "\n", "Side-by-side Lab / RGB / HSV grids: [`examples/colorspace_comparison.md`](../../examples/colorspace_comparison.md)." ] }, { "cell_type": "code", "execution_count": null, "id": "027c0750", "metadata": {}, "outputs": [], "source": [ "print('Uncomment the cells above after downloading the OpenFITS products.')" ] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent", "kernelspec": { "display_name": "Python 3", "name": "python3" }, "main_language": "python" } }, "nbformat": 4, "nbformat_minor": 5 }