Setting Up Anaconda for Scientific Python

Python is great. Not only is it relatively easy to learn, but it is extremely robust when it comes to gathering, processing, and plotting data, thanks to free open-source libraries like numpy, matplotlib, and pandas. The power that you get from using Python is comparable to other software solutions, such as MATLAB, which will set you back around $100 for a one time purchase, or about $50/year if you want continuous upgrades. Additionally, Python code objectively looks cleaner than MATLAB codoe.

These are all reasons why I use Python 5 days a week for my work at Stanford University. I'm a huge proponent of Python, and frequently recommend it to colleagues at work as well as those interested in getting started with Python.

If you run a Mac or a Unix system, chances are you already have Python on your system. This is fine if you want to run basic python scripts, but if you want to run numpy and other scientific packages, you probably should install Anaconda, which does all the dirty work of managing these packages. I've included the link there since it already contains information on setting it up.

Once you've got it all set up, you should have access to the superb Jupyter Notebook environment, which makes it super easy to write, test, share, and publish code and results.

If you're a developer or a researcher, the final step in setting up is including your custom packages in Anaconda's search path. To find your environment, open a python shell (You'll see a >>>) and get the file path for your packages.

>>> import numpy
>>> numpy.__file__

I have two computers that I do research and developing on: my laptop and a desktop in the lab. I use Git to do version control of my packages that I develop, and use Dropbox to keep everything synced between computers. One repository is called hardware, and has the following directory structure at /Users/wheelerj/Dropbox/digonnet/hardware

├── docs
│   ├── Makefile
│   ├──
│   ├── index.rst
│   ├── make.bat
│   └── modules
│       ├── data_acquisition_units.rst
│       ├── function_generators.rst
│       ├── gyros.rst
│       ├── laser_diode_drivers.rst
│       ├── lock_in_amplifiers.rst
│       ├── optical_power_meters.rst
│       ├── oscilloscopes.rst
│       ├── rotation_stages.rst
│       └── spectrum_analyzers.rst
└── hardware

In order for Anaconda to see this, I navigate to my Anaconda site-packages folder, and create a symbolic link.

$ cd /Users/wheelerj/miniconda3/lib/python3.5/site-packages/
$ ln -s /Users/wheelerj/Dropbox/digonnet/hardware/hardware hardware

(The reason why hardware is repeated three times is because there is a package called hardware inside a Git repository named hardware. The final instance of hardware is the name of the link that sits inside of /site-packages)

On Windows, you can do a similar command, but instead of ln -s you run mklink /j followed by the folder you want to link to.