All points histogram sweep formula operation
Opened this issue · 1 comments
PSXPrep() creates an all-point histogram fit with a Gaussian. Create a similar operation that works independently of PSX and is more feature-rich.
AllPoints(data(), gaussian(), dblExp_peak(),diff(), GroupBy())
Gaussian() - Fit data with gaussian.
Lorenzian() - Fit the data with a lor.
diff = 0, plot histogram with both user-specified fit. (e.g., PSX prep()). No harm in plotting the SD at a particular value on the plot, like PSXprep does. e.g., diff(0, [SD]). default to SD = 3
diff = 1, plot histogram - Gaussian() (i.e., subtract the Gaussian fit from the all points histogram. Fit with dblExp_peak.
diff=3, plot a user-specified fit parameter from the dblExpPpeak() vs the peak voltage of the Gaussian fit
For Diff = 2, give the user the ability to constrain the voltage range over which the fit is made (e.g., diff(2, SD, [-55,-50]).
GroupBY([voltage/current Range]) default is group data by sweep. In the group by voltage/current mode, the data within a group is in the same voltage range (-50 +- 1 mV). For example, group all epochs where the mean voltage of the epoch is within +/- 1 mV. e.g., GroupBy(1). I think K-means clustering could work here.
We'll want to be able to fit the XY pairs generated by multiple sweeps/groups.
The goal is to capture how the fit parameters change as function of sweep or mean voltage(or current).
sample plot showing dblExp_peak() fit to the subtracted traces
When using store(), the store operation will store all the fit results for both fits and the all points histogram
Consider how to merge the data from different ranges - aligning them at the mean/median probably makes sense.
We want to be careful about mixing data/ranges with different mean/median voltages
Also want to check for drift in a trace - mean/median voltage should re relatively constant on a TBD timescale
Tentative order of operations:
- check for drift in individual ranges. Only use ranges where drift is as specified by driftCheck(mean drift < 0.5 mV, movingavg method user-defined time window)
- align all ranges by the mean/median align(mean)
- all-points histogram across all ranges. Align peak at zero? How is bin size determined?
- fit all points with gaussian, lorentzian, or gauss + double eponential. rank the fit quality?
- return fit parameters