Decay Measurements

47 views
Skip to first unread message

Robbie Ingram

unread,
Oct 20, 2019, 7:13:37 PM10/20/19
to stimfit
Hello Everyone, 

Is there a way to measure the decay time of events? I'm thinking of something similar to rise time, in that we select the cursor settings (e.g. 90%-10%) and Stimfit outputs a measurement in units of time. Please let me know if the option exists, and I just so happened to have missed it. 

Thanks!

Jose Guzman

unread,
Oct 21, 2019, 3:26:10 AM10/21/19
to stimfit
Hi Robie!

What I do is to extract the events after detection and analize them individually in batch mode.

Hope it helps!

Jose

robbiei...@gmail.com

unread,
Oct 29, 2020, 5:43:24 PM10/29/20
to stimfit
Hey Jose,

I've been trying to analyze the decay manually (it's been a while), and I'm running into some problems. I see that you analyze them individually in batch mode, but I can't seem to figure out how to get the decay measure of an event from the batch analysis options. For reference, I'm using a biexponential function. Is there some way to get the decay time or decay constant using the Python shell? Or is it given somewhere in the model fit parameters for each event - perhaps tau1 or tau2. Please forgive any oddly worded questions, I am relatively new to programming!

Thank you so much,
Robbie

Jose Guzman

unread,
Oct 30, 2020, 3:40:05 AM10/30/20
to sti...@googlegroups.com
Hi Robbie!

To get the decay parameters of a fitting function, you need activate the option ‘Fit results’ from Analysis->Batch Analysis… You will then return a table with the measurements you’re interested, together with the fitting parameters (e.g., Tau_0, Tau_1, Amp_0, Amp_1 and offset for a biexponential function). The menu will prompt a window, where you need to select the model to fit (e.g., 4 for Biexponential fixed to baseline)

Because you’re familiar with Python, I would recommend you fit the traces with stf.leassq (https://neurodroid.github.io/stimfit/stf_reference/stf.html?highlight=stf%20least#stf.leastsq). Leastsq  returns a dictionary with the parameters of the fit. For example, for fitting the current trace to a biexponential function with offset fit to baseline type:

>>> stf.leasqs(4)

It will return something like this:
{'Amp_0': -3620.5591832102195, 'Amp_1': 3620.4211214155002, 'Offset': 0.6489881277084351, 'SSE': 27.6380692739621, 'Tau_0': 8047673.295657108, 'Tau_1': 9747523.405566225}

To get the decay time constant:
>>> my decay  = stf.leassq(4)[’Tau_1’]

Ideally, you want to do it for every trace in the recording. Remember to set the fit cursors, and select all traces

>>> decay = list()
>>> for mytrace in stf.get_selected_indices(): # or for mytrace in range(stf.get_size_channel())
>>>    stf.set_trace(mytrace) # set trace
>>>    decay.extend(stf.leassq(4)[’Tau_1’]) # compute decay of a biexp function

I can help you to debug your script, if you send it to me. It’s easy, and a lot of fun!

Best

Jose



JoSe GuZmAn • The Guzman Lab
http://www.guzman-lab.com

Tel.:     +43 678 126 70 96 
Email:  jose....@guzman-lab.com

-- 

--- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/stimfit/419264d2-0cb9-40c3-a830-148650747079n%40googlegroups.com.

Jose Guzman

unread,
Oct 30, 2020, 3:47:43 AM10/30/20
to stimfit
I'd suggest you use an exponential model (type Ctrl+N to see the fitting functions available in Stimfit). If you set properly the fit cursors (F), you can select a monoexponential model (0 in the menu) or type the following in the Python shell:

mydecay = stf.leasq(0)['Tau_0'] # decay time constant for a monoexponential model.

Hope it helps!

Jose

robbiei...@gmail.com

unread,
Nov 21, 2020, 4:03:03 PM11/21/20
to stimfit
That was super helpful! I'm getting the initial bits of code to work, but the results I've been getting have sparked two questions: 

1. I've found the best results with the "biexponential with delay, start fixed to baseline, and delay constrained to > 0 (function #5 in Stimfit)". During batch analysis, if I export "Fit results," I get data for the columns, "Baseline, Delay, tau1, Factor, and tau2." Are any of these the decay time constant, or can I manipulate them to get the decay time constant?

2. If so, what units would I be looking at? 

Thank you so much for the help. I'm trying to get something like the decay time constant shown in Figure 1H of this 2016 paper:

Guzman, S. J., Schlogl, A., Frotscher, M., & Jonas, P. (2016). Synaptic mechanisms of pattern completion in the hippocampal CA3 network. Science, 353(6304), 1117-1123. doi:10.1126/science.aaf1836

Jose Guzman

unread,
Nov 22, 2020, 12:33:15 PM11/22/20
to sti...@googlegroups.com
For our a biexponential with delay, start fixed to baseline (Stimfit #5), the decay time constant you’re looking for is ’Tau2’. The units are the same as the x-units of your recoding (see stf.get_xunits(), generally ‘ms').

You could take a look to the figure 4 of our Stimfit paper (https://www.frontiersin.org/articles/10.3389/fninf.2014.00016/full) to see how the fitting works. 

Nice paper that Guzman et al…. :P

Cheers!

Jose


JoSe GuZmAn • The Guzman Lab
http://www.guzman-lab.com

Tel.:     +43 678 126 70 96 
Email:  jose....@guzman-lab.com
-- 

--- 
You received this message because you are subscribed to a topic in the Google Groups "stimfit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stimfit/Qpvbb-zPjrQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stimfit+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/stimfit/a299fc1a-6391-4348-a2b9-a38f79c8338bn%40googlegroups.com.

ices...@gmail.com

unread,
Feb 3, 2021, 12:22:11 AM2/3/21
to stimfit
Hi Jose,
                   I was trying to recreated the fit in Matlab by using the tau1 and tau1 in a bi-exponential function. I was wondering what the 'Factor' parameter in the fit results corresponds to. Could you shed some light on that Jose? 

Best,
Anand

Jose Guzman

unread,
Feb 3, 2021, 6:37:24 AM2/3/21
to sti...@googlegroups.com
The factor is the weighted time constant (i.e., the sum of the time constants weighted by their respective amplitudes).

--

---
You received this message because you are subscribed to a topic in the Google Groups "stimfit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stimfit/Qpvbb-zPjrQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stimfit+u...@googlegroups.com.

ices...@gmail.com

unread,
Feb 3, 2021, 10:32:26 AM2/3/21
to stimfit
So it is  (t1*A1+t2*A2)/A1+A2. Can you confirm that? Also, how is this factor used in the formula for the double exponential? 

Best,
Anand  

Reply all
Reply to author
Forward
0 new messages