I have two spike phase plots, that I have fitted visually and placed in the same grapher box.
I read this phase plot fit topic, but I am not sure a polar plot is the solution.
viewtopic.php?f=23&t=1190
Each phase plot is composed of a bunch of points, which make a series of concentric circular loops of interpolated lines.
Now the question arises how to quantify the fit between the loops.
One could make one phase plot a series of points, and then fit to the nearest distance from an interpolated line loop generated by the other averaged phase plot points.
Or would this be better as a MATLAB type of problem?
Fitting a phase plot.

 Site Admin
 Posts: 5769
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Fitting a phase plot.
The only magic about fitting phase plots is how one defines the error metric. The difficulty is compounded when both the "control" (or "reference") and the "test" plot are defined by samples at discrete times.
Consider a squid axon model. The model starts at rest, but at some time it is stimulated by a suprathreshold current. Its membrane potential is sampled at regular intervals dt starting at t=0, and dv/dt is calculated after each run. Generate data sets A and B by applying the stimulus at times ta and tb, where ta and tb are different. How do you compare the results? "Easy, align B with A and resample B." But resampling B requires interpolation, and interpolation will introduce errors into v and dv/dt that can be quite large; what are you going to do about them?
Unless there is an overriding reason to approach the problem as one of "fitting phase plots," it seems easier to just treat it as one of minimizing sum of squared errors for two different variables that are functions of time. If one of the variables happens to be the derivative of the other, e.g. v and dv/dt, this reduces to minimizing the difference between the test v(t) and the reference v(t).
A few more comments:
If there are portions of the phase plot that have particularly important features, the corresponding time intervals can be weighted more heavily to emphasize these features. This is easy to do in the MultipleRunFitter.
It is important that data sets A and B be generated by sampling at regular intervals. Otherwise regions where the sampling interval is short will be overemphasized, and regions where the interval is long will be underemphasized in the fit. It's OK for you to make the explicit decision that some range of times is more or less important than others, but this should be your decision, not something that is an accident of how the data were sampled (or generated, if they're from a simulation that used adaptive integration (cvode)).
If you want, or need, to run simulations with cvode, you can use the Vector record method's optional second argument to specify a regular sampling intervale.g. vdest.record(&var, Dt) will capture the time course of var to vdest at an interval specified by the value of Dt, see
https://www.neuron.yale.edu/neuron/stat ... tor.record
Consider a squid axon model. The model starts at rest, but at some time it is stimulated by a suprathreshold current. Its membrane potential is sampled at regular intervals dt starting at t=0, and dv/dt is calculated after each run. Generate data sets A and B by applying the stimulus at times ta and tb, where ta and tb are different. How do you compare the results? "Easy, align B with A and resample B." But resampling B requires interpolation, and interpolation will introduce errors into v and dv/dt that can be quite large; what are you going to do about them?
Unless there is an overriding reason to approach the problem as one of "fitting phase plots," it seems easier to just treat it as one of minimizing sum of squared errors for two different variables that are functions of time. If one of the variables happens to be the derivative of the other, e.g. v and dv/dt, this reduces to minimizing the difference between the test v(t) and the reference v(t).
A few more comments:
If there are portions of the phase plot that have particularly important features, the corresponding time intervals can be weighted more heavily to emphasize these features. This is easy to do in the MultipleRunFitter.
It is important that data sets A and B be generated by sampling at regular intervals. Otherwise regions where the sampling interval is short will be overemphasized, and regions where the interval is long will be underemphasized in the fit. It's OK for you to make the explicit decision that some range of times is more or less important than others, but this should be your decision, not something that is an accident of how the data were sampled (or generated, if they're from a simulation that used adaptive integration (cvode)).
If you want, or need, to run simulations with cvode, you can use the Vector record method's optional second argument to specify a regular sampling intervale.g. vdest.record(&var, Dt) will capture the time course of var to vdest at an interval specified by the value of Dt, see
https://www.neuron.yale.edu/neuron/stat ... tor.record