\n", "
\n", "

\n", "
\n", "
\n", "

## How large is the image?

\n", "
\n", "
\n", "To get a little practise using Astropy's WCS calculate the world coordinates of the following pixels:\n", "```\n", "[-500, 0]\n", "[500, 500]\n", "[0, 0]\n", "```\n", "
\n", "
\n", "
\n", "

\n", "
\n", "
\n", "Now we have a nice plot with physically meaningful ticks, we should label our axes.\n", "
\n", "\n", "Add labels to the axes saying \"Right Ascension [degrees]\" and \"Declination [degrees]\"\n", "
\n", "\n", "Also overlay a coordinate grid using:\n", "`ax.coords.grid()`\n", "Look up the documentation for this method to see what parameters you can specify.\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "autoscroll": "json-false", "collapsed": false, "ein.tags": [ "worksheet-0" ] }, "outputs": [], "source": [ "ax = plt.subplot(111, projection=wcs)\n", "ax.imshow(hdulist[0].data, cmap='gray', vmax=1000, interpolation=None, origin='lower')\n", "ax.set_xlabel(\"Right Ascension [degrees]\")\n", "ax.set_ylabel(\"Declination [degrees]\")\n", "ax.coords.grid(color='white', alpha=0.5, linestyle='solid')" ] }, { "cell_type": "markdown", "metadata": { "ein.tags": [ "worksheet-0" ] }, "source": [ "Now we have a nice plot, we can do a couple of things to plot." ] }, { "cell_type": "markdown", "metadata": { "ein.tags": [ "worksheet-0" ] }, "source": [ "### Overplotting in Pixel Coordinates" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "autoscroll": "json-false", "collapsed": false, "ein.tags": [ "worksheet-0" ] }, "outputs": [], "source": [ "ax = plt.subplot(111, projection=wcs)\n", "\n", "ax.imshow(hdulist[0].data, cmap='gray', vmax=1000, interpolation=None, origin='lower')\n", "ax.set_xlabel(\"Right Ascension [degrees]\")\n", "ax.set_ylabel(\"Declination [degrees]\")\n", "ax.coords.grid(color='white', alpha=0.5, linestyle='solid')\n", "\n", "ax.plot(3000, 3000, 'o')" ] }, { "cell_type": "markdown", "metadata": { "ein.tags": [ "worksheet-0" ] }, "source": [ "### Overplotting in World Coordinates" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "autoscroll": "json-false", "collapsed": false, "ein.tags": [ "worksheet-0" ] }, "outputs": [], "source": [ "ax = plt.subplot(111, projection=wcs)\n", "\n", "ax.imshow(hdulist[0].data, cmap='gray', vmax=1000, interpolation=None, origin='lower')\n", "ax.set_xlabel(\"Right Ascension [degrees]\")\n", "ax.set_ylabel(\"Declination [degrees]\")\n", "ax.coords.grid(color='white', alpha=0.5, linestyle='solid')\n", "\n", "ax.set_autoscale_on(False)\n", "\n", "ax.plot(3000, 3000, 'o')\n", "# Overplot in FK5 in Degrees\n", "ax.plot(189.25, 14.23, 'o', transform=ax.get_transform('world'))" ] }, { "cell_type": "markdown", "metadata": { "ein.tags": [ "worksheet-0" ] }, "source": [ "
\n", "
\n", "