<commit_before><commit_msg>initial crossmatch coded<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Making a Lightcurve from PTF catalog data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import astropy.io.fits as fits\n",
    "import astropy.coordinates as coords\n",
    "import astropy.units as u\n",
    "from astropy.time import Time\n",
    "from glob import glob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "reference_catalog = '../data/PTF_Refims_Files/PTF_d022683_f02_c06_u000114210_p12_sexcat.ctlg'\n",
    "# select R-band data (f02)\n",
    "epoch_catalogs = glob('../data/PTF_Procim_Files/PTF*f02*.ctlg')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "72"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(epoch_catalogs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def load_ref_catalog(reference_catalog):\n",
    "    hdus = fits.open(reference_catalog)\n",
    "    data = hdus[1].data\n",
    "    # filter flagged detections\n",
    "    w = (data['flags'] & 506 == 0)\n",
    "    data = data[w]\n",
    "\n",
    "    ref_coords = coords.SkyCoord(data['X_WORLD'], data['Y_WORLD'],frame='icrs',unit='deg')\n",
    "\n",
    "    return np.vstack([data['MAG_AUTO'],data['MAGERR_AUTO']]).T, ref_coords"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "ref_mags, ref_coords = load_ref_catalog(reference_catalog)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14043"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(ref_mags)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# optional: progress bar\n",
    "def load_progress_bar():\n",
    "    import uuid\n",
    "    from IPython.display import HTML, Javascript, display\n",
    "    import time\n",
    "\n",
    "    divid = str(uuid.uuid4())\n",
    "    pb = HTML(\n",
    "\"\"\"\n",
    "<div style=\"border: 1px solid black; width:500px\">\n",
    "  <div id=\"%s\" style=\"background-color:blue; width:0%%\">&nbsp;</div>\n",
    "</div> \n",
    "\"\"\" % divid)\n",
    "    display(pb)\n",
    "    return divid\n",
    "#for i in range(1,101):\n",
    "#    time.sleep(0.1)\n",
    "    \n",
    "#    display(Javascript(\"$('div#%s').width('%i%%')\" % (divid, i)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def crossmatch_epochs(reference_coords, epoch_catalogs):\n",
    "    \n",
    "    n_stars = len(reference_coords)\n",
    "    n_epochs = len(epoch_catalogs)\n",
    "    \n",
    "    mags = np.ma.zeros([n_stars, n_epochs])\n",
    "    magerrs = np.ma.zeros([n_stars, n_epochs])\n",
    "    mjds = np.ma.zeros(n_epochs)\n",
    "    \n",
    "    divid = load_progress_bar()\n",
    "    for i, catalog in enumerate(epoch_catalogs):\n",
    "        #print catalog\n",
    "        hdus = fits.open(catalog)\n",
    "        data = hdus[1].data\n",
    "        hdr = hdus[2].header\n",
    "        # filter flagged detections\n",
    "        w = ((data['flags'] & 506 == 0) & (data['imaflags_iso'] & 1821 == 0))\n",
    "        data = data[w]\n",
    "\n",
    "        epoch_coords = coords.SkyCoord(data['X_WORLD'], data['Y_WORLD'],frame='icrs',unit='deg')\n",
    "        idx, sep, dist = coords.match_coordinates_sky(epoch_coords, reference_coords)\n",
    "        \n",
    "        wmatch = (sep <= 1.5*u.arcsec)\n",
    "        \n",
    "        # store data\n",
    "        if np.sum(wmatch):\n",
    "            mags[idx[wmatch],i] = data[wmatch]['MAG_AUTO'] + data[wmatch]['ZEROPOINT']\n",
    "            magerrs[idx[wmatch],i] = data[wmatch]['MAGERR_AUTO']\n",
    "            mjds[i] = hdr['OBSMJD']\n",
    "\n",
    "        display(Javascript(\"$('div#%s').width('%i%%')\" % (divid, i//n_epochs)))\n",
    "    return mjds, mags, magerrs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div style=\"border: 1px solid black; width:500px\">\n",
       "  <div id=\"d8d912e5-4209-4e45-9005-4918260eb6f3\" style=\"background-color:blue; width:0%\">&nbsp;</div>\n",
       "</div> \n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "$('div#d8d912e5-4209-4e45-9005-4918260eb6f3').width('0%')"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mjds,mags,magerrs = crossmatch_epochs(ref_coords, epoch_catalogs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "93.9208984375"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mags.max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
{'fraction_non_alphanumeric': 0.20803152561456184, 'fraction_numerical': 0.07562394445486958, 'mean_word_length': 2.063462865026443, 'pattern_counts': {'":': 467, '<': 85, '<?xml version=': 0, '>': 84, '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': '4494612', 'n_tokens_mistral': 11181, 'n_tokens_neox': 10349, 'n_words': 1026}