{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Image registration\n", "\n", "In some cases a calibration image of a field containing a lot of stars obtained with SITELLE in the same filter and during the same run as the science data can be used to compute a distortion model that can be then used directly to enhance the astrometrical calibration of the science cube which may have much less stars. The distortion model is then kept as is and only the basic registration parameters are recomputed (see Martin el al. 2017, http://adsabs.harvard.edu/abs/2017arXiv170701366M)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pylab as pl\n", "import orb.image\n", "import logging\n", "# useful to get logging output. orb and orcs use the logging package which is automatically set to INFO level when a cube is loaded.\n", "# But, as we are not loading a cube this time and only working on images, you must do it manually.\n", "logging.getLogger().setLevel(logging.INFO) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Initial calibration\n", "`target_ra` and `target_dec` are the celestial coordinates at the center of the image.\n", "\n", "**note: this process can be done in two steps. For the first step we are only concerned with the calibration of the center of the image. During the second step a distortion model is computed over the whole field of view**. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "im = orb.image.Image('M1-71_SN3.merged.InterferogramMerger.deep_frame.fits', instrument='sitelle')\n", "# in case any wrong wcs parameters were stored in the header, it is safe to reset the wcs to get a fresh start before the registration.\n", "im.reset_wcs(294.1120729, 19.70678597) \n", "im.register()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:Data written as M1-71.deep_frame.wcs.init.fits in 0.05 s \n" ] } ], "source": [ "# the HDF5 format is the native format for orb and orcs and you are sure to keep all the data with it. \n", "# But for an image you can, in principle, safely use the fits format.\n", "im.writeto('M1-71.deep_frame.wcs.init.hdf5') \n", "im.to_fits('M1-71.deep_frame.wcs.init.fits')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:Sending query to VizieR server (catalog: gaia2)\n", "INFO:root:Looking for stars at RA: 294.113293 DEC: 19.706693\n", "INFO:root:1000 stars recorded in the given field\n", "INFO:root:Magnitude min: 9.5522, max:17.1995\n" ] } ], "source": [ "# now we will check the results of the calibration by loading the positions of the stars in the field from the gaia catalog \n", "# before plotting them on the image\n", "im = orb.image.Image('M1-71.deep_frame.wcs.init.hdf5')\n", "sl = im.get_stars_from_catalog(max_stars=1000)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | x | \n", "y | \n", "ra | \n", "dec | \n", "
|---|---|---|---|---|
| 0 | \n", "1264.454377 | \n", "286.145713 | \n", "294.091757 | \n", "19.639255 | \n", "
| 1 | \n", "1724.392602 | \n", "1250.186154 | \n", "294.045982 | \n", "19.725027 | \n", "
| 2 | \n", "419.186355 | \n", "1268.322106 | \n", "294.170612 | \n", "19.728998 | \n", "
| 3 | \n", "902.256353 | \n", "1206.209789 | \n", "294.124590 | \n", "19.722561 | \n", "
| 4 | \n", "1696.768721 | \n", "562.242566 | \n", "294.049953 | \n", "19.663274 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 654 | \n", "1471.934583 | \n", "2031.989426 | \n", "294.068588 | \n", "19.795722 | \n", "
| 655 | \n", "1948.153033 | \n", "1610.327001 | \n", "294.023907 | \n", "19.756971 | \n", "
| 656 | \n", "1561.509786 | \n", "1794.601911 | \n", "294.060488 | \n", "19.774233 | \n", "
| 657 | \n", "2003.091878 | \n", "1433.274841 | \n", "294.019005 | \n", "19.740964 | \n", "
| 658 | \n", "1237.617490 | \n", "1228.616455 | \n", "294.092516 | \n", "19.723973 | \n", "
659 rows × 4 columns
\n", "