Skip to content
Richard Bowman edited this page Apr 26, 2016 · 5 revisions

NPLab is the Python module that wraps up all the commonly-used bits of experimental code we use in Nanophotonics. In particular, it is the place to get Python wrappers for our various bits of experimental hardware along with support functions that handle things like saving to HDF5 files and running scripts in threads. It's on GitHub primarily for our convenience, but if anyone else finds it useful that's great. Please consider everything here under the GPL unless otherwise stated.

The documentation can be automatically compiled, and it's there that you should look for information on specific modules/instruments/functions. This wiki should help you find your way around the structure of the module, and also give pointers for those contributing to NPLab.

If you're setting up a new computer, see Installing Python.

You should also check out Using GitHub for nplab for a very brief guide on how to use GitHub to manage the code.

There will be a number of different modules needed, which fall into a few broad types:

  • Instrument classes are blocks of code centring around a class that controls a piece of hardware. For example, the Prior Stage, Infinity Camera, Ocean Optics Spectrometer would all be examples of this.
  • Some instrument modules might not be intended for direct use, but support lots of instruments with related functionality. For example, the SerialInstrument class is designed to be subclassed, to save you from writing too much boilerplate code.
  • Similarly, instrument modules for translation stages or camera might help create simple user interfaces or provide some consistency of interface, but rely on subclasses to provide the actual functionality.
  • Experiment modules are generally rig-specific and probably don’t belong in the core repository – they use various different instrument modules to control an experiment and carry out various tasks.
  • Supporting modules are fairly generic and used by instruments and experiments – examples might be code dealing with saving to files, or utilities for plotting graphs, etc.

Common tasks

There are a number of things that need to be done by many bits of code, about which we should have some useful conventions:

Guidelines for contributors

  • Instrument classes are the most common module you'll need to write, and there's guidelines on how to do it.
  • Documentation and style is very important for sharing code - you should read this section before contributing anything.