<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Installation Instructions\n",
    "\n",
    "This notebook will go through the steps to install the Fermi Science Tools and then fermipy on top of them.  Note that this might not cover all of the specific things you might need to do on your own machine but hopefully will get you going on the way to getting everything working."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Scientific Linux\n",
    "\n",
    "Download the tools.  We suggest getting the binaries closest matching your system.  If you want to compile the Science Tools, that's fine but we can't help with any issues that might arise.\n",
    "\n",
    "http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/\n",
    "\n",
    "In this example, we're running a 64 bit Scientific Linux 6 distribution so we downloaded \n",
    "\n",
    "[ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.12A.tar.gz](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/tar/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.12A.tar.gz)\n",
    "\n",
    "Then, follow the [instructions about installing the tools](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/README_BINARY_INSTALL_FERMI.txt) from the FSSC."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## OSX\n",
    "\n",
    "Download the tools.  We suggest getting the binaries closest matching your system.  If you want to compile the Science Tools, that's fine but we can't help with any issues that might arise.\n",
    "\n",
    "http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/\n",
    "\n",
    "In this example, we're running a Yosemite distribution so we downloaded \n",
    "\n",
    "[ScienceTools-v10r0p5-fssc-patch-20150518-x86_64-apple-darwin14.4.0-without-root.tar.gz](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/tar/ScienceTools-v10r0p5-fssc-patch-20150518-x86_64-apple-darwin14.4.0-without-root.tar.gz)\n",
    "\n",
    "Then, follow the [instructions about installing the tools](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/README_BINARY_INSTALL_FERMI.txt) from the FSSC."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cleck to make sure things are working\n",
    "\n",
    "Just make sure things seem to be installed correctly\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ test_irfInterface\n",
    "........\n",
    "\n",
    "\n",
    "OK (8 tests)\n",
    "```\n",
    "\n",
    "Note that this doesn't test everything but it gives us some confidence that the installation was successful.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Get python setup for fermipy\n",
    "\n",
    "Now, we need to install several packages for fermipy to work.  The first thing to do is to make sure we're using the correct python (the one that's in the Science Tools).  Do this:\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ which python\n",
    "/usr/local/fermisoft/fssc_built/v10r0p5-fssc-patch-20150518/x86_64-apple-darwin14.4.0/bin/python\n",
    "```\n",
    "\n",
    "This will probably not point to the specific directory above but it should point to the python that you just installed with the Science Tools.  If it doesn't (i.e. if it points to `/usr/local/bin/python` or `/usr/bin/python` then you didn't setup the tools correctly.\n",
    "\n",
    "The other thing we'll need is a working copy of [pip](https://pip.readthedocs.org/en/stable/).  This isn't provided in the science tools so download it and install it.\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ wget https://bootstrap.pypa.io/get-pip.py\n",
    "\n",
    "[user@yosemite Working]$ python get-pip.py\n",
    "\n",
    "[user@yosemite Working]$ which pip\n",
    "/usr/local/fermisoft/fssc_built/v10r0p5-fssc-patch-20150518/x86_64-apple-darwin14.4.0/bin/pip\n",
    "```\n",
    "\n",
    "Once again, if this doesn't point to the pip in your science tools installation, something went wrong."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Install and upgrade some needed python packages\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ pip install ez_setup\n",
    "\n",
    "[user@yosemite Working]$ pip install --upgrade numpy\n",
    "[user@yosemite Working]$ pip install --upgrade matplotlib\n",
    "[user@yosemite Working]$ pip install --upgrade scipy\n",
    "[user@yosemite Working]$ pip install --upgrade astropy\n",
    "[user@yosemite Working]$ pip install --upgrade pyyaml\n",
    "[user@yosemite Working]$ pip install --upgrade healpy\n",
    "[user@yosemite Working]$ pip install --upgrade pywcsgrid2\n",
    "[user@yosemite Working]$ pip install --upgrade ipython\n",
    "[user@yosemite Working]$ pip install --upgrade jupyter\n",
    "```\n",
    "\n",
    "Note that the next step should also do this, but it seems like it fails sometimes if you don't do these commands manually first."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Install fermipy \n",
    "\n",
    "Note that this might download and install other packages that are needed (like astropy)\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ git clone https://github.com/fermiPy/fermipy.git\n",
    "\n",
    "[user@yosemite Working]$ cd fermipy\n",
    "[user@yosemite Working]$ python setup.py install\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Check to make sure that you can import fermipy\n",
    "\n",
    "```\n",
    "[user@yosemite Working]$ ipython\n",
    "Python 2.7.8 (default, Aug 20 2015, 11:36:15)\n",
    "Type \"copyright\", \"credits\" or \"license\" for more information.\n",
    "\n",
    "IPython 4.0.0 -- An enhanced Interactive Python.\n",
    "?         -> Introduction and overview of IPython's features.\n",
    "%quickref -> Quick reference.\n",
    "help      -> Python's own help system.\n",
    "object?   -> Details about 'object', use 'object??' for extra details.\n",
    "\n",
    "In [1]: from fermipy.gtanalysis import GTAnalysis\n",
    "Plotter is MatPlotlib\n",
    "\n",
    "In [2]: GTAnalysis?\n",
    "Init signature: GTAnalysis(self, config, **kwargs)\n",<commit_msg>Fine tuning the installation instructions.<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Installation Instructions\n",
    "\n",
    "This notebook will go through the steps to install the Fermi Science Tools and then fermipy on top of them.  Note that this might not cover all of the specific things you might need to do on your own machine but hopefully will get you going on the way to getting everything working."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Install the Science Tools"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Scientific Linux\n",
    "\n",
    "Download the tools.  We suggest getting the binaries closest matching your system.  If you want to compile the Science Tools, that's fine but we can't help with any issues that might arise.\n",
    "\n",
    "http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/\n",
    "\n",
    "In this example, we're running a 64 bit Scientific Linux 6 distribution so we downloaded \n",
    "\n",
    "[ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.12A.tar.gz](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/tar/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.12A.tar.gz)\n",
    "\n",
    "Then, follow the [instructions about installing the tools](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/README_BINARY_INSTALL_FERMI.txt) from the FSSC."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### OSX\n",
    "\n",
    "Download the tools.  We suggest getting the binaries closest matching your system.  If you want to compile the Science Tools, that's fine but we can't help with any issues that might arise.\n",
    "\n",
    "http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/\n",
    "\n",
    "In this example, we're running a Yosemite distribution so we downloaded \n",
    "\n",
    "[ScienceTools-v10r0p5-fssc-patch-20150518-x86_64-apple-darwin14.4.0-without-root.tar.gz](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/tar/ScienceTools-v10r0p5-fssc-patch-20150518-x86_64-apple-darwin14.4.0-without-root.tar.gz)\n",
    "\n",
    "Then, follow the [instructions about installing the tools](http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/README_BINARY_INSTALL_FERMI.txt) from the FSSC."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Cleck to make sure things are working\n",
    "\n",
    "Just make sure things seem to be installed correctly\n",
    "\n",
    "```\n",
    "[user@host Working]$ test_irfInterface\n",
    "........\n",
    "\n",
    "\n",
    "OK (8 tests)\n",
    "```\n",
    "\n",
    "Note that this doesn't test everything but it gives us some confidence that the installation was successful.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get python setup for fermipy\n",
    "\n",
    "Now, we need to install several packages for fermipy to work.  The first thing to do is to make sure we're using the correct python (the one that's in the Science Tools).  Do this:\n",
    "\n",
    "```\n",
    "[user@host Working]$ which python\n",
    "/usr/local/fermisoft/fssc_built/v10r0p5-fssc-patch-20150518/x86_64-apple-darwin14.4.0/bin/python\n",
    "```\n",
    "\n",
    "This will probably not point to the specific directory above but it should point to the python that you just installed with the Science Tools.  If it doesn't (i.e. if it points to `/usr/local/bin/python` or `/usr/bin/python` then you didn't setup the tools correctly.\n",
    "\n",
    "The other thing we'll need is a working copy of [pip](https://pip.readthedocs.org/en/stable/).  This isn't provided in the science tools so download it and install it.\n",
    "\n",
    "```\n",
    "[user@host Working]$ wget https://bootstrap.pypa.io/get-pip.py\n",
    "\n",
    "[user@host Working]$ python get-pip.py\n",
    "\n",
    "[user@host Working]$ which pip\n",
    "/usr/local/fermisoft/fssc_built/v10r0p5-fssc-patch-20150518/x86_64-apple-darwin14.4.0/bin/pip\n",
    "```\n",
    "\n",
    "Once again, if this doesn't point to the pip in your science tools installation, something went wrong."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Install and upgrade some needed python packages\n",
    "\n",
    "```\n",
    "[user@host Working]$ pip install ez_setup\n",
    "\n",
    "[user@host Working]$ pip install --upgrade numpy\n",
    "[user@host Working]$ pip install --upgrade matplotlib\n",
    "[user@host Working]$ pip install --upgrade scipy\n",
    "[user@host Working]$ pip install --upgrade astropy\n",
    "[user@host Working]$ pip install --upgrade pyyaml\n",
    "[user@host Working]$ pip install --upgrade healpy\n",
    "[user@host Working]$ pip install --upgrade pywcsgrid2\n",
    "[user@host Working]$ pip install --upgrade ipython\n",
    "[user@host Working]$ pip install --upgrade jupyter\n",
    "```\n",
    "\n",
    "Note that the next step should also do this, but it seems like it fails sometimes if you don't do these commands manually first."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Install fermipy \n",
    "\n",
    "Note that this might download and install other packages that are needed (like astropy)\n",
    "\n",
    "```\n",
    "[user@host Working]$ git clone https://github.com/fermiPy/fermipy.git\n",
    "\n",
    "[user@host Working]$ cd fermipy\n",
    "[user@host Working]$ python setup.py install\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Check to make sure that you can import fermipy\n",
    "\n",
    "```\n",
    "[user@host Working]$ ipython\n",
    "Python 2.7.8 (default, Aug 20 2015, 11:36:15)\n",
    "Type \"copyright\", \"credits\" or \"license\" for more information.\n",
    "\n",
    "IPython 4.0.0 -- An enhanced Interactive Python.\n",
    "?         -> Introduction and overview of IPython's features.\n",
    "%quickref -> Quick reference.\n",
    "help      -> Python's own help system.\n",
    "object?   -> Details about 'object', use 'object??' for extra details.\n",
    "\n",
    "In [1]: from fermipy.gtanalysis import GTAnalysis\n",
    "Plotter is MatPlotlib\n",
    "\n",
    "In [2]: GTAnalysis?\n",
    "Init signature: GTAnalysis(self, config, **kwargs)\n",
{'fraction_non_alphanumeric': 0.16610881917957498, 'fraction_numerical': 0.022262006694169844, 'mean_word_length': 2.9752475247524752, 'pattern_counts': {'":': 53, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1853455', 'n_tokens_mistral': 4689, 'n_tokens_neox': 4383, 'n_words': 1269}