{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Reading XShooter data with xtool ###" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from xtool.data import XShooterData" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xd = XShooterData('xtool_ds') # with the absolute or relative path given\n", "xd" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "#### You can access the individual orders given in the dataset by just indexing the dataset ####" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xd[11]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "ename": "IndexError", "evalue": "Dataset only contains orders 11 - 26", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mxd\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m/Users/wkerzend/projects/eso/xtool/xtool/data.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m 52\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mitem\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0morder_table\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 53\u001b[0m raise IndexError('Dataset only contains orders {0} - {1}'.format(\n\u001b[0;32m---> 54\u001b[0;31m self.order_table.index.min(), self.order_table.index.max()))\n\u001b[0m\u001b[1;32m 55\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 56\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mOrder\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_xshooter_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mIndexError\u001b[0m: Dataset only contains orders 11 - 26" ], "output_type": "error" } ], "source": [ "xd[5]" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "#### Each order contains the cutout of the order in masked arrays that cutout intraorder regions. ####" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "order = xd[11]" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Each one of the order objects also contains a WCS that can transform between pixelspace and woorld coordinate system (angstrom, slit position)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(2474.587158203125, 0.5863650441169739)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "order.wcs(51, 52)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2.0 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" } }, "nbformat": 4, "nbformat_minor": 0 }