Skip to content
master
Switch branches/tags
Code

Introduction

This repository contains a set of Jupyter Notebooks containing examples of how to use the Canopy Python library.

Each example tends to install a specific version of the Canopy library, for example pip install -q 'canopy==8.13'. This is so that the example continues to run even if we make breaking changes to the underlying Canopy Python library. In your own code you can either install a specific version or use the latest version with pip install -q canopy. If you do find some of the example code fails to run in the latest version of the library, let us know and we will update it.

If you find you need to update your Canopy library you can run pip install --upgrade canopy. If you run this from a Jupyter Notebook or other runtime, make sure you restart the runtime after upgrading to pick up the newly installed version.

Breaking changes to the Canopy Python library are documented in the CHANGELOG.md file.

Examples

General Usage

  • Loading and Saving Configs takes you through the basics of accessing and creating configs on the platform.

  • Running Studies demonstrates loading configs and using them to run run studies on the platform, including how to ensure a study has completed before extracting the results.

  • Loading Vector Results shows how to load channel data from simulations for further analysis and visualization.

  • Loading Scalar Results shows how to load scalar results from simulations for further analysis and visualization.

  • Loading All Vector Results shows how you would go about loading every single channel from a study by using the vector metadata to extract the list of channels.

  • Loading Study Data from Worksheets shows how to iterate through the rows of a worksheet and extract scalar and vector data from each study in the worksheet.

  • Deleting old studies shows how to bulk delete studies, should you wish to free up storage credits.

  • Encrypting Config Components shows how to programatically encrypt part of a config.

Specialised Tasks

Further Information

Jupyter Notebooks

The examples use Jupyter Notebooks which can be viewed directly on GitHub. If you want to interact with the notebook, or create your own, you'll need to either install Juypyer Notebooks locally using something like the Anaconda Distribution or use one of the many online Jupyter Notebook hosts such as the excellent and free Google Colab.

Note that Google Colab uses a fairly old IPython runtime by default, so most of our examples start by upgrading the runtime to support the latest Python features, in particular async/await at the cell level. The process for running the examples after opening in Google Colab is therefore:

  • Run the "Upgrade Runtime" cell.
  • Click the button that appears to restart the runtime.
  • Run the rest of the notebook.

Visualizations

Most of the examples use Matplotlib which has the advantage of rendering in GitHub. However numerous other options are available such as Seaborn which sits on top of Matplotlib, Bokeh and Plotly which have great interactivity support and Altair.

Plotly Express allows you to create some quite complex visualizations such as parallel coordinates plots and scatterplot matrices with just a few lines of code.

Data

The Canopy Python library uses Pandas DataFrames for much of its data handling, which is part of the SciPy ecosystem.

About

Examples showing how to use the Canopy Python library.

Resources

License

Releases

No releases published

Packages

No packages published