Documentation‎ > ‎

3. Gamma Spectroscopy

Gamma Spectroscopy

Gamma Spectroscopy has been updated to use a pulse shape recognition model based upon the concept and ideas from Marek Dolleiser and PRA.

Please let me know of any feedback or problems you have so I can continue to improve spectroscopy functionality.

 Scintillation Counters vs. Geiger Counters

  • What is gamma spectroscopy?
    • In short, it is determining the "color" (wavelength) of gamma radiation
    • This allows you to determine which isotope(s) are present, and if they are natural or man-made contamination
  • Why does gamma spectroscopy require a scintillation counter?
    • Because a Geiger counter only reports count rate, due to the tube discharging. 
    • If spectroscopy is color, a GM tube is black-and-white.
  • Which scintillation counters / probes will work with this?
    • To my knowledge, only custom hand-built ones.  I have not seen a commercial integrated unit suitable for this.
    • However, you can assemble one from a few components.
      • Scintillation probe: ie, Ludlum 44-2
      • HV power supply and voltage divider: ie, GS-1100A
      • Ludlum type C -> BNC cable / connector, iPhone headset connector cable, test source(s), ~510? ohm resistor
    • Or, you can assemble one using more base electronic components, which is the most economic and difficult option.
    • Regardless, for less than the price of a higher-end Geiger counter, you can assemble something capable of gamma spectroscopy.
  • Why use analog input for this?  Aren't microcontrollers better at this kind of thing?
    • Yes.  They are, as their ADCs are superior to a sound codec's.
    • Analog input is used for several reasons
      • 1.  Compatibility.  There are no standards for USB realtime spectra acquisition interfaces.
      • 2.  Licensing.  Any device connected via the dock connector must have a licensed encryption chip from Apple's "Made-for-IPod" program.  (this also applies to non-headset Bluetooth devices)
      • While quite possible to acquire spectra data in this manner (I've actually implemented it before), each licensed accessory would have to be supported individually.
  • Can I use Gamma Spectroscopy mode with a Geiger counter anyway?
    • Yes, though it is not recommended.
      • Advantages
        • Additional DSP filter:
          • Baseline (ripple) filter
      • Disadvantages
        • RMS Window is forced to 1
        • Delay windows must be set using "base delay"
        • Some DSP filters in Geiger counter settings are unavailable
          • Hysteresis Filter, Ultrafast Rates, Auto-Adjust, Enable AGC


Counting clicks is one thing, but accurately detecting their peak amplitude is a more complex topic.  The DSP I am doing is in no small way inspired by the programs PRA and FitzPeaks by Marek Dolleiser and Jim Fitzgerald, respectively.  The current algorithm owes a great deal to PRA and Marek Dolleiser in particular, who played a direct role in providing key information during development.

Not only do these two programs do gamma spectroscopy better than Geiger Bot, they have more importantly proven that gamma spectroscopy acquisition from a relatively low resolution 44 kHz line input is possible with novel DSP techniques.

If Geiger Bot's gamma spectroscopy isn't producing useful results for you -- either due to the software implementation or hardware limitations of the maximum sampling frequency, I recommend trying these programs.

Finally, I would like to thank Shintaro Funabasama for providing key test data and feedback that enabled me to begin developing this feature in the first place, and Steven Sesselmann and Marek Dolleiser for assistance with the pulse shape matching.

"Before attempting to create something new, it is vital to have a good appreciation of everything that already exists in this field."
    - Mikhail Kalashnikov

 1.  Histogram

The histogram is the accumulated gamma spectra for display and isotope identification.  It will not function until training is complete. (note the energy calibration is incorrect in this screenshot)
2.  Pulse Shape Training Screen

You must train the pulse shape of your scintillation counter with at least 512 samples, as indicated by a progress bar at the top.

The blue line is the trained average shape.  The red is the newest input sample.

Pulse shape training does NOT affect the count rate.

The numbers at the bottom in green are the value of each sample. (largely irrelevant)

[T] is the threshold, in percent, to which new samples are compared to the trained sample.  ie, 50% threshold on a value of 1.0 must match 0.5 - 1.5.

[n] is the number of samples trained.  This is also shown in the bar at the top, though the bar maxes out at 512.

Histogram (Gamma Spectroscopy) Controls

Button controls: (1.7.0+)

 Button Effect
 + Increase resolution (-bin factor)
 - Decrease resolution (+bin factor)
 ~ Access pulse shape training screen
 (size arrows) Maximize / minimize histogram window


 Direction Fingers Effect
 ← or → 1 
 Graph Trace - show keV/bin
 ↑ Up 2 Zoom In
 ↓ Down 2 Zoom Out
 ← Left 2 Pan Right
 → Right
 Pan Left 
 3 Change Y-Scale (LIN, LOG, SQRT)
  • In general, the only gestures of practical use are trace and changing the y-scale


1.  Make sure your scintillation counter is connected and reading background levels
2.  Toggle the training mode switch ON
3.  You will see the samples collect and the shape begin to take form.
4.  When you have > 512 samples and are satisfied with the shape, turn training mode off.
5.  Pulse shape recognition is now active.  With training mode off, the red line will graph any input samples that match the shape at the specific tolerance, so you can monitor what it's doing.

1.  The volume threshold I found the best for training was 2000 in testing.  This may need to be changed based upon your equipment.
2.  I found background levels produced better shape training than exposure to a source.  Again, this may vary for you.
3.  If the volume threshold is 10K it is automatically temporarily switched to 2K during training so the default value is useful.
4.  The shape tolerance seems to need to be much higher than in PRA; I don't know if this is due to my implementation or the hardware itself.
5.  I did not have good luck getting a clean input signal when the AC adapter was connected, perhaps due to audio input from the dock connector or changes in the line impedance.  You may need to verify your input is unchanged after connecting it to an external power source, or operate it on battery.

1.  Use Max As Amplitude:  Instead of performing a dot product calculation similar to PRA, this simply uses the highest input buffer value for the sample.  It is likely less accurate than the dot product, however it will give consistent results independent of the shape trained.  Basically, it lets you avoid continually recalibrating the energy - bin correlation but at the expense of some accuracy.
2.  Sample Size:  In emulation of PRA the default sample size is 16.  Here, you can customize that, as 16 is likely a bit excessive for a 44.1kHz input rate.  I did not have good results with my equipment below 10.
3.  Tolerance:  This slider controls how exact each sample has to match the reference shape.  I got the best results at 75%.  The numeric value is shown at the bottom of the screen as [T].  The lower the value, the tighter the tolerance, and more strict the filtering.  If you turn this below 50% and your hardware setup is similar to mine you will have difficulty matching samples.


1.  Go back to the training screen after having trained 512+ samples, but don't turn training mode back on.  Instead, just watch the graph.
2.  Every time a successful shape match is performed, the red line will be updated to that.
3.  If you are seeing no matches, crank the shape tolerance to 100% (all the way to the right)
4.  If you still aren't seeing any matches, re-train the shape.  Make sure you are not near an active source.
5.  If retraining is not successful, make sure your volume threshold is 2k.  If you've tried that already, try changing it somewhat.  When I set the volume threshold too high, few to none of the samples would match the training.

1.  Check the normal audio graph screen and make sure the input volume is ok (ie, varying between min and max, roughly)
2.  Check the volume threshold setting.  This happened for me with a setting of 500 or below.  You will have to re-train after changing the volume threshold to correct this (if that was the cause).


Actual recording of NaI scintillation probe at 44kHz.  Credit: Shintaro Funabasama.
  1. Volume Threshold
    1. This is the same setting as for GM tubes.
    2. It must be low enough to catch low-energy amplitude peaks.
    3. This affects both scintillation count rate and energy spectra training.
    4. During pulse shape training, this is the threshold after which the shape is considered to occur.
  2. Baseline Correction (optional)
    1. This is to mitigate the effects of ripple in some scintillation probe HV power supplies
    2. If enabled, this tracks the average of the last 5 samples below the volume threshold
    3. This average is subtracted from the peak amplitude before it is binned
    4. This ONLY affects count rate (1.5.7+)
  3. Base Delay
    1. Base delay is similar to the Geiger counter setting "delay windows". (1.5.7+)
    2. Its sole purpose now is to prevent multiple false counts (1.5.7+)
    3. It only affects count rate, not the energy spectra (1.5.7+)
  4. Maximum Conversion Samples
    1. N/A, removed


 Auto Adjust
 Ultrafast Rates
 Enable AGC
 Hysteresis Filter
 RMS Window
 Delay Windows

Default and Recommended Starting Settings for Gamma Spectroscopy

Rec. ValueDefault 
 Conversion Factor, CPS/mR/h
2917 22 You must later manually enter the correct value (2917 CPS/mR/h is for a Ludlum 44-2 1"x1" NaI probe)   Count rate only.
 Volume Threshold
2000 10000Must be low enough to catch low-energy peaks
 Value Default Notes
 Gamma Spectroscopy Enabled
 Min Channel
0* 0Optional.  Minimum display channel for histogram.  Should be set to be about the same as the volume threshold.
 Max Channel
32767* 32767 Optional.  Maximum display channel for histogram.  Should be set to be barely above the highest peak amplitude from a high-energy gamma photon.
 Input Polarity
Both* Both Optional.  You must manually determine the correct value.  "Both" can be used, but may cause double counts sometimes.   Count rate only
 Base Delay
10* 10Equivalent to "delay windows".   Count rate only
 LUT  R. HC* R. HC Optional.  The spectra is colored between 0 and 2000 keV with a false-color lookup table palette (LUT).  This is to make the spectra more intuitive to determine position in. 
    *default setting value


 Total channels (bins)
32768 (fixed)
 Input amplitude to channel ratio
(after absolute value)
1:1 (fixed)
 Input amplitude range (16-bit signed integer)
-32767 ... 32767 (fixed) 
 Input amplitude range peak-peak (volts)*
-0.447 ... +0.447
 Input line level, nominal (volts RMS)*
 Input line level, nominal (dBV)*
-10 dBV 
 Channel to keV formula (linear) keV = channel / m + b

    *(line-level specs from Wikipedia.  Untested but assumed correct.)

  • Normally, MCAs use 256 - 4096 channels for input.
    • These are usually mapped to a certain range of input amplitudes.
  • Geiger Bot uses 32768 channels
    • These are NOT mapped to a certain range and are fixed
  • Geiger Bot resamples the raw input channels to a dynamic number of display channels
    • By default, that is one per pixel, or 640 channels on a retina display
  • Advantages
    • Allows for a streamlined process in the normal steps of calibrating input to bins, and then bins to energy.
    • Zooming the spectogram in shows truly more detail, rather than just larger pixels
    • There is little performance difference vs. 4k channels in testing, due to the use of SIMD code (version 1.5.4+)
    • Configuring and calibrating the display and energy range does not require clearing all input bins
  • Disadvantages
    • Because of the very high detail plot, more data collection is required to obtain a smooth appearance
    • The resolution of the input is not truly as high as the resolution of the bins


The purpose of calibration is to map the channels of input amplitude to the energies of gamma radiation which they represent.  If you do not do this, the energy (keV) value will not be accurate or meaningful.  Even without calibration, the shape of the spectrogram may have some value to a trained observer by itself.

Another purpose of calibration is to verify that the relationship between amplitude and gamma energy is roughly linear, and that neither low-energy nor high-energy gammas are being cut out of the input.  This is of significant concern for interpreting the shape of a spectrogram correctly.

First, set the recommended starting settings for gamma spectroscopy as noted above.
  1. Conversion Factor (CPS/mR/h)
    1. Find gamma sensitivity spec from manufacturer or determine vs. a calibrated source or reference counter.
  2. Probe - hardware line voltage out
    1. Make sure your probe has output voltage in the line-level range above
    2. Use a K-40 test source or similar to check the upper range and verify it is not clipping
    3. Adjust the voltage output / gain / resistance of your probe such that the K-40 peak is about 75% of maximum amplitude
      1. You can vary it depending on what you're planning to measure, but in general there's not much point of having an upper-end beyond 2000 keV.
  3. Channel -> keV Calibration
    1. Source Calibration
      1. Material Requirements
        1. Make sure you have at least two sources; one with low and one with high gamma energies
          1. Example: Am-241, K-40
            1. Am-241 source: Smoke detector element.  If your country does not sell ionization chamber smoke detectors, they can usually be safely imported.
            2. K-40 source:  Bottle of potassium-based salt substitute from grocery store.  Not that radioactive, so will require a longer measurement time vs. the Am-241 source.
      2. Background Calibration
        1. Gather background spectra for 10+ minutes in a stable indoor location with no excessive airflow.
          1. Do NOT have either source anywhere near the probe yet
        2. Screenshot the background spectra for future reference (push "power" and "home" buttons simultaneously)
      3. Am-241 Source Calibration
        1. Push "zero" to reset spectra data
        2. Place Am-241 source near probe.  Wait 10+ minutes.
        3. Make a note of the bin the Am-241 peak is in.  Its energy is 60 keV.
      4. K-40 Source Calibration
        1. Push "zero"
        2. Place K-40 source near probe.  Wait 10-30+ minutes.
        1. Note the bin the K-40 peak is in.  Its energy is 1460 keV.
          1. You will also observe a smaller K-40 peak present on the background spectrograph.
          2. K-40 is a significant part of natural background radiation.
    2. Enter the keV energy and bin into Geiger Bot
      1. Automatic Linear Regression
        1. Fortunately, Geiger Bot now does all this hard work for you.
        2. Just enter the keV/bin pairs into Settings -> Scintillation Counter -> Energy Calibration
        3. Note you need at least two points for this to work!
        4. To check to see what Geiger Bot calculated for calibration in the form y = mx + b, including RMS error% of the model, check the console after closing settings.
        5. At this point only 3 calibration points are supported, and only a first-order linear regression is available, but this may change in the future.
        6. NOTE: If you re-train a sample shape the current calibration will to some extent be invalidated as it is dependent upon the trained shape

Interpreting the Spectra

Generally, this is a simple matter of visually determining the peaks, and tracing them to find their energy.  This will give you some idea if you're looking at natural background radiation, or possibly something else entirely.  It will take much longer to get an accurate energy spectra gathered, compared to count rate alone.

It is easier to distinguish between things when you have some idea going in of what the possible isotopes involved are.  There are many odd isotopes you will find in reference tables that can be misleading that you will probably never encounter.  So it helps to look for natural background peaks first, and then common industrial and medical isotopes, and long-lived fission products.

Another thing to note is that the peak for an isotope is due to either the phenomena of pair production or the photoelectric effect.  But what you will also detect simultaneously for the same isotope is Compton scattering.  Visually, the Compton scattering will appear as a shorter, concave set of a wider range of values in bins lower in energy than the pair production / photoelectric peak.  Note this will happen for every peak on the spectra, so you will have multiple sets of Compton scattering values accumulating.  This is why the spectra always has a large, irrelevant hump at the beginning of it. (which DSP artifacts also add to)