Added installation instructions.
Expanded installation instructions in the preface, readme, and appendix.
This commit is contained in:
parent
c71cac557f
commit
952d81e3ef
@ -259,13 +259,13 @@
|
||||
],
|
||||
"metadata": {},
|
||||
"output_type": "pyout",
|
||||
"prompt_number": 10,
|
||||
"prompt_number": 1,
|
||||
"text": [
|
||||
"<IPython.core.display.HTML at 0x7f51f8293748>"
|
||||
"<IPython.core.display.HTML at 0x7fb64d1ed5c0>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 10
|
||||
"prompt_number": 1
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -275,10 +275,135 @@
|
||||
"\n",
|
||||
"Another reason I choose it is because I find that a typical textbook leaves many things opaque. For example, there might be a beautiful plot next to some pseudocode. That plot was produced by software, but software that is not available to me as a reader. I want everything that went into producing this book to be available to the reader. How do you plot a covariance ellipse? You won't know if you read most books. With IPython Notebook all you have to do is look at the source code.\n",
|
||||
"\n",
|
||||
"A downside to this format is that you have to install IPython onto your machine if you want the book's interactive features. This is normally not an onerous burden as if you are interested in programming in Python you should already have Python installed on your system. \n",
|
||||
"Even if you choose to read the book online you will want Python and the SciPy stack installed so that you can write your own Kalman filters. There are many different ways to install these libraries, and I cannot cover them all, but I will cover a few typical scenerios."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Installing the SciPy Stack\n",
|
||||
"\n",
|
||||
"Still, I know I have not downloaded some IPython Notebooks that are of interest to me. There is the free nbviewer.org site which will statically render a notebook that is hosted elsewhere. My book is hosted on github, so you can always read my book for free by going to \n",
|
||||
"\n"
|
||||
"This book requires IPython, NumPy, SciPy, SymPy, and Matplotlib. The SciPy stack depends on third party Fortran and C code, and is *not* trivial to install from source code - even the SciPy website strongly urges using a prebuilt installation, and I concur with this advice.\n",
|
||||
"\n",
|
||||
"I use the Anaconda distribution from Continuum Analytics. This is an excellent package that combines all of the packages listed above, plus many others in one distribution. Installation is very straightforward, and it can be done alongside other Python installation you might already have on your machine. It is free to use, and Continuum Analytics will always ensure that the latest releases of all it's packages are available and built correctly for your OS. You may download it from here: http://continuum.io/downloads\n",
|
||||
"\n",
|
||||
"I strongly recommend using the latest Python 3 version that they provide; I am developing in Python 3.x, and only sporadically test that everything works in Python 2.7. However, it is my long term goal to support 2.7, and if you wish to either not be bothered with 3.x and are willing to be ocassionally frustrated with breaking check ins you may stick with Python 2.7.\n",
|
||||
"\n",
|
||||
"I am still writing the book, so I do not know exactly what versions of each package is required. I do strongly urge you to use IPython 2.0 or later (this version number has nothing to do with Python 2 vs 3, by the way), as it provides many useful features which I will explain later. \n",
|
||||
"\n",
|
||||
"There are other choices for installing the SciPy stack. The SciPy stack provides instructions here: http://scipy.org/install.html\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Manual Install of the SciPy stack\n",
|
||||
"\n",
|
||||
"This really isn't easy, and again I advice you to follow the advice of the SciPy website and to use a prepackaged solution. Still, I will give you one example of an install from a fresh operating system. You will have to adapt the instructions to fit your OS and OS version. I will use xubuntu, a linux distribution, because that is what I am most familiar with. I know there are prebuilt binaries for Windows (link provided on the SciPy installation webpage), and I have no experience with Mac and Python.\n",
|
||||
"\n",
|
||||
"I started by doing a fresh install of xubuntu 14.04 on a virtual machine. At that point there is a version of Python 2.7.6 and 3.4 preinstalled. As discussed above you may use either version; I will give the instructions for version 3.4 both because I prefer version 3 and because it can be slightly more tricky because 2.7 is the default Python that runs in xubuntu. Basically the difference is that you have to append a '3' at the end of commands. `python3` instead of `python`, `pip3` instead of `pip`, and so on.\n",
|
||||
"\n",
|
||||
"First we will install pip with the following command:\n",
|
||||
"\n",
|
||||
" sudo apt-get install python3-pip\n",
|
||||
" \n",
|
||||
" \n",
|
||||
"Now you will need to install the various packages from the Ubuntu repositories. Unfortunately they usually do not contain the latest version, so we will also install the development tools necessary to perform an upgrade, which requires compiling various modules.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" sudo apt-get install python3-numpy python3-scipy python3-matplotlib\n",
|
||||
" sudo apt_get install libblas-dev liblapack-dev gfortran python3-dev \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Now you can upgrade the packages. This will take a long time as everything needs to be compiled from source. If you get an error I do not know how to help you!\n",
|
||||
"\n",
|
||||
" sudo pip3 install numpy --upgrade\n",
|
||||
" sudo pip3 install scipy --upgrade\n",
|
||||
"\n",
|
||||
"Now you get to install SymPy. You can download it from github (replace version number with the most recent version):\n",
|
||||
"\n",
|
||||
" wget https://github.com/sympy/sympy/releases/download/sympy-0.7.6/sympy-0.7.6.tar.gz\n",
|
||||
" tar -zxvf sympy-0.7.6.tar.gz\n",
|
||||
"\n",
|
||||
"Now go into the directory you just extracted and run setup. \n",
|
||||
"\n",
|
||||
" sudo python3 setup.py install\n",
|
||||
" \n",
|
||||
" \n",
|
||||
"If all of this went without a hitch you should have a good install. Try the following. From the command line type `ipython3` to launch ipython, then issue the following commands. Each should run with no exceptions.\n",
|
||||
"\n",
|
||||
" import numpy as np\n",
|
||||
" import scipy as sp\n",
|
||||
" import sympy as sym\n",
|
||||
" np.__version__\n",
|
||||
" sp.__version__\n",
|
||||
" sum.__version__\n",
|
||||
" \n",
|
||||
"Now let's make sure plotting works correctly.\n",
|
||||
"\n",
|
||||
" import matplotlib.pyplot as plt\n",
|
||||
" plt.plot([1, 4, 3])\n",
|
||||
" plt.show()\n",
|
||||
" \n",
|
||||
"Now you get to fix IPython so ipython notebook will run. First, I had to uninstall IPython with\n",
|
||||
"\n",
|
||||
" sudo pip3 uninstall ipython\n",
|
||||
" \n",
|
||||
"Then, I reinstalled it with the `[all]` option so that all the required dependencies are installed.\n",
|
||||
"\n",
|
||||
" sudo pip3 install \"ipython3[all]\"\n",
|
||||
" \n",
|
||||
"Now test the installation by typing\n",
|
||||
"\n",
|
||||
" ipython notebook\n",
|
||||
" \n",
|
||||
"If successful, it should launch a browser showing you the IPython home page.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"That was not fun. It actually goes somewhat smoother in Windows, where you can download prebuilt binaries for these packages; however, you are dependent on this being done for you in a timely manner. So, please follow the SciPy advice and use a prebuilt distribution! I will not be supporting this manual install process.\n",
|
||||
"\n",
|
||||
"## Installing/downloading and running the book\n",
|
||||
"\n",
|
||||
"Okay, so now you have the SciPy stack installed, how do you download the book? This is easy as the book is in a github repository. From the command line type the following:\n",
|
||||
"\n",
|
||||
" git clone https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python.git\n",
|
||||
" \n",
|
||||
"Alternatively, browse to https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python and download it via your browser.\n",
|
||||
"\n",
|
||||
"Now, from the command prompt change to the directory that was just created, and then run ipython notebook:\n",
|
||||
"\n",
|
||||
" cd Kalman-and-Bayesian-Filters-in-Python\n",
|
||||
" ipython notebook\n",
|
||||
"\n",
|
||||
"A browser window should launch showing you all of the chapters in the book. Browse to the first chapter by clicking on it, then open the notebook in that subdirectory by clicking on the link.\n",
|
||||
"\n",
|
||||
"## Using IPython Notebook\n",
|
||||
"\n",
|
||||
"A complete tutorial on IPython Notebook is beyond the scope of this book. Many are available online. In short, Python code is placed in cells. These are prefaced with text like `In [1]:`, and the code itself is in a boxed area. If you press CTRL-ENTER while focus is inside the box the code will run and the results will be displayed below the box. Like this:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"print(3+7.2)"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"10.2\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 2
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If you have this open in ipython notebook now, go ahead and modify that code by changing the expression inside the print statement and pressing CTRL+ENTER. The output should be changed to reflect what you typed in the code cell."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -387,7 +387,9 @@
|
||||
"\n",
|
||||
"Personally, I use the Anaconda Python distribution in all of my work, [available here](https://store.continuum.io/cshop/anaconda/) [3]. I am not selecting them out of favoritism, I am merely documenting my environment. Should you have trouble running any of the code, perhaps knowing this will help you.\n",
|
||||
"\n",
|
||||
"Finally, you will need to install FilterPy, described in the next section."
|
||||
"Finally, you will need to install FilterPy, described in the next section.\n",
|
||||
"\n",
|
||||
"Installation of all of these packages is described in the Installation appendix, which you can read online [here](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/Appendix_A_Installation/Appendix_Installation.ipynb)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -205,6 +205,9 @@ Personally, I use the Anaconda Python distribution in all of my work, [available
|
||||
Finally, you will need to install FilterPy, described in the next section.
|
||||
|
||||
|
||||
Installation of all of these packages is described in the Installation appendix, which you can read online [here](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/Appendix_A_Installation/Appendix_Installation.ipynb).
|
||||
|
||||
|
||||
Provided Libraries and Modules
|
||||
-----
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user