Article

Getting started in Pylake

In this tutorial, you can find the Pylake installation instructions and a few simple examples to get started in Pylake.

Pylake is the Python package developed by LUMICKS for analyzing C-Trap data. By using Pylake, you can save time analyzing your data and you get access to many data analysis scripts that have been developed by LUMICKS and other C-Trap users.

The Pylake installation instructions are described in the Pylake documentation.

Below, we follow the Pylake installation instructions in the Pylake documentation, with extra visual instructions.

Further, this article explains how to start analyzing hdf5 data files from the C-Trap after Pylake has been installed.

Step 1: Download Anaconda

Download Anaconda and select the default options during installation

Note that the name of the installation directory should not include a space.

Step 2: Open the Anaconda Prompt

Go to the start menu and search for the 'Anaconda Prompt' (Windows) or Terminal (Mac)

You should see a line with (base) and then the path to the folder you are located.

Step 3: Install Pylake

Type the following in the Anaconda Prompt or Terminal and press 'Enter' to create a virtual environment named "pylake":

conda create -n pylake

A virtual environment allows you to install specific packages with specific versions, without inducing conflicts with other Python packages.

If the terminal asks:

Proceed ([y]/[n])?

Type ‘y’ and ‘Enter’ to proceed.

Now, activate the virtual environment you just created:

conda activate pylake

After this step, the next line in the terminal should start with

(pylake)

Add conda-forge as the highest priority 'channel' from which Python packages can be installed:

conda config --add channels conda-forge

Install Pylake:

conda install lumicks.pylake

Step 4: Start Jupyter Notebook

Next, start Jupyter Notebook. If you just finished the installation instructions, you are in the correct virtual environment and can type the following to start Jupyter Notebook:

jupyter notebook

Next time, if you want to start Jupyter Notebook. Start the Anaconda Navigator or Terminal and type the following:

conda activate pylake
jupyter notebook

After following this step, Jupyter should open up in your browser.

Step 5: Open Jupyter Notebook

From Jupyter, you can start writing code. For data analysis, we recommend using Jupyter Notebooks, which can be recognized by the extension .ipynb.

Create a new Notebook by clicking the drop-down menu 'New', or start from an existing Notebook using the Tips below.

Create a new Jupyter Notebook
An example Jupyter Notebook. Run the code by clicking on a 'Cell' and clicking the Play button in the top menu, or by typing 'Shift' 'Enter'. In the first Cell, the necessary Python packages are imported (lines starting with 'import'). Pylake, for example, is imported in the line 'import lumicks.pylake as lk'. The next cell uses Pylake to import the file 'kymo.h5' , which is located in the folder 'test_data'. The 3rd cell plots the Distance channel over time.

Installation errors

FAQ

Frequently occurring installation errors and how to overcome them are listed at the bottom of the Pylake installation instructions

Installation instructions for China

In China, the installation instructions as presented above can be slow.

Specific installation instructions for users in China to speed up the installation can be found here.

Tips

Harbor

On harbor.lumicks.com you can find many example Notebooks written by C-Trap users.

Example Notebooks on Pylake documentation

The Pylake documentation gives an overview of all the functions that are available in Pylake and contains many data analysis examples.

Furthermore, the 'Examples' section contains full analysis workflows to get started quickly.

Note that every page in the Pylake tutorial and Pylake Examples can also be downloaded as a Jupyter Notebook:

The Files and Channels tutorial on the Pylake documentation. Rather than copy-pasting the code, you can click 'Download this page as a Jupyter Notebook' to download all the code examples on this page as a Notebook.

Related content