Neuroinflab / kCSD-python

Kernel Current Source Density
https://kcsd-python.readthedocs.io/en/latest/
Other
15 stars 23 forks source link

Pickles for forward model #64

Open ccluri opened 5 years ago

ccluri commented 5 years ago

See branch https://github.com/Neuroinflab/kCSD-python/blob/7dc8bfea7fde168d55f2d3a9d0063b8aa31de102/kcsd/utility_functions.py#L66

This branch contains forward models pre-computed and saved as pickles on the fly in the home folder, for future use. This would work in python3, and not in python2, where I save the interpolated function as a pickle and resurrect it on each subsequent call. This would fail at when changing parameters of MoI kcsd method, as it has not been implemented in include the exception of sigma_tissue, sigma_saline and number of moi iterations.

If this enhancement is warranted is an open question. I notice an improvement of 6-8 seconds in 30 second simulation runs when using crossvalidation. Perhaps with L-curve we can do better. Systematic quantification of this improvement is necessary before merger of this enhancement (if it is).

A possible fix for python2 is to store the numpy arrays instead and then perform the interpolation on the fly. I noticed that this is not as efficient. So perhaps, skip this optimization for python2.