Getting Started


need conda use conda-forge channel to get holopy import holopy

If this line works, skip to usage before diving into the tutorials. .. _dependencies:


TODO: list all dependencies??

Optional dependencies for certain calculations:

  • a-dda (Discrete Dipole calculations of arbitrary scatterers)
  • mayavi2 (if you want to do 3D plotting)

Windows Support

HoloPy is not currently supported on Windows due to Fortran compiler issues. If this is an area you know something about, we welcome any assistance in getting things working. In the mean time, your best option is probably to run a linux virtual machine on your Windows computer.

Using HoloPy

You will probably be most comfortable using HoloPy in Jupyter (resembles Mathematica) or Spyder (resembles Matlab) interfaces. One perennially tricky issue concerns matplotlib backends. HoloPy is designed to be used with an interactive backend. Try running:

from holopy import test_disp

You should see a window pop up with an image, and you should be able to change the square to a circle or diamond by using the left/right arrow keys. If you can, then you’re all set! Check out our Loading Data tutorial to start using HoloPy. If you don’t see an image, or if the arrow keys don’t do anything, you can try setting your backend with one of the following:

%matplotlib tk
%matplotlib qt
%matplotlib gtk
%matplotlib gtk3

If the one that you tried gave an ImportError, you should restart your kernel and try another. Note that there can only be one matplotlib backend per ipython kernel, so you have the best chance of success if you restart your kernel and immediately enter the %matplotlib command before doing anything else. Sometimes a backend will be chosen for you (that cannot be changed later) as soon as you plot something, for example by running test_disp() or show(). Trying to set to one of the above backends that is not installed will result in an error, but will also prevent you from setting a different backend until you restart your kernel.

An additional option in Spyder is to change the backend through the menu: Tools > Preferences > IPython console > Graphics. It will not take effect until you restart your kernel, but it will then remember your backend for future sessions, which can be convenient. An additional option in jupyter is to use % matplotlib nbagg to use inline interactive plots.