Skip to content
Web-based tools for collecting, analyzing, and sharing data from a DIY spectrometer
Ruby HTML JavaScript CSS Shell
Branch: master
Clone or download
Pull request Compare This branch is 34 commits behind publiclab:master.
Latest commit 46d7644 Jun 24, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
app geocoding error handling for safari etc, publiclab#380 Jun 24, 2016
config hotfix bower dep update for sprockets issue Apr 16, 2016
db Add index to tag_id field in snapshots table to help performance. Apr 21, 2016
doc root directory cleanup!!! yay Oct 29, 2014
lib bumping spectral-workbench.js to v0.1.0 and dropping Jasmine tests Jun 21, 2016
log initial boot in rails 3.2 Oct 30, 2014
public major reworking of datum parsing/uploading sequence and API, transfor… Feb 3, 2016
script initial boot in rails 3.2 Oct 30, 2014
test revised JSON api and tests Jun 24, 2016
vendor merge plus more rails3 cleanup and set list styling Dec 23, 2014
.gitignore Tweak gemfiles. Jun 14, 2016
.travis.yml Tweaks for continuous integration. Jun 14, 2016 added contributor guide Mar 23, 2015
Dockerfile Tweak gemfiles. Jun 14, 2016
Gemfile Gemfile version bump, cleanup Jun 24, 2016
Gemfile.lock Gemfile version bump, cleanup Jun 24, 2016 issue template fix Mar 10, 2016
LICENSE major cleanup, readme, license gplv3, interface library (p5) for Proc… Sep 4, 2011 basic pull request template Apr 7, 2016 revised JSON api and tests Jun 24, 2016
README_RAILS.rdoc initial boot in rails 3.2 Oct 30, 2014
Rakefile initial boot in rails 3.2 Oct 30, 2014
bower.json bumping spectral-workbench.js to v0.1.0 and dropping Jasmine tests Jun 21, 2016 initial boot in rails 3.2 Oct 30, 2014
docker-compose.yml Added docker-compose configuration. Jun 14, 2016
restart start/stop scripts for port 80, percentage based sampling height, fix… Dec 11, 2014
startup start/stop scripts for port 80, percentage based sampling height, fix… Dec 11, 2014
stop start/stop scripts for port 80, percentage based sampling height, fix… Dec 11, 2014

Spectral Workbench

Copyright 2011-2016 Public Lab |


Spectral Workbench is an open-source tool to perform low-cost spectral analysis and to share those results online. It consists of a Ruby on Rails web application for publishing, archiving, discussing, and analyzing spectra online -- running at

Read about how to build and use your own spectrometer with this software here:

Simple installation with Cloud9

  1. If you have a GitHub account, visit and log in with the GitHub button.
  2. Fork this repository to your own GitHub account, creating a yourname/spectral-workbench project.
  3. Name your project, then (order important!) choose the Ruby template, THEN enter yourname/spectral-workbench in the "Clone from Git or Mercurial URL" field, and press Create Workspace
  4. In the command line prompt at the bottom of the page, type ./ and press enter.
  5. Enter your username when prompted, and click "Run Project" when it's done.
  6. You're done! Go to the URL shown!


The app now runs on Ruby 1.9.3 up to Ruby 2.1.2 (preferred), and Rails 3.2.x, and uses Bundler for gem management and Bower for static asset management.


Recommended; for an Ubuntu/Debian system. Varies slightly for mac/fedora/etc

Install a database, if necessary:

sudo apt-get install mysql-server

Note: You will have to update the config/database.yml file appropriately. The example file assumes usage of SQLite. For which you need not install MySQL.

RMagick dependencies are required for processing uploaded spectrum images: apt-get install imagemagick ruby-rmagick libmagickwand-dev libmagick++-dev

  • On Fedora/centOs: yum install ImageMagick-devel
  • On mac, you can use Homebrew: brew install imagemagick

Install rvm for Ruby management (

curl -L | bash -s stable

Note: At this point during the process, you may want to log out and log back in, or open a new terminal window; RVM will then properly load in your environment.

Ubuntu users: You may need to enable Run command as a login shell in Ubuntu's Terminal, under Profile Preferences > Title and Command. Then close the terminal and reopen it.

Then, use RVM to install version 2.1.2 of Ruby:

rvm install 2.1.2

You'll also need bower which is available through NPM. To install NPM, you can run:

sudo apt-get install npm

However, on Ubuntu, you may need to also install the nodejs-legacy package, as due to a naming collision, some versions of Ubuntu already have an unrelated package called node. To do this, run:

sudo apt-get install nodejs-legacy

Once NPM is installed, you should be able to run:

sudo npm install -g bower

Installation steps:

  1. Download a copy of the source with git clone
  2. Install gems with bundle install from the rails root folder. You may need to run bundle update if you have older gems in your environment.
  3. Copy and configure config/database.yml from config/database.yml.example, using a new empty databse you've created. Do the same thing for config/config.yml file copying it from config/config.yml.example file.
  4. Initialize database with bundle exec rake db:setup
  5. Install static assets (like external javascript libraries, fonts) with bower install
  6. Start rails with bundle exec passenger start from the Rails root and open http://localhost:3000 in a web browser. (For some, just passenger start will work; adding bundle exec ensures you're using the version of passenger you just installed with Bundler.)

Sign in instructions:

  • Create a account at and use that username to log in.
  • Then you will be redirected to to "approve" a use of the openid identity.
  • Note that this applies for development environment as well.

Bugs and support

To report bugs and request features, please use the GitHub issue tracker provided at

For additional support, join the Public Laboratory website and mailing list at or for urgent requests, email

For questions related to the use of this software and your open source spectrometer, the same page links to the "plots-spectrometry" group.


Using your secret API token on your profile, you can submit spectral via the API in JSON format:

POST to ""

The required parameters are:

{"spectrum": {
  "title": "Test spectrum",
  "data_type": "json",
  "data": [
    {"average": 64.3, "r": 69, "g": 46, "b": 78, "wavelength": 269.089 },
    {"average": 63.3, "r": 71, "g": 45, "b": 74, "wavelength": 277.718 },
    {"average": 64,   "r": 71, "g": 47, "b": 74, "wavelength": 291.524 },
    {"average": 64,   "r": 68, "g": 49, "b": 75, "wavelength": 303.604 }
  "token": "00000000"

This will return a path (from the root URL by default) to the spectrum, as in: /spectrums/12345


Development is occurring at; please fork and submit pull requests; for more guidelines on contributing to Public Lab projects, see

If you're a developer, consider joining the Public Lab developer list, also at


Before submitting changes, please run tests with rake test to ensure that your code passes.

Also run rake jasmine and navigate to http://localhost:8888 to check client-side tests.

New tests are also appreciated to increase coverage; Rails tests are in /test and Jasmine tests (JavaScript tests) are in /spec.


Spectral Workbench is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Spectral Workbench is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Spectral Workbench. If not, see

You can’t perform that action at this time.