A Python platform for controlling custom laboratory experiments and visualizing scientific data

Advanced Development

For a step-by-step install and setup on Windows see here

Development Environment

Python via Anaconda

To have a consistent python environment for using and developing ScopeFoundry, we recommend the Anaconda python distribution and using conda environments to manage packages.

$ conda create -n scopefoundry python=3.7 anaconda
$ conda activate scopefoundry
(scopefoundry) $ conda install pyqtgraph

If you would like a more minimal environment, without all the default packages from Anaconda:

$ conda create -n scopefoundry python=3.7
$ source activate scopefoundry
(scopefoundry) $ conda install numpy pyqt qtpy h5py
(scopefoundry) $ pip install pyqtgraph

ScopeFoundry is available to download from PyPI or install via pip install ScopeFoundry.

However, if you are interested in using the latest development version of ScopeFoundry, instead of the most recent release on PyPI, you can install via git. To install the latest development version of ScopeFoundry from github:

(scopefoundry) $ pip install git+git://

Eclipse + PyDev IDE

Eclipse PyDev

For an IDE we recommend Eclipse with the PyDev plugin. While the setup is more complicated than many other IDE’s, there is one very useful feature available in PyDev that not available elsewhere: Live code reloading. This allows a developer to modify any function in ScopeFoundry from within Eclipse and have that new version of the function injected into the running ScopeFoundry App.

Keep track of history

It is a good idea to use a version-control system (VCS) to keep track of the code that runs your experiment. This allows you to have a record of the software used to acquire data on a specific day of experiments. It also protects against accidental and untraceable changes to code on your microscope that could affect how data is acquired. The current recommended VCS for ScopeFoundry projects is Git.

Lets create a git repository to store the code for the microscope app

mkdir fancy_microscope
cd fancy_microscope
git init

We add files using:

git add

And commit changes to perminanet history using

git commit -m "cool changes happen here"

There are are many tutorials on web that address how to use git effectively, so we will not repeat that here.

There are also good graphical interfaces to Git that you may want to check out. One recommendation SourceTree which is available for no cost.

Git subtree to modify plugins

If we want to modify existing hardware or measurements plug-ins we can use git subtree to import plugins into a git repository, track local changes to the plugin , and finally push these plug-in changes upstream.

If we have a microscope repository fancy_microscope that we would like to modify the code for ascom_camera we can at it locally to our microscope with:

cd fancy_microscope
git subtree add --prefix ScopeFoundryHW/ascom_camera/ \ master

After modification of the plugin we can push the changes in the plugin subdirectory.

git subtree push --prefix ScopeFoundryHW/ascom_camera/ \ master

You will need commit access to do this, but you can always fork the plug-in repo, and submit pull-requests via the ScopeFoundry GitHub page.

Local copy of ScopeFoundry

If you would like to have a local copy of ScopeFoundry to modify within your microscope repository, you can use git-subtree to make a local copy:

git subtree add --prefixScopeFoundry master 

Where to Find Out More

For questions about this documentation or ScopeFoundry in general, please visit and post on the ScopeFoundry project mailing list and forum.

For source code of all ScopeFoundry projects visit our GitHub page.

ScopeFoundry is available to download from PyPI or install via pip install ScopeFoundry.