Erased events remain on screen

43 views
Skip to first unread message

Anand Kulkarni

unread,
Sep 18, 2018, 1:11:15 PM9/18/18
to stimfit
Hello,
       Thanks to the authors for making this piece of software freely available to the community. Its a great service. 

I detected some events and they show up in the form of the onset-indicating downward arrow and check mark and peak-indicating blue circle (see stimfit1.png). However, when I ask stimfit to erase all events (see stimfit2.png), it only gets rid of the blue circle and the downward arrow. The check mark stays in the GUI (see stimfit3.png). It gets confusing when I try out different thresholds for event detection because the check marks start crowding the top of the plot. 

Is this a bug or an example of improper use? 

Thanks a ton,
Anand   

  
                
stimfit1.png
stimfit2.png
stimfit3.png

Jose Guzman

unread,
Sep 21, 2018, 8:36:44 AM9/21/18
to sti...@googlegroups.com
Hello Anand,

Thank you for your email and for using Stimfit. The presence of the check-box upon event removal is simply a visualisation issue. I will not affect the algorithm for detection or the selection of the events. 

I am analysing spontaneous events myself these days, and we will update the visualisation issue in the next version of Stimfit.

Cheers

Jose


JoSe GuZmAn



--

---
You received this message because you are subscribed to the Google Groups "stimfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stimfit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<stimfit1.png><stimfit2.png><stimfit3.png>

Christoph Schmidt-Hieber

unread,
Sep 23, 2018, 2:24:48 PM9/23/18
to sti...@googlegroups.com

Anand Kulkarni

unread,
Sep 25, 2018, 2:21:02 PM9/25/18
to stimfit
Hi Christoph/Jose,
                  Thanks for your quick response and fix. How do I ensure that the patch works on my system? Here is what I have tried:

I deleted (on my Mac)  /Applications/Macports containing /Applications/Macports/Python2.7 and /Applications/Macports/Stimfit.app to 'uninstall' Stimfit.
When I try to reinstall Stimfit using sudo port install stimfit py27-stfio  I get the following errors:

Warning: Error parsing file /Applications/MacPorts/Python 2.7/Python Launcher.app/Contents/MacOS/Python Launcher: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/MacOS/stimfit: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/lib/stimfit/libbiosiglite.dylib: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/lib/stimfit/libpystf.dylib: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/lib/stimfit/libstfio.dylib: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/lib/stimfit/libstfnum.dylib: Error opening or reading file

Warning: Error parsing file /Applications/MacPorts/stimfit.app/Contents/lib/stimfit/libstimfit.dylib: Error opening or reading file


On the other hand, if I restore that directory and run that command, the installation does not result in any errors, but the check marks don't go away when I erase all events.

Thanks for your help.
Anand  

Christoph Schmidt-Hieber

unread,
Sep 25, 2018, 2:30:24 PM9/25/18
to stimfit
The MacPorts version has not been updated yet. I’ll keep you posted.

Anand Kulkarni

unread,
Sep 25, 2018, 3:57:59 PM9/25/18
to stimfit
Great! Thanks :)

I am trying to get the events onsets and other event features that Stimfit detects exported out in any format (GDF would be good). I tried looking for the detect_events function in stf, and this is all the documentation I could find on it. 

Help on function detect_events in module stf:

detect_events(template, mode='criterion', norm=True, lowpass=0.5, highpass=0.0001)

How can I get further documentation on stf.detect_events and other stf functions?

Anand Kulkarni

unread,
Sep 25, 2018, 4:06:42 PM9/25/18
to stimfit
Or a good way to export event onsets would be great too.

Jose Guzman

unread,
Sep 25, 2018, 4:18:47 PM9/25/18
to sti...@googlegroups.com
Hi Anand,

If you choose “Extract selected events” from the context menu, a new file is created with the detected events. There is a table on the left part of the window that contains event onsets and inter-event intervals.

Cheers

Jose

Anand Kulkarni

unread,
Sep 25, 2018, 4:28:35 PM9/25/18
to stimfit
Of course... I missed that, while trying to go the python route. 

Thanks,
Anand

Christoph Schmidt-Hieber

unread,
Sep 25, 2018, 4:49:14 PM9/25/18
to stimfit
stf.detect_events returns the detection criterion for your selected event detection method as a numpy array.

For example, if you set the mode to ‘deconvolution’, it will return the result of the deconvolution of your trace and the provided template.

The advantage is that you can use an arbitrary numpy array as a template (though I think it needs to be normed - not sure how I implemented it).

To get the indices of your events, you’d then have to apply some peak detection on the result of detect_events, like for example stf.peak_detection

Christoph Schmidt-Hieber

unread,
Sep 25, 2018, 4:55:55 PM9/25/18
to sti...@googlegroups.com
I’ve been asked this question a couple of times now. It seems to be missing from the tutorial / documentation. The cursor needs to be in “event mode” for this to work. Also, extracting the events does not create "a new file", it just opens a new window showing the extracted events.

Anand Kulkarni

unread,
Sep 26, 2018, 5:32:01 PM9/26/18
to stimfit
I am trying to import stfio. I am running into the following error stack. Can you take a quick look and tell me what may be happening? 

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stfio/__init__.py", line 6, in <module>
    from .stfio import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stfio/stfio.py", line 23, in <module>
    _stfio = swig_import_helper()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stfio/stfio.py", line 22, in swig_import_helper
    return importlib.import_module('_stfio')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _stfio

Anand Kulkarni

unread,
Sep 27, 2018, 2:20:05 AM9/27/18
to stimfit
Dear Christoph,
                         How exactly is the template normalized? Is it converted to have values between 0 and -1 (mine is a negative going template)? 

Christoph Schmidt-Hieber

unread,
Sep 27, 2018, 2:33:25 AM9/27/18
to stimfit
Best is you either try and see what the result is, or alternatively you go through the code:

I think that if you set norm = True, the template will be normalised to have range (0, +1)
https://github.com/neurodroid/stimfit/blob/master/src/pystfio/pystfio.cxx#L110

You could try to normalise it so that it has range (-1, 0) and set norm=False and see what happens

I’ve added this function mostly for debugging purposes. Probably better to hide it from the user, as it’s poorly documented and untested.

Christoph Schmidt-Hieber

unread,
Sep 27, 2018, 8:40:39 AM9/27/18
to sti...@googlegroups.com
The stfio bug should be fixed in
https://github.com/neurodroid/stimfit/commit/922f1679

You can test the fix by checking out the latest GitHub revision

Might take a while until I can update the MacPorts version


CSH

Anand Kulkarni

unread,
Sep 27, 2018, 3:16:21 PM9/27/18
to stimfit
I am trying to match the deconvolution output from stimfit with the output of the Matlab script called signal_deconvolution from biosig. Right now, the two deconvolutions are not matching.  

For you reference, I am copying the Matlab function here:

function d = signal_deconvolution(r,t,fs,highpass,lowpass)

% SIGNAL_DECONVOLUTION deconvolves some raw data with some given template in order

%   to improve the detection of miniature epsc's, and ipsc's. 

%

% d = SIGNAL_DECONVOLUTION(raw,template,samplerate,highpass,lowpass)

% ... SIGNAL_DECONVOLUTION(raw,template,samplerate,[highpass,lowpass])

% ... SIGNAL_DECONVOLUTION(raw,template,samplerate,[lowpass, highpass])

%

% INPUT:

%    raw: raw data (a Nx1 data vector)

%    template: template (a Mx1 data vector)

%   it is assumed that the template starts immidiately with the first sample        

%    samplerate: sampling rate in Hz

%    highpass: edge frequency of highpass filter in Hz, default 0.1 Hz.

%    lowpass: edge frequency of lowpass filter in Hz, default 100 Hz. 

%   

% Output: 

%    d: detection trace 

%

% see also: get_local_maxima_above_threshold

%

% Reference(s): 

%  [1] A. Pernía-Andrade, S.P. Goswami, Y. Stickler, U. Fröbe, A. Schlögl, and P. Jonas (2012)

%     A deconvolution-based method with high sensitivity and temporal resolution for 

%     detection of spontaneous synaptic currents in vitro and in vivo.

%     Biophysical Journal Volume 103 October 2012 1–11.

 

%  Copyright (C) 2012,2013 by Alois Schloegl, IST Austria <alois.s...@ist.ac.at>

%  This is part of the BIOSIG-toolbox http://biosig.sf.net/

 

 

%% check filter settings - input arguments

if nargin>4

    if numel(highpass)==2,

    B = highpass;

    else

    B = [lowpass, highpass]; 

    end;

    B = [min(B),max(B)];

else

    B = [];

end;

 

%% transform into frequency domain 

H = fft(t,size(r,1));

R = fft(r); 

 

%% compute deconvolution in frequency domain

D = R./H;

 

%% filter in frequency domain

f = [0:size(r,1)-1] * fs / size(r,1);

if isempty(B),

    ;

elseif 0,

    %% rectangular window in interval [B(1),B(2)]

    D(f < B(1) | B(2) < f) = 0;

    D = D*2;

elseif 1,

    %% rectangular window in intervals [B(1),B(2)] and [fs-B(2),fs-B(1)]

    D( f<B(1) | ( B(2) < f & f < (fs-B(2)) ) | (fs-B(1)) < f ) = 0;

else

    %% Gaussian window

    w = 1/sqrt(2*pi*B(2)/fs) * exp (-0.5*min([f;fs-f]/B(2),[],1).^2);

    w( f<B(1) | fs-B(1) < f ) = 0; 

    D = fs*w(:).*D;

end; 

 

 

%% convert from frequency domain into time domain. 

d = real(ifft(D));

    


I am not sure if normalization is the issue for the mismatch or something else. Do you know what could be causing this? I am making sure that the cut-off frequencies are the same across the two methods.  

Thanks,
Anand 

Christoph Schmidt-Hieber

unread,
Sep 27, 2018, 3:29:58 PM9/27/18
to sti...@googlegroups.com
No I don’t know what is causing this.

You’d have to compare stimfit’s source code with the MATLAB version:
https://github.com/neurodroid/stimfit/blob/master/src/libstfnum/stfnum.cpp#L708

Anand Kulkarni

unread,
Sep 27, 2018, 4:23:18 PM9/27/18
to stimfit
Thanks for the quick responses! I really appreciate that :)
Reply all
Reply to author
Forward
0 new messages