## Time for a new app

PRA, BeqMoni, Theremino, Fitzpeaks and beyond!
Hendrik Vingerhoet
Posts: 18
Joined: 01 May 2018, 04:46
Contact:

### Time for a new app

Hey everybody,

since Geigerbot is sort of dead (no news on updates for ios 12) i decided to create a new app for iOS (sorry android folks, maybe later).
Plan is to release it for free with a option to donate if you like.
So far i have been testing my own pulse counting code in javascript and that works fine so far. Now its time for some native code to get the speed up.
I was wondering if anyone has wishes or things you would like to see apart from the obvious. Suggestions are welcome, so far:

• Easy calibration process
• Easy setup
• Settings for multiple probes
• GPS logging of count rate
• Option to view recorded data in webbrowser on pc / export (requires account)
• Background substraction + save backgrounds for later use
• Save spectrum for later use / overlay spectrum

Regarding for when this will be ready, no clue, it has been quite a while since i wrote some objective-c, also depends a lot on what suggestions there are and how things turn out regarding the pulse count.
I hope soon.

Sesselmann
Posts: 926
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

### Re: Time for a new app

Sounds promising, happy to help you with beta testing the app when you are at that stage.

You can find good information about the necessary pulse shape filtering in the PRA manual, Marek might also be willing to help if you get stuck.

Steven

Hendrik Vingerhoet
Posts: 18
Joined: 01 May 2018, 04:46
Contact:

### Re: Time for a new app

Thanks Steven,
after a bit of a late night this is where i am at, this is raw data above a treshold line without looking at where the base of the pulses is and i am now trying to work out how to clean it up a bit.

I will take a look at the PRA documentation, thanks for that idea.
Edit: i have had a quick look at where to find the manual, do you have any link?
Attachments

Sesselmann
Posts: 926
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

### Re: Time for a new app

Nice progress...

If you look at the way Marek has done it, you will see that his method is immune to baseline drift, each pulse is sampled, normalised and zeroised so the sum of all samples alway equals zero.

This is then compared to the mean pulse shape and accepted or rejected according to the set tolerance.

Steven

PS: When you download PRA here you get the manual with it. https://www.gammaspectacular.com/marek/pra/PRA22.7z

Conor Whyte
Posts: 108
Joined: 28 Apr 2019, 15:06
Contact:

### Re: Time for a new app

I am very interested in this new application - curious about if you could add in a shape detection that would recognize a detected isotope based on a trained shape with a given probe.
Would something like this be possible?

What's the sample rate like on an iPad pro?

Currently working on building a basic program in MATLAB that uses a Teensy 3.6 as an MCA to pull data directly from Detector. Works at over 1Mhz at 12bit depth.

Hendrik Vingerhoet
Posts: 18
Joined: 01 May 2018, 04:46
Contact:

### Re: Time for a new app

Thats actually something i worked out by accident today, i am struggeling a bit with the stuff i found in the PRA documentation so i tried something similar, which gives me great results for background reduction and enhancing a certain range of pulse shapes / kev, i will definetly keep that bit of code. (the photo below is the same CS137 source as in the first picture, total sampling time about 3 minutes with NO shielding at all!).

How does your matlab code work, is it just a basic over treshold pulse height check or do you have some other implementation?

Regarding the sample rate, i dont have a iPad pro for refference, but it seems to be limited to 48khz sadly enough. In wich i detect about 2000 counts per second, should go a bit higher once i optimized some stuff and this of course depends on radiation source and other stuff.

If anyone wants to help with the formula's of PRA it would help a great deal. I understand the formulas but am struggeling with the inputs for them (its not to clear to me from what is written).
I will also try to get in touch with Marek :)
Attachments

Sesselmann
Posts: 926
Joined: 27 Apr 2015, 11:40
Location: Sydney
Contact:

### Re: Time for a new app

Hi devilmasah,

Good progress on the app and yes send Marek and email.

Okay I just noticed that we haven't been formally introduced, one of the forum rules here is that we post with our real names. Since the discussions are of a scientific nature it is important to know who said what and why, real names are also a good deterrent for trolls.

In the UCP (User Control Panel) you are allowed to change your login handle, or if you want to keep the existing login handle, you can alternatively add a real name in the signature section, this will then print at the bottom of every post you write.

Steven

Conor Whyte
Posts: 108
Joined: 28 Apr 2019, 15:06
Contact:

### Re: Time for a new app

The iPad Pro (recent one) can record at 192 khz / 24 bit.

The MATLAB code is still being worked on with the hardware considerations. More info coming soon.

Hendrik Vingerhoet
Posts: 18
Joined: 01 May 2018, 04:46
Contact:

### Re: Time for a new app

Thats great, then i should also make an option to select that :)

I think i figured out the two first formula's in the PRA documentation but i am stuck at the rest of it right now, i sent Marek an Email and hope he is willing to explain a few things.
Meanwhile i am working on other parts of the program like saving settings and stuff.

Conor Whyte
Posts: 108
Joined: 28 Apr 2019, 15:06
Contact:

### Re: Time for a new app

I'd love have a look at your app as well. My "experimental" app ( actually executed code) is pulling in pulses directly off a decoupling capacitor from a Teensy 3.6 and shaping it for display in MATLAB signal processing. (non soundcard route to experiment with higher A/D rates)

How are you building your app? Do you have a sample of the app so far?

Here is the MATLAB code

Code: Select all


%% Data collection %%
% time to run in seconds
t = 60*60;
% Communication port to the Teensy
COMPORT = 'COM8';
% Prepare file with current date and time
strname = ['data/' char(strjoin(string(fix(clock)), '-')) '.txt'];
fid = fopen(strname, 'w');
% Prepare serial communication
s = serial(COMPORT);
try
fopen(s);
catch %#ok<CTCH>
% Failed, properly because the handle was not closed, so we're freeing
% all the handles and trying again.
delete(instrfindall)
s = serial(COMPORT);
fopen(s);
end
% Using try/catch to safely let go of serial handle in case of trouble
try
% Prepare timer
tic

% Flush buffer
if (s.BytesAvailable > 0)
end
% Data acquisition
while (toc < t)
val = fscanf(s);

% Save value to file
fwrite(fid, val);
end
catch err
% Deinitialize
fclose(s);
delete(s);
fclose(fid);
clear s t
rethrow(err);
end

% Deinitialize
fclose(s);
delete(s);
fclose(fid);
clear s t
%% Data processing %%
assert(exist('strname', 'var')==1, 'voltage_reader error: strname not set.');
if exist(strname, 'file') ~= 2
error(['voltage_reader error: File (strname=' strname ') doesn''t exist.']);
end
fid = fopen(strname, 'r');
try
% Ignore two first lines in case of data collection started in the middle of a transfer
output = textscan(fid, '%f', 'HeaderLines', 2);
output = output{1};
% Ignore last line in case of data collection ended in the middle of a transfer
output(end) = [];
catch err
fclose(fid);
clear fid
rethrow(err);
end
% Get file last modified date minus creation date (=the duration for the experiment)
listing = dir(strname);
fname   = listing.name;
fname   = fname(1:end-4);
time    = (datenum(listing.date) - datenum(fname, 'yyyy-mm-dd-HH-MM-SS')) * 24*60; % in minutes
% Deinitialize
fclose(fid);
clear fid listing fname
% Make histogram (place into bins)
[n, xout] = histogram(output, 1000);
% Show data
figure;
bar(xout, n);
xlabel('Channel');
ylabel('Counts');
title(['Running time: ' int2str(time) ' minutes (' int2str(time*60) ' seconds)']);
% Show log(data)
figure;
n = log(n);
bar(xout, n);
xlabel('Channel');
ylabel('log(conts)');
title(['Running time: ' int2str(time) ' minutes (' int2str(time*60) ' seconds)']);
% Deinitialize
clear xout n time
%%
function [dnl,inl,misscodes] = dnl_inl_sin(y)
%DNL_INL_SIN
% dnl and inl ADC output
% input y contains the ADC output
% vector obtained from quantizing a
% sinusoid
% Boris Murmann, Aug 2002
% Bernhard Boser, Sept 2002
% histogram boundaries
minbin=min(y);
maxbin=max(y);
% histogram
[h,x] = histogram(y, minbin:maxbin);
% cumulative histogram
ch = cumsum(h);
% transition levels found by:
T = -cos(pi*ch/sum(h));
% linearized histogram
hlin = T(2:end) - T(1:end-1);
% truncate at least first and last
% bin, more if input did not clip ADC
trunc=2;
hlin_trunc = hlin(1+trunc:end-trunc);
% calculate lsb size and dnl
lsb= sum(hlin_trunc) / (length(hlin_trunc));
dnl= [0 hlin_trunc/lsb-1];
misscodes = length(find(dnl<-0.99));
% calculate inl
inl= cumsum(dnl);
figure
subplot(2, 2, 1);
plot(x, h);
xlabel('Channel');
ylabel('Counts');
title('Histogram');
subplot(2, 2, 2);
plot(1:length(dnl), dnl);
xlabel('Channel');
ylabel('DNL [LSB]');
title(['DNL = +' num2str(max(dnl),2) ' / ' num2str(min(dnl),2) ' LSB. No. of missing codes (DNL < -0.99): ' int2str(misscodes)]);
subplot(2, 2, 3);
plot(x, log(h));
xlabel('Channel');
ylabel('log(counts)');
title('Log-histogram');
subplot(2, 2, 4);
plot(1:length(inl), inl);
xlabel('Channel');
ylabel('INL [LSB]');
title(['INL = +' num2str(max(inl),2) ' / ' num2str(min(inl),2) ' LSB.']);
end

### Who is online

Users browsing this forum: No registered users and 2 guests