# fitted function to array

31 views

### Andrew Micallef

Jul 14, 2013, 9:32:52 AM7/14/13
Hi,

I've got a lo of voltage traces with EPSPs. I've got the basics of setting the cursors and fitting a function to my raw data. What I'd like to do is to then convert the fitted function into a numpy array (over a set range) which I can use to subtract from other traces. Is there an easy way to access the output of the least_sq() to do this or is it just a matter of defining a dual exponential and inserting the time constant values. If the latter is the case, what is the equation for least_sq(5)?
I don't know what 'factor' refers to in the output or how it produces an EPSP like shape when both time constants are outputted as positive numbers.

### Andrew Micallef

Jul 14, 2013, 9:37:02 AM7/14/13
Also I am using the latest version of stimfit on windows 7

### Christoph Schmidt-Hieber

Jul 14, 2013, 10:29:54 AM7/14/13
On Sun, Jul 14, 2013 at 06:32:52AM -0700, Andrew Micallef wrote:
> I've got a lo of voltage traces with EPSPs. I've got the basics of
> setting the cursors and fitting a function to my raw data. What I'd
> like to do is to then convert the fitted function into a numpy array
> (over a set range) which I can use to subtract from other traces.

stf.get_fit() returns the evaluated function as a NumPy array. First
dimension is time, second dimension are the function evaluation
results.

> Is there an easy way to access the output of the least_sq() to do
> this or is it just a matter of defining a dual exponential and
> inserting the time constant values. If the latter is the case, what
> is the equation for least_sq(5)?

The equation is shown here:

http://www.stimfit.org/doc/doxygen/html/group__stfgen.html#ga4dd9d335d263c75d61961db8bb1fe1e2

The corresponding source code is here: