-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kESI electrode potential fixing, fixes with Kuba, equal conductivity vs kCSD #38
Comments
experimenting with replacing solversTrying to calculate good kesi or kcsd solution at sensible regularisation value, calculating leave one out crossvalidation speed. Solving the kernel * x = potential (i think) equations for the x We are changing the solver in this line Line 103 in 17fffaf
kCSD
kCSD linear equation system solving is stable across solvers kESI
results reviewWe can look at the results of leave one out error, per electrode left out. In kCSD it looks like this: In kESI: 255 electrodes, 100 samples of signal inverse and least squares remove some part of the result (which makes it actually better, as it means lower error), and the whole image is quite noisy, unlike kCSD. Signal used in the simulation had no noise. |
kCSD solution using scipy.linalg.solve assume pos vs numpy.linalg.solve on set of 198 electrodes: numpy took 2 minutes, scipy, 30 seconds. Set of 255 electrodes: scipy takes 1 minute 26 seconds, numpy - 2 hours Solutions crossection: Seems like it's exactly the same, and we've got a tremendous speedup. |
Re: #38 (comment) The cross-validation errors seem comparable for kCSD and kESI, going up to 0.075, which is good. The equation you mention is to compute the inverse How to visualize them:
The size of these matrices should be the same for kCSD and kESI. The images would help us understand differences I would do the tests for small matrices first to get the gist without waiting for results. Even 40 channels gives 1600 elements of K..., so perhaps start with 20 electrodes? Just to identify the differences between the matrices. Do you have 1/N factors in the definition of |
Visualising KERNEL from kernel constructor: kCSD kESI, far boundary, regrounded at a point between FCz and Cz it seems like some electrodes are quite big outliers, which could make the solution numerically unstable. And it seems some Ox_L1 electrodes are outside of the 4 sheres. Maybe, when I was scaling their locations down in excel I managed to miscalculate and only scale their X, Z axis, without Y.... Will try again without them. Todo: fix the layered electrodes... |
AnalyticalPotentials at electrodes calculated using FEM with grounding at infinity (100 meters) and the "neck". Only 2 layers of electrodes instead of 3, because the inner one is below the dipole, and is unsampleable (for now) BiasedkCSDkESI with grounding electrodeUnbiasedkCSDkESI with grounding electrode |
After consultation with Jakub, some bugs with quadrature weights selection were fixed, and correct estimation of conductance was estimated. As a results kCSD and kCSD-precalculated have almost exactly the same results: Kernels: CSD: kESI solution has kernels a bit scaled up (makes sense, as "leadfield" is offset compared to theoretical): But CSD solution is on the same scale, but slightly different, more adhereing to the spherical geometry: Overall solution value at the maximum point: |
Need to experiment and figure out what happening with MFEM correctly solved electrode potential (far boundary). Why the results of kESI are uniform...
TO use:
The text was updated successfully, but these errors were encountered: