{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pylab as plt\n", "from astropy.coordinates import SkyCoord\n", "from astropy import units as u" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Define cluster, make a SkyCoord object to hold its position" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cluster_name='Abell2065'\n", "\n", "# coordinates given here http://burro.case.edu/Academics/Astr306/ClustAGN/getSDSS.html\n", "# redshifts worked out using the SDSSanalysis notebook\n", "\n", "if cluster_name == 'Abell2065':\n", " cluster_ra, cluster_dec = 230.62156, 27.70763\n", " cluster_redshift, redshift_low, redshift_high = 0.072, 0.06, 0.08\n", "\n", "if cluster_name == 'Abell2063':\n", " cluster_ra, cluster_dec = 230.77116, 8.60859\n", " #fill in this next line in based on your SDSSanalysis\n", " cluster_redshift, redshift_low, redshift_high = 0, 0, 0\n", " \n", "if cluster_name == 'Abell1795':\n", " cluster_ra, cluster_dec = 207.21886, 26.59160\n", " #fill in this next line in based on your SDSSanalysis\n", " cluster_redshift, redshift_low, redshift_high = 0, 0, 0\n", " \n", "cluster_pos=SkyCoord(cluster_ra,cluster_dec,unit='deg',frame='icrs')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Read table of SDSS sources" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# read SDSS datafile\n", "from astropy.io import ascii\n", "SDSS=ascii.read(cluster_name+'_SDSS.csv')\n", "print('{} objects in SDSS table'.format(len(SDSS)))\n", "print('SDSS column names: ',SDSS.colnames)\n", "\n", "# give objects their skycoords\n", "gal_coo=SkyCoord(SDSS['ra'],SDSS['dec'],unit='deg')\n", "SDSS['angdist_arcsec']=gal_coo.separation(cluster_pos).arcsec\n", "\n", "# define which ones are spectroscopically confirmed to be in the cluster\n", "spec_conf=np.logical_and(SDSS['redshift']>redshift_low,\n", " SDSS['redshift'] -0.5\n", " get_cols=['RAICRS','DEICRS','r0','S/N','F90b','b_F90b','B_F90b','HRhs']\n", " \n", " # and these are the filters we want to use\n", " # we only want point sources, not extended sources: fe=0\n", " # we only want sources detected in the ACIS image: F90b>0\n", " # we only want sources with S/N > 2\n", " use_filters={\"fe\":\"=0\",\"F90b\":\">0\",\"S/N\":\">2\"}\n", " \n", " # set up a Vizier query function\n", " v=Vizier(columns=get_cols,column_filters=use_filters)\n", " # set ROW_LIMIT=-1 which means no limit -- get all the data that satisfy the query\n", " v.ROW_LIMIT=-1\n", " \n", " # query Vizier for objects in a 0.5 degree radius around the position \n", " # of the cluster, getting the data from catalog \"IX/57\" (which is the Chandra\n", " # source catalog). The [0] thing just means get the first data table, which\n", " # in our case is the only data table.\n", " CHANDRA=v.query_region(cluster_pos,width=\"0.5d\",catalog=\"IX/57\")[0]\n", " \n", " # write the downloaded data to a local file for subsequent use\n", " CHANDRA.write(cluster_name+'_CHANDRA.csv') \n", " print('Wrote {}_CHANDRA.csv'.format(cluster_name))\n", "\n", "print('{} objects in Chandra table'.format(len(CHANDRA)))\n", "print('Chandra column names: ',CHANDRA.colnames)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Match sources from the SDSS data to the sources in the Chandra data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# make a sky coordinate object for all the objects in the SDSS catalog....\n", "sdss_coord=SkyCoord(SDSS['ra'],SDSS['dec'], unit='deg', frame='icrs')\n", "\n", "# ....and for all the objects in the Chandra catalog\n", "chandra_coord=SkyCoord(CHANDRA['RAICRS'],CHANDRA['DEICRS'], unit='deg', frame='icrs')\n", "\n", "# now for each chandra_coord, match it to the nearest sdss coord using sky coords (ra,dec)\n", "# idx lists (for each chandra source) the row number in the SDSS table that contains the\n", "# closest match.\n", "# d2d is the 2D separation between the sources (angle on the sky)\n", "# d3d is the 3D separation, which is meaningless for us, since we dont have distances\n", "idx, d2d, d3d = chandra_coord.match_to_catalog_sky(sdss_coord)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Examine a few matches" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# print out 1st three matches\n", "for i in range(3):\n", " print('Chandra object {}:'.format(i))\n", " print(' X-ray positional uncertainty = {:.2f} arcsec'.format(CHANDRA['r0'][i]))\n", " print(' Closest match to SDSS object {}'.format(idx[i]))\n", " print(' Match distance = {:.2f} arcsec'.format(d2d[i].arcsec))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Make a merged crossmatch table of the Chandra sources and the matched SDSS sources" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# now make a merged list by \"horizontally stacking\" the two tables: CHANDRA and SDSS[idx]\n", "from astropy.table import hstack\n", "CROSSMATCHED=hstack([CHANDRA,SDSS[idx]])\n", "# add a column that shows the separation in arcsec\n", "CROSSMATCHED['match_sep']=d2d.arcsec\n", "# and rename some columns so it's clear which coordinate is which\n", "CROSSMATCHED.rename_column('RAICRS','ra_chandra')\n", "CROSSMATCHED.rename_column('DEICRS','dec_chandra')\n", "CROSSMATCHED.rename_column('ra','ra_SDSS')\n", "CROSSMATCHED.rename_column('dec','dec_SDSS')\n", "\n", "# Note: when looking at matched sources in SDSS Navigator, you ALWAYS want to \n", "# use the SDSS coords, not the CHANDRA coords. But you should also pay\n", "# attention to how big the separation between the CHANDRA and SDSS coords is,\n", "# in order to judge whether or not its a good crossmatch!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Look at your table!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print('{} objects in table'.format(len(CROSSMATCHED)))\n", "print('Column names: ',CROSSMATCHED.colnames)\n", "\n", "CROSSMATCHED.show_in_browser(jsviewer=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Think about your X-ray source catalog\n", "\n", "Make the following plots:\n", "\n", "1. **log10(X-ray flux) vs X-ray S/N**\n", "2. **X-ray position uncertainty vs log10(X-ray flux)**\n", "3. **X-ray position uncertainty vs X-ray S/N**\n", "\n", "*Do these plots make sense?*" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plot X-ray hardness vs X-ray S/N\n", "\n", "Which objects are most likely to be AGN? Objects with X-ray hardness ('HRhs') > -0.5 have a very hard spectrum (dominated by high-energy X-rays) and are likely AGN. Softer X-ray sources are less likely to be AGN (but still could be!)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plot X-ray position uncertainty vs Chandra-SDSS separation\n", "\n", "*Which sources look well-matched? Which do not? **Define a \"well-matched criterion** and make a flag saying which sources are well-matched.*" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Make a cluster color magnitude diagram (CMD)\n", "\n", "Plot g-r vs r-mag for the follwing SDSS sources, each with a different color / marker style:\n", "1. all SDSS point sources (SDSS['type']=6) projected inside 1 Mpc of the cluster\n", "2. all SDSS resolved sources (SDSS['type']=3) projected inside 1 Mpc of the cluster\n", "3. all SDSS spectroscopically confirmed galaxies (i.e., with redshifts in the cluster range)\n", "4. all SDSS sources **well-matched** to X-ray sources projected inside 1 Mpc of the cluster\n", "\n", "*Tip: remember to set your axes appropriately: r-mag should go from 13 to 24, and g-r color should go from -1 to +2.*" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Look at your well-matched sources in Navigator\n", "\n", "Look at a table of your **well-matched** X-ray sources projected within 1 Mpc of the cluster center. Get the **SDSS positions** of the X-ray sources that are possible cluster members, and look them up using SDSS Navigator. What do they look like, morphologically? Spectroscopically? Do they have redshifts? If so, are they in the cluster? If not, what's your best guess?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# your code here" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.5" } }, "nbformat": 4, "nbformat_minor": 4 }