Python Graphmaker Script

In July 2010, a Python Script was added to the Spectrometer computer, to be run directly by an OPUS Calibration Macro.
This script was written by Stephen Holinaty while working with the MidIR Beamline as a summer student.

This Python Script is intended to create numerous graphs and directly upload them to our webserver to allow an up-to-date graph to be visible on the internet.

This code is designed to be run ONLY on the spectrometer computer.

Purpose

the purpose of this script is to create and publish ten graphs based on a series of calibration and signal quality data given to it from the OPUS software package.

Requirements:

Installatation Instructions available:Here

Process:

  1. Import the D:/Program Files/Opus_65/SigNoiseSpreadsheet.csv file into python

     

  2. Split this spreadsheet into two arrays (Transmission and Reflection Mode get separate graphs)
  3. filter out all but the ‘best’ result per day
  4. create 10 graphs (XY Calibration, Signal-to-noise RMS, signal-to-noise Peak-Peak, RMS Noise, Peak-Peak Noise)
  5. Automatically scale the X and Y axis to contain all data and have a slight X-margin so that data points are not directly on the axis
  6. upload these graphs directly to the midir.lightsource.ca webserver.

Error Catching

  • the majority of the python code is in functions within “try: except:” blocks which are meant to catch any error that the program would throw (such as being unable to access the SigNoiseSpreadsheet.csv file).

     

  • When an error is caught, the ENTIRE python script will stop, print the error to the screen, Save a copy of the error to D:/Program Files\OPUS_65\Calibration\PythonErrorLog.txt. The script will then require the user to click enter, acknowledging that they have read the error, and exit.

Common Errors and possible solutions

NameError: global name ‘errorLog’ is not defined


IOError: Error 13 Permission denied: *FILENAME