Impulse by Gammaspectacular

PRA, BeqMoni, Theremino, Fitzpeaks and beyond!
User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 14 Feb 2023, 11:57

Just a quick update:

I think I understand the Mac issue, it's a problem with the microphone permission.
For some reason the latest Mac OS called Ventura doesn't ask for permission to access the microphone when I launch impulse.
Seems like Apple have changed something as this was working before I upgraded to Ventura.
There doesn't seem to be much information on the web about this issue other than a few sites recommending not to upgrade yet.

Opening the package and launching the app via the terminal icon works, the operating system correctly prompts the user to allow microphone access to the terminal.

I am looking for a hack to make this work 😂

Steven

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 14 Feb 2023, 19:31

Hi,

If any of you guys out there have a GS spectrometer and a Mac which has not been upgraded to Ventura, would you be interested in giving this a try ?

https://www.gammaspectacular.com/steven/impulse.dmg

Pretty sure the audio problem is limited to Ventura.

Steven

Rob Tayloe
Posts: 107
Joined: 10 Nov 2020, 12:00
Contact:

Re: Impulse by Gammaspectacular

Post by Rob Tayloe » 15 Feb 2023, 01:57

Hi Steven,
I downloaded the latest version of impulse.dmg and installed it on my macbook pro running ventura OS. Alas, no joy. Also no joy when trying to run this version on another macbook pro running catalina OS. On the catalina macbook pro I could see the usb-audio-codec which was selected as the inpput device. When launching impulse, there was no request to allow access to the microphone. Otherwise, the response was the same, e.g. saw usb-audio-codec as device 3, but no capture pulses, regardless of settings tried. Attached are some screen shots (thanks RobertD for the tip on getting mac screen shots!)

This screenshot shows the macbook pro system info -
Screenshot 2023-02-14 at 9.22.59 AM.png
Screenshot 2023-02-14 at 9.22.59 AM.png (96.67 KiB) Viewed 1784 times
This screenshot shows the audio input having selected the usb audio codec (and there is input from the Cs137 source beneath the Scionis 38x38mm NaI detector with GS-USB-PRO) -
Screenshot 2023-02-14 at 9.16.40 AM.png
The impulse.app file was placed in the applications folder. When launching impulse permission is sought to use the microphone -
Screenshot 2023-02-14 at 9.18.37 AM.png
The usb-audio-codec was identified as device #3 and was selected. I tried using a variety of frequencies, pulses to sample, but no joy on grabbing a pulse...
Screenshot 2023-02-14 at 9.21.09 AM.png

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 15 Feb 2023, 08:20

Rob,

Your last screenshot shows the mac asking for permission to use the microphone (this part doesn't happen on mine).
Assuming you clicked okay it should have worked.
It shouldn't be necessary to also select the sound card in the settings, the program should select input index you select.

# I see you had set it to sample 1000 pulses, did you wait long enough?
# Try setting it to 10 or 100 pulses, that's plenty, the pulse shape will not appear until it has found n pulses.
# I suspect it is working on yours since you gave permission for the microphone.


Considering the amount of trouble making a heavy stand alone package, I think the simpler and safer option is to install Python from here https://www.python.org/downloads/
and run my raw script, which compared to the package is tiny, the steps are pretty simple. Windows users can get python from the windows app store.

1) Install python.

2) Install the libraries needed for the program:

Code: Select all

pip3 install -r requirements.txt
3) Run the program

Code: Select all

python3 run.py
Once you have python installed on a mac you can right click on the script called run.py and select python as your default application for .py files, after that you can just double click to launch the program.

Steven

Rob Tayloe
Posts: 107
Joined: 10 Nov 2020, 12:00
Contact:

Re: Impulse by Gammaspectacular

Post by Rob Tayloe » 15 Feb 2023, 08:30

I will give the python version a go. I took an online python class about 8 years ago, but haven't done anything with it. Mostly I recall that there were no punch cards, no line numbers, spaces and indents seemed important (somehow).

I will let you know of my progress.

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 16 Feb 2023, 17:07

Here is a short 4 minute video showing the simple setup and run process.

Steven

https://youtu.be/uMSNlCsGEHQ
Impulse Video
Impulse Video
imp01.png (54.98 KiB) Viewed 1763 times

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 20 Feb 2023, 17:42

Boys and Girls,

Did anyone give my program a test yet ?

The latest enhancement is a peak finder, you adjust the tolerance for how many annotations you want to see.

Technically it is filtering the peaks based on prominence and width.

Works for me, but I really need some user feedback, so don't be afraid to give it a try.

Python is a popular platform for all kinds of apps, and definitely worth installing.
https://www.python.org/downloads/
Python Download
Python Download
python-logo@2x.png (15.4 KiB) Viewed 1740 times
Github is a repository where programmers can collaborate on code and share their work.
Feel free to download impulse from here, just unzip the folder and keep it with your other python apps.
https://github.com/ssesselmann/impulse
github
github
git.png (6.92 KiB) Viewed 1740 times
peakfinder
peakfinder

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 21 Feb 2023, 22:04

Guys and Girls....

Today I have added a novel function to impulse, it's called Distortion Curve.

In order to understand the distortion curve we first have to understand what we mean by distortion. One of the un-avoidable problems when dealing with randomly spaced gamma rays is unwanted overlapping events in the time domain. When two pulses overlap each other it is not possible to accurately measure their energies.

This problem becomes more pronounced with higher count rates and/or slower sample rates. To overcome this problem we use a sophisticated method to filter out the PPU (Pulse Pile Up).

Here is the method for those interested:

First of all the definition of a pulse is a string of samples i.e. [s,s,s,s,s,s,s,s,s......]

1) First capture a number of pulses as lists of numbers of fixed length,
2) then find the mean average pulse by doing a dot product and dividing the sum by the number of pulses
3) then normalise the pulse such that the sum of samples == zero,
4) then save this averaged and normalised sample pulse as a template.

1) During recording of a real spectrum every pulse is first normalised as above,
2) then the sample pulse collected earlier is deducted from the normalised real pulse
3) the difference is squared and summed

The purpose of this is to get a positive number to represent how much the two pulses differ in shape. Imagine if the pulse shapes were identical, the difference squared and summed would be zero, so we call this number the distortion factor.

All credit goes to Marek Dolleiser for being the first to use this method in gamma spectrometry.

We mow use this distortion factor to filter out all badly formed pulses, but until now it has been a bit of guessing involved in finding the optimum settings, and remember these factors depend on count rates and sample rates so when you change one parameter you also need to change the distortion filter.

Now to the new feature.

On tab1 I have added a new button and a new chart for obtaining a quick distortion curve. This curve will help you get the shape tolerance setting correct on tab2.

First you click the Capture Pulse Shape button then when the pulse shape appears click Get Distortion Curve it then runs through the same number of unfiltered pulses again and collects a list of distortion. factors, the list is then sorted and presented as a line graph.

As we can see from the attached chart, the level of distortion during my test was relatively flat up to around 20k then almost straight up, so for this experiment a Shape Tolerance setting of 19k would be perfect.

This version has now been committed to github.

Good luck.... Steven
New Tab 1 with Distortion curve
New Tab 1 with Distortion curve

PS: Please report any issues you might have during installation of Python or it's dependancies. Today I heard from a Windows user about some issued installing pyaudio on windows. Expect some googling to get it working. ChatGPT can also be a good help.

User avatar
Sesselmann
Posts: 1174
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

Re: Impulse by Gammaspectacular

Post by Sesselmann » 25 Feb 2023, 16:42

Hi guys,

I fixed a bug in my program today which had gone unnoticed until now, because it worked fine on my machine. In a nutshell, the program was looking to the wrong device for the number of input channels, and as the number of input channels are usually 0, 1 or 2, there was a 33% probability that the device you selected just happened to work, which was the case for me.

Anyway it has been fixed now and the fixed version has been committed on github

Sorry if this caused anyone some frustration 😥

Steven

User avatar
Svilen
Posts: 180
Joined: 23 Sep 2016, 04:25
Location: Germany
Contact:

Re: Impulse by Gammaspectacular

Post by Svilen » 26 Feb 2023, 10:02

Could this be the reason it didn't work for me? I'll give it a try again and tell you.
Svilen

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests