Skip to content

ssesselmann/impulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMPULSE

Python Script MCA for gamma spectrometry.

This program reads a stream of data from the PC sound card and picks out pulses, the pulses are subsequently filtered and written to a JSON file in a special format called NPESv2-JSON. A live histogram and counts per second can be viewed in the browser tabs.

The current version of Impulse is also compatible with Atom-Nano and GS-Max devices with USB serial communication. When used in serial device mode the already completed spectrum is retrieved from the device and the program performs the display monitor function only.

The Easy Way

Not too concerned about downloading the latest changes and just want to try Impulse ? Download the precompiled executable for Mac or Windows from Gammaspectacular.com

https://www.gammaspectacular.com/blue/software-downloads/impulse

Raw Code Installation Method (Windows, Mac or Linux)

Step 1)

Download and install the latest version of Python from the official site, consider upgrading if you are on an old version ... www.python.org

Step 2)

Download Impulse from the Github repository here https://github.com/ssesselmann/impulse

Step 3)

Unzip the package to the preferred location on your drive, something like ~/python/ for all your python scripts.

Step 4)

Open your terminal to the command line and navigate to the folder ~/python/impulse-main

Step 5)

Impulse requires some additional python libraries installed, so copy and paste the following into your terminal;

First you will need to install or upgrade pip, pip is a catalogue of available python extensions.

Install or upgrade to the latest version of pip..

python -m pip install --upgrade pip

Windows or Linux

pip install -r requirements_pc.txt

Mac

pip3 install -r requirements_mac.txt

Step 6)

Now from the impulse-main directory run the program by typing

python code/impulse.py

mac users may have to type

python3 code/impulse.py

Fingers crossed your default browser should open up and show tab 1

Troubleshooting

Look for any error messages in the terminal. A common problem is a missing library, if so try installing it separatelly.

pip install ??????

Always exit the program from tab 4 by clicking the exit button (important)

When it's all working you can access the program in your browser at;

http://localhost:8050

Change log

  1. creating a settings database in sqlite3
  2. Obtaining an indexed table of audio devices
  3. Selecting Audio input device
  4. Reading the audio stream and finding pulses
  5. Function to find the average sample vanues in a list of n pulses
  6. Function to normalise a pulse
  7. Function to save the normalised pulse as a csv file (needs changing to JSON)
  8. Browser layout with tabs
  9. Tab for editing settings and capturing pulse shape
  10. Graph to display captured pulse
  11. Function to calculate pulse distortion
  12. Function to read data stream, find pulses and append counts to histogram
  13. Function to save histogram in JSON format
  14. Tab for displaying pulse height histogram and filter settings
  15. Assigned program name "impulse"
  16. Tidy up and move all styling to assets/styles.css
  17. Added function to show spectrum in log scale
  18. Added polynomial pulse height calibration and save calibration data
  19. Completed method for subtracting a background spectrum
  20. Added 482 isotope peak libraries in json format
  21. Program now auto detects negative pulse direction and inverts samples
  22. Modified devise list to only show input devices
  23. Wrapped shape function in a try: except: in case no audio device is available.
  24. Fixed an issue where the x axis changed scale when comparison was switched on.
  25. Added peakfinder function with resolution notation (Bug prevents notation showing in log scale)
  26. Added new function and chart to display distortion curve (useful)
  27. Added tab3 with counts per second histogram, data saves to json file
  28. Improved layout compatibility with smaller screens.
  29. Added user manual to tab 4
  30. Added gaussian correlation trace to spectrum with sadjustable sigma
  31. Tidied up appearance and moved the polynomial function, added text for gaussian correlation on tab4
  32. Fixed fatal bug related to gaussian slider and saves slider position to settings
  33. Fixed problem with calibration (8 March 2023 14:19 AET)
  34. Fixed fatal indentation error (9 March 2023 10:38 AET)
  35. Put back stop button on tab 2 (9 March 2023 19.52 AET)
  36. Added option for switching theme between fun/boring (9 March 2023 23:06 AET)
  37. Fixed bug in pulsecatcher.py and distortionchecker.py, pulse peak in wrong position (10 March 2023 17:00 AET)
  38. Added news and updates field on tab1
  39. removed duplicate pulse height calculation on pulsecatcher.py (10 March 2023 12:43 AET)
  40. Rearranged settings and added pulse length in time (12 March 2023 14:00)
  41. Fixed bug relating to count rates below 1 second (13 March 2023 10:30 AET)
  42. Changed count rate histogram to line plot with markers and 10 sec rolling average (14 March 2023 17.39 AET)
  43. Added function on tab-4 for exporting histogram file as csv
  44. Added pink theme
  45. Added drop down menu for comparison spectra and isotope spectra
  46. Added soundbyte button which plays a chord for any spectrum
  47. Changes soundbyte to play gaussian correlation instead of full histogram (cleaner sound)
  48. Added a threshold line to the pulse shape chart
  49. Fixed bug with start/stop buttons causing run to stop when switching tabs.
  50. Fixed y axis autorange when running difference spectrum
  51. Added warning for long dead time and options for shorter pulse length
  52. Added function to update calibration on prerecorded spectrum
  53. Added option to stop after n seconds
  54. Added tab4 with 3D Histogram
  55. Minor changes to layout + remove one dependancy
  56. Fixed Start and Stop buttons using threading to interrupt loop
  57. Major update for use with GS-MAX
  58. Bug fix - Start button fixed
  59. Added user table to local database for later use in publishing spectra
  60. Added functionality for publishing spectra to a public repository.
  61. Added functionality for Atom-Nano serial devices
  62. Added functionality for right channel recording and coincidence counting

Things to do

  • Build interval histogram with Dead time calculation
  • Show Subtraction in spectrum name
  • Save background subtracted spectra

If anyone has requests for additional features please contact me via the "Contact us" link at gammaspectacular.com

Steven Sesselmann

Gammaspectacular.com