A small desktop app (tkinter + matplotlib) that turns raw Picoscope recordings of a wavelength-scanning measurement into spectra: time is converted to wavelength, the signal is smoothed and resampled on a 1 nm grid, and several spectra can be compared and exported together. Its look and workflow follow LabSpectrumManager, and its plots use the shared Origin-like style of PlotStyleKit.
- Reads CSV exported from the Picoscope software (two header lines, then
Time,Channel Aand optionallyChannel B) and also loads spectra that are already converted (two numeric columns, wavelength and intensity, no header). - Converts time to wavelength:
wavelength = initial WL + t × scan speed / 60, with the scan speed in nm/min. Only points witht > 0are kept. - Smooths the signal with a centred moving average (100 points, equivalent to MATLAB's
smooth(x,100)) and interpolates it on integer wavelengths at 1 nm steps. - Loads many spectra at once: data table, plot with a cursor showing the values under the mouse, list of loaded spectra with their metadata (including the integrated area).
- Right-click a spectrum in the list to copy it to the clipboard as X/Y columns, or in a layout for pasting into Origin.
- Exports all loaded spectra to a single CSV (one column per spectrum, wavelength as index).
Filemenu:Save Figure Image (PNG, PDF, SVG)...,Save Figure (pickle)...andEdit Figure...(opens the PlotStyleKit figure editor on a copy of the plot, restyled as a 4:3 single-column Origin figure).
The initial wavelength and the scan speed are read from the end of the file name:
<sample>_<initial WL>_<scan speed>.csv e.g. pyranine_ex_300_240.csv
means a scan starting at 300 nm at 240 nm/min. If the name does not end like that, the app uses the values typed in the Initial WL and Scanspeed fields of the right-hand panel. The channel to convert (A or B) is chosen in the same panel.
The final wavelength is assumed to be 1000 nm and the Final WL field is then updated to the actual end of the recorded scan.
pip install -r requirements.txt
python picoscope_gui.pyw
pythonw picoscope_gui.pyw [file.csv ...] starts it without a console window. Files can be
opened from the dialog, passed on the command line or dropped on the window when tkinterdnd2 is installed.
The plot style and the figure editor come from PlotStyleKit, which is
optional. The program looks for it next to itself (../PlotStyleKit), in ~/progetti/PlotStyleKit, in the folder named
by the environment variable PLOTSTYLEKIT and in the folder you chose the last time; if it finds none it says so at
start and asks for the folder, with Cancel for going without it (it will not ask again; File > PlotStyleKit...
changes that). Without it the plot keeps a plain look, Save Figure writes the figure as drawn and Edit Figure
offers to locate PlotStyleKit.
py -m unittest discover -s tests -v
The conversion and the app are tested on synthetic recordings; one test also loads a real recording from
example data/ if it is there (gitignored).
This repository contains code only: .gitignore excludes *.csv and the example data/ folder, so recordings
and converted spectra stay on your machine. The screenshot shows two real recordings.
Python 3.10+, numpy 2.0 or newer (the area uses np.trapezoid), pandas, matplotlib, and
optionally tkinterdnd2. Tested on Windows only.
