Impulse by Gammaspectacular
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Hi Guys,
After attempting to install impulse on an old PC laptop I have at home, I found that it would not run. The reason was that the database which holds the settings (data.db) was not owned by the user and could not be accessed. Easy fix, just delete the database and restart the program. The script called launcher.py creates a new database if it does not exist.
I have added data.db to .gitignore so it should no longer appear on github.
Steven
After attempting to install impulse on an old PC laptop I have at home, I found that it would not run. The reason was that the database which holds the settings (data.db) was not owned by the user and could not be accessed. Easy fix, just delete the database and restart the program. The script called launcher.py creates a new database if it does not exist.
I have added data.db to .gitignore so it should no longer appear on github.
Steven
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Hi Guys,
Lucky we have weekends to do all the work, after going nine rounds with python, it threw in the towel and I was able to compile a distribution of Impulse for Mac. (still fighting with Windows).
This means is anyone with a mac should be able to download impulse.dmg and run it without having to install python and enter commands via the terminal, just double click the icon and run it (almost).
Installing the app is simple
1) Despite my relatively tiny script, it is a fairly big download (259 MB), this is because Python and all it's libraries are embedded in the package.
2) Once you download it, open the dmg and move the app to your mac.
3) when you double click the app to run it, your Mac will tell you it's scary π± and ask you to delete π it, because you didn't download it from Apple, relax... π§ββοΈ, take a deep breath..
4) Open settings >> Security & Privacy >> General, and simply unlock it.
5) Download here:
https://www.gammaspectacular.com/steven/impulse.dmg (265.6 MB) - Added of isotope library 230214 β€οΈ
6) Because everything is contained within the app, you can also delete everything by deleting the app. (nothing else will be installed on your computer).
7) You can look inside the app by right clicking on the app and selecting show contents.
8) The actual data file containing your spectra lives inside the package, so you might want to create an alias of the data file and move it to your desktop.
Running the app is simpler
1) Plug in your GS spectrometer or external sound card
2) Double click the app to launch the program, which after about 15 seconds will open your browser on tab1
3) Refresh the device index (button) and look for the sound card input index (number in first column).
4) Enter the device index and wait for the program to return a pulse shape.
Note:
Unlike PRA my program automatically checks if pulses are positive or negative then runs a pulse shape acquisition to average the number of pulses you specify in the settings.
This usually takes less than 10 seconds, depending on your detector and how many pulses you want to average.
Like PRA the pulse shape acquisition automatically ignores very small < 10% and very large pulses > 90%
5) Once you see the pulse shape on the screen you can click on Pulse Height Histogram (tab2) give your recording a name and start collecting data.
6) The spectrum will stop when max counts has been reached, this is also how you stop the recording, just enter a zero. (Might add a button for this)
7) Shape tolerance and LLD have not yet been normalised to percentage, hence large numbers here for the moment.
8) Background subtraction is super simple just name your background recording something like "my_background" record it and copy the name across to the comparison file name field. You can compare any spectrum with any other spectrum (this is how we will present isotope lines as well).
Everything is pretty self explanatory, so anyone should be able to do this.
Good luck, and don't forget, as a beta tester I need your feedback especially if you can't make it run
(Remember if it doesn't work it's not your fault it's mine π).
Steven
PS: I will get this running on Windows it's just a painful process.
Lucky we have weekends to do all the work, after going nine rounds with python, it threw in the towel and I was able to compile a distribution of Impulse for Mac. (still fighting with Windows).
This means is anyone with a mac should be able to download impulse.dmg and run it without having to install python and enter commands via the terminal, just double click the icon and run it (almost).
Installing the app is simple
1) Despite my relatively tiny script, it is a fairly big download (259 MB), this is because Python and all it's libraries are embedded in the package.
2) Once you download it, open the dmg and move the app to your mac.
3) when you double click the app to run it, your Mac will tell you it's scary π± and ask you to delete π it, because you didn't download it from Apple, relax... π§ββοΈ, take a deep breath..
4) Open settings >> Security & Privacy >> General, and simply unlock it.
5) Download here:
https://www.gammaspectacular.com/steven/impulse.dmg (265.6 MB) - Added of isotope library 230214 β€οΈ
6) Because everything is contained within the app, you can also delete everything by deleting the app. (nothing else will be installed on your computer).
7) You can look inside the app by right clicking on the app and selecting show contents.
8) The actual data file containing your spectra lives inside the package, so you might want to create an alias of the data file and move it to your desktop.
Running the app is simpler
1) Plug in your GS spectrometer or external sound card
2) Double click the app to launch the program, which after about 15 seconds will open your browser on tab1
3) Refresh the device index (button) and look for the sound card input index (number in first column).
4) Enter the device index and wait for the program to return a pulse shape.
Note:
Unlike PRA my program automatically checks if pulses are positive or negative then runs a pulse shape acquisition to average the number of pulses you specify in the settings.
This usually takes less than 10 seconds, depending on your detector and how many pulses you want to average.
Like PRA the pulse shape acquisition automatically ignores very small < 10% and very large pulses > 90%
5) Once you see the pulse shape on the screen you can click on Pulse Height Histogram (tab2) give your recording a name and start collecting data.
6) The spectrum will stop when max counts has been reached, this is also how you stop the recording, just enter a zero. (Might add a button for this)
7) Shape tolerance and LLD have not yet been normalised to percentage, hence large numbers here for the moment.
8) Background subtraction is super simple just name your background recording something like "my_background" record it and copy the name across to the comparison file name field. You can compare any spectrum with any other spectrum (this is how we will present isotope lines as well).
Everything is pretty self explanatory, so anyone should be able to do this.
Good luck, and don't forget, as a beta tester I need your feedback especially if you can't make it run
(Remember if it doesn't work it's not your fault it's mine π).
Steven
PS: I will get this running on Windows it's just a painful process.
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Impulse Tuesday Update
https://www.gammaspectacular.com/steven ... c_dist.dmg (265.6 MB) - Added of isotope library 230207
Todays mac update includes an isotope library showing spectra of 482 isotopes.
To avoid accidental recording over the isotope files, I have placed them in a sub directory, so to see them you need to type "../Resources/isotopes/Th228"
The naming convention for the isotopes is first letter upper case second letter lower case followed by Z "Cs137", spectra for x-rays are simply Cs_x
There are also a bunch of others such as neutron capture gammas, so I probably have to provide a way to look up the file names.
In the mean time you can always right click on the package and open the actual folder.
Steven
https://www.gammaspectacular.com/steven ... c_dist.dmg (265.6 MB) - Added of isotope library 230207
Todays mac update includes an isotope library showing spectra of 482 isotopes.
To avoid accidental recording over the isotope files, I have placed them in a sub directory, so to see them you need to type "../Resources/isotopes/Th228"
The naming convention for the isotopes is first letter upper case second letter lower case followed by Z "Cs137", spectra for x-rays are simply Cs_x
There are also a bunch of others such as neutron capture gammas, so I probably have to provide a way to look up the file names.
In the mean time you can always right click on the package and open the actual folder.
Steven
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Impulse Windows Version
Impulse will now run on Windows from the command prompt, but only with a sample rate of 44100 Hz, this is strange because it works at all sample rates on my mac.
If you want to give it a try you can download it here: https://github.com/ssesselmann/impulse
Still no .exe file for Windows, so if you don't already have python installed you will need to download it.
https://www.python.org/downloads/
Once installed you need to open your terminal and enter a few commands.
Navigate to the impulse directory using the change directory command:
Install some stuff the program needs:
Change directory to /code:
Check that you are in the right directory:
Run the program:
If all the stars are aligned your default browser should open up on the main tab.
Steven
* I am having issues compiling the Windows .exe version, PyInstaller tells me I am missing a file., hope to have this sorted out soon.
Impulse will now run on Windows from the command prompt, but only with a sample rate of 44100 Hz, this is strange because it works at all sample rates on my mac.
If you want to give it a try you can download it here: https://github.com/ssesselmann/impulse
Still no .exe file for Windows, so if you don't already have python installed you will need to download it.
https://www.python.org/downloads/
Once installed you need to open your terminal and enter a few commands.
Navigate to the impulse directory using the change directory command:
Code: Select all
cd C:\.......\impulse
Code: Select all
pip3 install -r requirements.txt
Code: Select all
cd code
Code: Select all
dir
Code: Select all
python3 run.py
Steven
* I am having issues compiling the Windows .exe version, PyInstaller tells me I am missing a file., hope to have this sorted out soon.
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
-
- Posts: 77
- Joined: 10 Nov 2020, 12:00
- Contact:
Re: Impulse by Gammaspectacular
Hi Steven - Thanks for putting in the effort to create a mac dmg version of your impulse program. I downloaded the dmg version (latest as of 7 Feb 23 evening in US EST - sometime tomorrow in Oz). I was using a GS-PRO-USB with a 38x38 mm Scionix NaI (obtained from iRad).
Initially I tried to use a macbook pro running Ventura; I could not get impusle to work (no training pulses observed, although I could see some response under settings/sound - the USB audio codec was selected as the input device). The newer macbook pro only had thunderbolt inputs and I was using a converter cable to get the usb from the GS-Pro to the macbook. There could well have been other user errors as of yet unknown.
I then got another, older macbook pro running Catalina. Direct connection of the USB cable from the GS-Pro. Under settings / sound I again selected USB-audio codec. I started the impulse program and looked for the devices. There were two entries for USB-audio codec. No joy with entry 2. I tried entry 3 and was able to see a test signal. (The source used was Cs-137).
I then went to the Pulse Height tab on the impulse program. I clicked the green start button and counts began appearing. The counts looked somewhat like Cs-137, but with very poor resolution. Initially I started with 700 V on the GS-Pro (the NaI detector had a note indicating that 750 V was to be used.) I increased the GS-Pro voltage to 750 and observed a very high low energy spike. A much lower 32 keV peak was observed and a very low 662 keV peak was observed (around 600).
I could not seem to get the lower discriminator to eliminate the very large low energy spike. This setting did not appear to be working.
I could see the green Start button and counts kept being collected. I did not see a (red??) Stop button. How does one stop the counting?
I toggled the Y-log axis button and a very odd looking shape would periodically appear (almost as if the channel dat had gotten flipped - large number of counts at high energy, nearly nothing at low energy). This shape would periodically (every second or so) change to something that looked like noise.
That is as far as I got this evening. If I figure out how to do a mac screen capture I will send you some images. [I am really more of a Windows PC person, but I have some macbooks because some students in the past used these and I was trying to make some old nuclear codes accessible for them. I also found that the macs used to be very easy to create slide shows with a music sound track These slide shows were generated under some stress for funeral services for family members. Alas, it appears that this slide show function topped out with el Capitan. More recent versions of the mac OS have become less and less useful to me.]
Initially I tried to use a macbook pro running Ventura; I could not get impusle to work (no training pulses observed, although I could see some response under settings/sound - the USB audio codec was selected as the input device). The newer macbook pro only had thunderbolt inputs and I was using a converter cable to get the usb from the GS-Pro to the macbook. There could well have been other user errors as of yet unknown.
I then got another, older macbook pro running Catalina. Direct connection of the USB cable from the GS-Pro. Under settings / sound I again selected USB-audio codec. I started the impulse program and looked for the devices. There were two entries for USB-audio codec. No joy with entry 2. I tried entry 3 and was able to see a test signal. (The source used was Cs-137).
I then went to the Pulse Height tab on the impulse program. I clicked the green start button and counts began appearing. The counts looked somewhat like Cs-137, but with very poor resolution. Initially I started with 700 V on the GS-Pro (the NaI detector had a note indicating that 750 V was to be used.) I increased the GS-Pro voltage to 750 and observed a very high low energy spike. A much lower 32 keV peak was observed and a very low 662 keV peak was observed (around 600).
I could not seem to get the lower discriminator to eliminate the very large low energy spike. This setting did not appear to be working.
I could see the green Start button and counts kept being collected. I did not see a (red??) Stop button. How does one stop the counting?
I toggled the Y-log axis button and a very odd looking shape would periodically appear (almost as if the channel dat had gotten flipped - large number of counts at high energy, nearly nothing at low energy). This shape would periodically (every second or so) change to something that looked like noise.
That is as far as I got this evening. If I figure out how to do a mac screen capture I will send you some images. [I am really more of a Windows PC person, but I have some macbooks because some students in the past used these and I was trying to make some old nuclear codes accessible for them. I also found that the macs used to be very easy to create slide shows with a music sound track These slide shows were generated under some stress for funeral services for family members. Alas, it appears that this slide show function topped out with el Capitan. More recent versions of the mac OS have become less and less useful to me.]
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Rob,
Thanks for giving it a go...
The discriminator default is 100 but you can increase it to 200. These numbers are still 16bit. so 200 is 200:65536 so 200 on mine is about the same as 0.003 in PRA. Might change this to something more meaningful.
The energy per bin switch is working nicely, but I agree the Log scale looks a bit whacky, need to check my function.
Anyways, that's a good start and you have given me something to do...haha π
Steven
Thanks for giving it a go...
Ventura is the latest release, I must admit I am still one version behind, so now I have to upgrade and test it. It could have been something simple like pulse too loud or too soft. I set some arbitrary thresholds between 10% and 90% for the pulse shape acquisition function. Could also be that it took too long before it collected 100 samples.Initially I tried to use a mac book pro running Ventura; I could not get impulse to work (no training pulses observed, although I could see some response under settings/sound - the USB audio codec was selected as the input device).
The proper volume/gain setting is when the Cs137 peak hovers around channels 200 to 250, so it looks as if your gain was a bit on the high side, this might also be why you were getting noise the first bins on the left.I then went to the Pulse Height tab on the impulse program. I clicked the green start button and counts began appearing. The counts looked somewhat like Cs-137, but with very poor resolution. Initially I started with 700 V on the GS-Pro (the NaI detector had a note indicating that 750 V was to be used.) I increased the GS-Pro voltage to 750 and observed a very high low energy spike. A much lower 32 keV peak was observed and a very low 662 keV peak was observed (around 600).
I could not seem to get the lower discriminator to eliminate the very large low energy spike. This setting did not appear to be working.
The discriminator default is 100 but you can increase it to 200. These numbers are still 16bit. so 200 is 200:65536 so 200 on mine is about the same as 0.003 in PRA. Might change this to something more meaningful.
Great, I can confirm there is nothing wrong with your eyes.... I removed the red button, it did not work π. The function that collects pulses runs in a loop and it takes as input max_pulses, therefore it stops when max_pulses has been reached. The current way to stop the recording is just to change "stop after n counts" to zero. I have to figure out a way to fix this in future versions.I could see the green Start button and counts kept being collected. I did not see a (red??) Stop button. How does one stop the counting?
If you start a new recording without stopping the previous one, a situation seem to appear where it alternates between the two spectra, this is easily fixed by renaming your spectrum. Have not taken the time to investigate it yet as it has low priority.I toggled the Y-log axis button and a very odd looking shape would periodically appear (almost as if the channel dat had gotten flipped - large number of counts at high energy, nearly nothing at low energy). This shape would periodically (every second or so) change to something that looked like noise.
The energy per bin switch is working nicely, but I agree the Log scale looks a bit whacky, need to check my function.
Anyways, that's a good start and you have given me something to do...haha π
Steven
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Guys and Girls,
Just a brief update and opportunity to share my frustration, impulse is working perfectly from the command line when you run the scripts, but for some strange reason I can't get it to compile into an app or an exe file.
There are two popular methods of converting Python scripts to executable programs, one is called AppInstaller the other is called py2app (py2exe on windows). Over the past week I have tried everything you can imagine, but neither of the programs work for me. Last week I was able compile a mac app using py2app, but after I upgraded my machine to Ventura (latest Mac Os) it too does not work.
Tried installing, uninstalling, upgrading & sidegrading, the only joy is when I see a different error message. Right now, py2app completes running without errors and outputs a nice looking app, but when I double click the icon it bounces in the dock for a few seconds and pops up with a message telling me that it failed to launch and no other error messages in the terminal.
There is nothing complicated about my scripts, it should just work, all I can imagine is some kind of incompatibility between versions of my OS, Python 3.9, pip3 and py2app
The impulse scripts on github are the latest and they work, so if anyone wants to give this a go on a different machine., feel free to download the scripts and try.
https://github.com/ssesselmann/impulse
PS: I discovered a conflicts between PyInstaller and py2app (py2exe) so I recommend only having one installed at the time, just do
or
just to make sure.
Steven
Just a brief update and opportunity to share my frustration, impulse is working perfectly from the command line when you run the scripts, but for some strange reason I can't get it to compile into an app or an exe file.
There are two popular methods of converting Python scripts to executable programs, one is called AppInstaller the other is called py2app (py2exe on windows). Over the past week I have tried everything you can imagine, but neither of the programs work for me. Last week I was able compile a mac app using py2app, but after I upgraded my machine to Ventura (latest Mac Os) it too does not work.
Tried installing, uninstalling, upgrading & sidegrading, the only joy is when I see a different error message. Right now, py2app completes running without errors and outputs a nice looking app, but when I double click the icon it bounces in the dock for a few seconds and pops up with a message telling me that it failed to launch and no other error messages in the terminal.
There is nothing complicated about my scripts, it should just work, all I can imagine is some kind of incompatibility between versions of my OS, Python 3.9, pip3 and py2app
The impulse scripts on github are the latest and they work, so if anyone wants to give this a go on a different machine., feel free to download the scripts and try.
https://github.com/ssesselmann/impulse
PS: I discovered a conflicts between PyInstaller and py2app (py2exe) so I recommend only having one installed at the time, just do
Code: Select all
pip3 uninstall PyInstaller
pip3 install -U py2app
or
Code: Select all
pip3 uninstall py2app
pip3 install -U PyInstaller
just to make sure.
Steven
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
- NuclearPhoenix
- Posts: 40
- Joined: 15 Aug 2022, 19:24
- Location: Austria
- Contact:
Re: Impulse by Gammaspectacular
Steven,
what do we have to do to try and package it up?
Like how does one use PyInstaller or py2app and what package should we use preferably?
Would like to give it a try, but I have no idea where to start, not even what packager I should use ;))
what do we have to do to try and package it up?
Like how does one use PyInstaller or py2app and what package should we use preferably?
Would like to give it a try, but I have no idea where to start, not even what packager I should use ;))
Matthias | https://nuclearphoenix.xyz
- Sesselmann
- Posts: 1049
- Joined: 27 Apr 2015, 11:40
- Location: Sydney
- Contact:
Re: Impulse by Gammaspectacular
Matthias,
As mentioned there are two methods, but it looks like people have better success with py2exe https://www.py2exe.org
There are heaps of useless youtube videos showing you how easy it is to package up a three line "hello world" program. you just type:
The method is simple:
Download and test Impulse
(anyone with Python installed can do this)
1) Download the impulse directory with all the scripts from github.
2) Install the dependancies from .../impulse
3) Check that it runs by navigating to the .../impulse/code folder via the command line and type the browser should open up on the get shape page. If you have a sound card and a detector connected it should find the pulse after a few seconds of selecting the right index.
4) Once you see a pulse on the first tab, just click on the second tab and start recording a spectrum, super easy and this part should work (let me know if you have issues)
PS: This method should work on Mac, Windows or Linux if Python is installed.
## The following part is only for Python programmers who want to try making an exe file or app.... ##
Creating a .exe file
The only reason for doing this is so people with no python experience can download a package with all dependencies included and run the program from an executable file. It should be possible to do this with a python program called py2exe.
1) Start by installing py2exe (windows) or py2app (mac)
2) I have already created the setup scripts on github, so all you need to do is navigate the the directory with my code and type
2b) If you are on a mac it's the same but the commands are
3) The program will start compiling all the dependencies of python into a single folder, this can take a few minutes depending on your machine.
4) Now if you have a mac you should get an app with a pretty icon which you can just click and play (doesn't work for me) but if I right click the app and and view package content, then I cam go the the MacOs folder and it will run from there.
5) Windows is not as elegant, you basically get a folder with hundreds of files of which one ugly looking black one with .exe extension is your program. (Windows users are used to it π)
Troubleshooting
It would be nice if this just worked out of the box, and for some it might.
Running the script from the command line might help debugging as it will then tell you if something is missing.
Google is your friend, but PM me if you have any questions.
Steven
As mentioned there are two methods, but it looks like people have better success with py2exe https://www.py2exe.org
There are heaps of useless youtube videos showing you how easy it is to package up a three line "hello world" program. you just type:
Code: Select all
python setup.py py2exe
Download and test Impulse
(anyone with Python installed can do this)
1) Download the impulse directory with all the scripts from github.
2) Install the dependancies from .../impulse
Code: Select all
pip3 install -r requirements.txt
Code: Select all
python run.py
4) Once you see a pulse on the first tab, just click on the second tab and start recording a spectrum, super easy and this part should work (let me know if you have issues)
PS: This method should work on Mac, Windows or Linux if Python is installed.
## The following part is only for Python programmers who want to try making an exe file or app.... ##
Creating a .exe file
The only reason for doing this is so people with no python experience can download a package with all dependencies included and run the program from an executable file. It should be possible to do this with a python program called py2exe.
1) Start by installing py2exe (windows) or py2app (mac)
Code: Select all
pip3 install py2exe
Code: Select all
python setup_pc.py py2exe
Code: Select all
python3 setup_mac.py py2app
4) Now if you have a mac you should get an app with a pretty icon which you can just click and play (doesn't work for me) but if I right click the app and and view package content, then I cam go the the MacOs folder and it will run from there.
5) Windows is not as elegant, you basically get a folder with hundreds of files of which one ugly looking black one with .exe extension is your program. (Windows users are used to it π)
Troubleshooting
It would be nice if this just worked out of the box, and for some it might.
Running the script from the command line might help debugging as it will then tell you if something is missing.
Google is your friend, but PM me if you have any questions.
Steven
Steven Sesselmann | Sydney | Australia | https://gammaspectacular.com | https://beejewel.com.au | https://www.researchgate.net/profile/Steven-Sesselmann
Who is online
Users browsing this forum: No registered users and 1 guest