<commit_before>{
 "metadata": {
  "name": "",
  "signature": "sha256:3522e64f20dfdd23ce8ef95a6292c1a9867e26db9025ae0d976b08571e36bda1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Exercises for Catalogs and Colors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "1. Converting to Magnitudes"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Write a function that takes a FITS table (a special 1-d `numpy.ndarray`, as we've discussed), a magnitude zeropoint ($m_0$), and a `dict` that maps the name of the filter to the name of a flux column, and returns a `dict` of arrays of magnitudes.  In other words, I should be able to call:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [
      "mags = getMagnitudes(table, magzero, {\"r\": \"R_FLUX_KRON\", \"i\": \"I_FLUX_KRON\"})"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "...and be able to say `mags[\"r\"]` to get a `numpy.ndarray` of all the *r* magnitudes."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "2. Filtering the catalog"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Modify your function to only include rows where none of the magnitudes are NaN or infinite.  Some `numpy` functions you may want to look up and use:\n",
      " - `numpy.logical_and`\n",
      " - `numpy.isfinite` (note that this can also help check for NaNs)\n",
      "Make sure each magnitude array your function returns is consistent (i.e. they all include the same rows).  So you can't just exclude the NaN $r$ magnitudes from the $r$ array, while leaving them in the $i$ array."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "3. A Color-Color Plot"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Make a plot of $g-r$ vs $i-z$, using your function to extract magnitudes from the catalog.  Use `27.0` for the magnitude zeropoint, and the `KRON` fluxes in the catalog."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "4. A Color-Magnitude Plot"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Make a plot of $r$ vs $g-r$.  This time use `PSF` fluxes from the catalog, again with `magzero=27.0`."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [<commit_msg>Tweaks to day 4 exercises.<commit_after>{
 "metadata": {
  "name": "",
  "signature": "sha256:3f2ae9317812164b00be23078f93bfa82f23097a520acaaeb6da598ff1b5b3b7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Exercises for Catalogs and Colors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "1. Converting to Magnitudes"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Write a function that takes a FITS table (a special 1-d `numpy.ndarray`, as we've discussed), a magnitude zeropoint ($m_0$), and a `dict` that maps the name of a filter to the name of a flux column, and returns a `dict` of arrays of magnitudes.  In other words, I should be able to call:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [
      "mags = getMagnitudes(table, magzero, {\"r\": \"R_FLUX_KRON\", \"i\": \"I_FLUX_KRON\"})"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "...and be able to say `mags[\"r\"]` to get a `numpy.ndarray` of all the *r* magnitudes."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "2. Filtering the catalog"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Modify your function to only include rows where none of the magnitudes are NaN or infinite.  Some `numpy` functions you may want to look up and use:\n",
      " - `numpy.logical_and`\n",
      " - `numpy.isfinite` (note that this can also help check for NaNs)\n",
      "Make sure each magnitude array your function returns is consistent (i.e. they all include the same rows).  So you can't just exclude the NaN $r$ magnitudes from the $r$ array, while leaving them in the $i$ array."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "3. A Color-Color Plot"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Make a plot of $g-r$ vs $i-z$, using your function to extract magnitudes from the catalog.  Use `27.0` for the magnitude zeropoint, and the `KRON` fluxes in the catalog.\n",
      "\n",
      "Adjust the axes limits so you can get a good view of most of the points."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "4. A Color-Magnitude Plot"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Make a plot of $r$ vs $g-r$.  This time use `PSF` fluxes from the catalog, again with `magzero=27.0`.  Again, find some reasonable axes limits (and think about how you might want to save them so you don't have to set them manually every time)."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
{'fraction_non_alphanumeric': 0.16207644800534135, 'fraction_numerical': 0.02103154732098147, 'mean_word_length': 2.2707423580786026, 'pattern_counts': {'":': 108, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6918507', 'n_tokens_mistral': 2140, 'n_tokens_neox': 2016, 'n_words': 635}