Installing on Linux

On macOS, the easiest way to install HyperSpy is to use the HyperSpy bundle installer. This simple to install program provides a customized Anaconda installation, which contains the HyperSpy libraries but also other libraries used in the field of electron microsocpy.

Download

First, download the installer using the following link (https://github.com/ericpre/hyperspy-bundle/releases):

Links HyperSpy bundle downloads

Download the installer corresponding to your system.

Installing

The process is exactly the same as installing miniconda or anaconda:

  1. In your terminal window, run:

    bash HyperSpy-bundle-2020.01.26-Linux-x86_64.sh
    
  2. Follow the prompts on the installer screens. If you are unsure about any setting, accept the defaults. You can change them later.

  3. To make the changes take effect, close and then re-open your terminal window.

  4. Test your installation. In your terminal window, run the command conda list. A list of installed packages appears if it has been installed correctly.

And that’s it! All the installed programs should now be installed and they distribution should be available from the terminal or from the context menu (Starting HyperSpy). You can either continue following the next section to test the installation, or continue to the Obtaining the tutorial data section on the main page.

Testing the installation

Start the jupyter qconsole using the context menu (right click) short cut, see the Starting HyperSpy section

The Qt Console is an interactive Python interpreter that allows you to enter Python statements directly and immediately see their output. Once the console has opened and you see a prompt that says In [1]:, copy the following code snippet at the location of the blinking cursor:

%matplotlib qt
import hyperspy.api as hs
s = hs.datasets.artificial_data.get_core_loss_eels_signal(add_powerlaw=True)
s.remove_background()

Very briefly, this code is loading the interactive plotting libraries, loading HyperSpy, creating an example EELS signal from some artificial data, and then telling the interpreter you want to interactively remove the Power Law background. Press Shift-Enter within the console to run the lines of code you pasted in (it may take a few moments to run if this is the first time you’ve used HyperSpy on your machine):

Entering the example code into the Qt Console

Entering the example code into the Qt Console

Eventually, you should see a spectrum window and a small tool window for removing the background open (they may be stacked on top of each other; drag them out of the way, if so). If you click and drag on part of the spectrum display, HyperSpy will fit a Power Law to the signal within that region, and also show you a preview of the background-subtracted signal:

Removing the background from a test signal

By clicking and dragging on the spectrum display, a region is created (shown in red). The fitted background is shown in blue, and a preview of the background-subtracted signal is displayed in green.

Clicking “OK” in the Background removal tool window will perform the background subtraction, and replace the window with one showing the resulting signal:

Removing the background from a test signal

Assuming all of this worked, congratulations! You have a working HyperSpy installation and you have run your first bit of open-source HyperSpy-based materials science data analysis! Click the button below to return to the main tutorial homepage: