{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SourceList and AssociateList Exercises\n", "\n", "For the OmegaCAM data used in earlier exercises, make a SourceList each for 2 ReducedScienceFrames (they overlap). Set the SExtractor detection threshold to 6.0\n", "Lets find the ReducedScienceFrames we made earlier and pick two:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "context.set_project('TUTORIAL')\n", "context.set_privileges(1)\n", "print(context.get_current_project())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "reds = (ReducedScienceFrame.chip.name == 'ESO_CCD_#65').user_only().project_only()\n", "filename1 = reds[0].filename\n", "filename2 = reds[1].filename\n", "p = Pars(SourceList, instrument='OMEGACAM')\n", "p.SourceList.sexconf.DETECT_THRESH = 6.0\n", "pars = p.get()\n", "task = SourceListTask(filenames=[filename1], pars=pars, commit=1)\n", "task.execute()\n", "task = SourceListTask(filenames=[filename2], pars=pars, commit=1)\n", "task.execute()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For one of the SourceLists you just made, obtain the number of sources in the sourcelist, find the brightest source, and obtain its half-light radius.\n", "The final line printed by the task should have displayed the SourceList identifier (SLID), which can be used to query directly (use your own SLID instead of the one below):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sl = (SourceList.SLID == SLID)[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Alternatively, select the most recent SourceList created by yourself:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sl = (SourceList.SLID > 61771701).user_only().max('SLID')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get the information from the SourceList:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(sl.number_of_sources)\n", "magsid = [(src['MAG_ISO'], src['SID']) for src in sl.sources]\n", "magsid.sort()\n", "print(magsid[0])\n", "sl.sources[230]['SID'], sl.sources[230]['FLUX_RADIUS']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Find out the piece of sky covered by the USNO catalogue in the database." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "usno = (SourceList.name == 'USNO-A2.0')[0]\n", "RA, DEC = usno.sources.RA, usno.sources.DEC\n", "print(max(RA), min(DEC), min(RA), max(DEC))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is the current coverage as of 7/7/2014 of the USNO-A2.0 catalogue in the Astro-WISE database.\n", "Find the B and R mags of the sources in the USNO catalog which are inside a distance of 0.1 degrees of position (12.0°, -29.0°)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(usno.info())\n", "attrs = { 'RA': [], 'DEC': [], 'USNO_RMAG': [], 'USNO_BMAG': [] }\n", "area = (12.0, -29.0, 0.1)\n", "r = usno.sources.area_search(Area=area, attr_dict=attrs)\n", "nos = len(r[usno.SLID])\n", "for k in range(nos): print(attrs['RA'][k], attrs['DEC'][k], attrs['USNO_BMAG'][k], attrs['USNO_RMAG'][k])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "AssociateLists are (among others) used for the Global Astrometric Solution. Lets find which sources are the same in the two SourceLists we have made:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "task = AssociateListTask(ids=[(SLID1, 's'), (SLID2, 's')], commit=True)\n", "task.execute()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As before, the final line printed by the task shows the AssociateList identifier (ALID). Get it:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "al = (AssociateList.ALID == ALID)[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Check the sourcelists it has been made from are the ones created above and find out the pointing of the telescope and CCD names of the exposures used." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for sl in al.sourcelists: print(sl.SLID, sl.frame.chip.name, sl.frame.astrom.CRVAL1, sl.frame.astrom.CRVAL2)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.1" } }, "nbformat": 4, "nbformat_minor": 1 }