Skip to content
This repository was archived by the owner on May 27, 2020. It is now read-only.
Michael Hirsch, Ph.D edited this page Sep 17, 2019 · 9 revisions

There is no need to use Python virtual environments for this project.

The example scripts require Python ≥ 3.6, so we strongly urge you to use Raspbian Buster Lite or newer, as older Raspbian versions have too-old Python versions.

In general the minimum packages you would need for this project are obtained on the Pi by:

apt install git python3-pip python3-picamera python3-numpy python3-h5py

Many systems have multiple Python versions installed, and so does the Raspberry Pi with Raspbian Buster Lite. You want to have your Python commands use python3 not just python to help ensure you're using the Python 3.7 installed from the factory with Raspbian Buster Lite.

Development

There are numerous IDEs for Python (including Visual Studio). I personally prefer Spyder, as it's lightweight, fast and yet powerful enough that I don't need anything else. For laptop development, Miniconda Python is the easiest Python distribution--I use it for almost everything. Spyder is obtained by:

conda install spyder

HDF5

HDF5 is a universal, self-describing, compact, lossless, performant data format with easy access from popular programming languages. For example, in Python a 3-D array is written to HDF5 by:

import h5py
import numpy as np

dat = np.random.random((10,100,100))

with h5py.File('mydat.h5', 'w') as f:
    f['dat'] = dat

This HDF5 data is viewable by a wide selection of software, and readable from popular programming languages. For example, from Matlab:

dat = h5read('mydat.h5', 'dat')
Clone this wiki locally