Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Issues #12

Closed
AlalaStorm opened this issue Oct 2, 2020 · 5 comments
Closed

Code Issues #12

AlalaStorm opened this issue Oct 2, 2020 · 5 comments
Labels
question Further information is requested

Comments

@AlalaStorm
Copy link

Dear Oliver, first of all excuse me if the answer is obvious.
I'm trying to get some measurements with the electron-detector. I build it and used the web browser application to get the measurement data (named DIY_Particle_Detector_15-pulses_2020-09-06_19-51.msgp), but i'm having troubles with the data analysis.

I'm not an expert on programming with python, and I normally use the Thonny app (i'm not sure if this is a problem).
I open the analyse_and_plot_pulses.py, and write in the row 88 --> file_name = "C:/Users/Home/Desktop/DATA ANALISYS/data/DIY_Particle_Detector_15-pulses_2020-09-06_19-51.msgp"
and in the next row --> if file_name is not "C:/Users/Home/Desktop/DATA ANALISYS/data/DIY_Particle_Detector_15-pulses_2020-09-06_19-51.msgp":
Then in the row 117 --> df = pd.read_pickle("C:/Users/Home/Desktop/DATA ANALISYS/data/KCL_9-44g_1x3x3cm_touchingdiodecase_pulses_2019-07-08_23-07-18___947___11-47.pkl")
Next I run the code but I get the next message error -->
%Run analyse_and_plot_pulses.py
Traceback (most recent call last):
File "C:\Users\Home\Desktop\DATA ANALISYS\analyse_and_plot_pulses.py", line 117, in
df = pd.read_pickle("C:/Users/Home/Desktop/DATA ANALISYS/data/KCL_9-44g_1x3x3cm_touchingdiodecase_pulses_2019-07-08_23-07-18___947___11-47.pkl")
File "C:\Users\Home\AppData\Roaming\Python\Python37\site-packages\pandas\io\pickle.py", line 182, in read_pickle
return pickle.load(f) _pickle.UnpicklingError: invalid load key, 'v'.

The trouble I am facing is that I don't have enought knowledge to know what is failling and how to solve it.

Could you please give me a hand on this?
Please, let me know if I missed some information more to give you.
Thanks a lot in advance!

@ozel
Copy link
Owner

ozel commented Oct 5, 2020

Hi!
The loading of .msgp files is at the moment implemented in a somewhat confusing way. You only need to do two things:
Set the full path name to variable file_name in line 88 and comment the line 117 such that it is disabled:
# df = pd.read_pickle(.... It is either a pickle file or a .mgsgp file that needs to be loaded, not both.
The if statement in line 90 should not be changed at all.
I am in the process of updating this script with a more simplified loading of data files/folders and other improvements that I will hopefully upload soon.

But in in principle, you will run into the same issue as @SteveF161 since you are using the electron-detector.
Please have a look at this reply together with my later replies here: #10 (comment)
I might add a set of different pulse processing parameters (THL, min_g, min_length, max_length) that allow to process electron-detector pulses if there is more interest. Maybe Steve already found good ones?
So far I have developed the analysis scripts only with the alpha-detector in mind which produces larger output pulses that the electron-detector.
In general, electrons from beta decays produce a continuous energy spectrum and the detector therefore cannot reveal characteristic energy lines. Unless you have a low-energy source of x-rays or mono-energetic electrons, recorded spectra will always look similar to this one from my Sensors paper, figure 7 b):

This is not a real characteristic peak as in an alpha energy spectrum. The left edge represents the lower minimum sensitivity threshold of the amplifier circuit and the right 'edge' is defined by the geometry/thickness of the sensor chip which limits the maximum recorded energy from electrons (or scattered gammas in few cases).

I did not know about the Thonny app. It seems like a great choice especially in an education context! Since it uses a modern python version, it should work well if all required modules are installed.
I will put it on my to-do list and try it out myself. Would be great if even the pulse_recorder.py script runs in it.

@ozel ozel added the question Further information is requested label Oct 5, 2020
@AlalaStorm
Copy link
Author

AlalaStorm commented Oct 6, 2020 via email

@ozel
Copy link
Owner

ozel commented Oct 6, 2020

It looks like something went wrong in your post, there is no error message.

But again, Steve did not really run into an "error" in this case because the analyse_and_plot_pulses.py script is at the moment simply not intended to be used in combination with the electron-detector. The pulses of the two detector variants have different shapes and the script is looking specifically for the shape of alpha detector pulses (unless it is changed as explained above/in the other issue).
Let me know if there is still something unclear.

@ozel ozel closed this as completed Oct 20, 2020
@AlalaStorm
Copy link
Author

AlalaStorm commented Oct 25, 2020 via email

@ozel
Copy link
Owner

ozel commented Oct 28, 2020

Hi, I am glad that you like the project so much.
There are multiple things here:
The script does not find pulses, thats why it stops with an error. But it reads the file that you have recorded correctly.
As I wrote above - and I would really encourage you to read my answers above carefully again - the electron-detector that you have built is not compatible with that python script. There are practical reasons: different pusles sizes of electron-detector and the alpha-spectrometer, this could be addressed but needs changes in the script - see my previous replys above.
But there is also an important "physics reason": it is not possible to record a meaningfull energy spectrum from just electrons from beta decays with the electron-detector that you have built.
If you want to record and plot alpha energy spectra like shown in my paper, you can change a few components which will turn the detetcor into an alpha-spectrometer: D1-4, R3, R4, R5, R8, C4, C6, C9 need to be changed.
More on both detector variants, including the different part lists: https://github.com/ozel/DIY_particle_detector/wiki/Assembly-Instructions#required-parts

Unfortunatelly, there are again no images visible in your post.
But you mention measuring a bananna. The radioactivity of one banana is extremly low because the amount of potassium-40 in it is very low, too. Most detectors cannot measure this low level, you would need an expensive gamma spectrometer that is well shielded with lead against background radiation. I know this sounds unexpected because so many talks about the radioactivity of a banana - it is over-hyped on youtube and actually hard to measure.

In a nutshell, you are not doing things wrong per se. You are just trying to measure something that cannot be measured with this detector.
I would propsose to find some reliable reference object like old uranium glass or uranium galzed ceramics from the flea markets or with some luck from the vintage glass cupboard of your parents/grandparents (check google and wikipedia for images of "uranium glass" and "uranium glaze"). From those objects, you could expect a few pulses per minute, like 3 to 10, maybe, depending on the object, of course.
From just the terrestrial and cosmic natural radiation - without any source on the detector- the count rate is very low because the diodes are rather small. It depends on your location, but it would typically be something like one pulse every 5 minutes.
Alternatively, you can try to find potassium salt in a supermarket or organics/diet food shop and measure that: KCl. That is basically 50 percent of potassium and much more of the radioactive and naturally occurring potassium-40. An English brand of KCl, aka "reduced sodium slat", is called "No Salt" (100 % KCl) and another one "Lo Salt" (66% KCl). Pharmacies and eBay sell KCl as well.

By the way, the script output tells me that your recording was 290 waveforms in 22 minutes. That is way too much just from natural background radiation if you had just a banana on the detetcor. But again, your pictures are missing. Maybe you were measuring something else than a banana. Maybe try posting your pictures from another browser?

I suspect that the threshold level is set too sensitive and your are recording too much noise instead of actual pulses from radioactivity. That means you have to move the threshold line further down, away from the signal noise.
Please have a close look at the troubleshooting page on the wiki: https://github.com/ozel/DIY_particle_detector/wiki/Troubleshooting
If your pulses do not look like those, you most probably measure just electronic noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants