GithubHelp home page GithubHelp logo

adaptivekde's People

Contributors

cooperlab avatar lqkhoo avatar shimazaki avatar stekaiser avatar zsylvester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

adaptivekde's Issues

UnboundLocalError _ sskernel

using your function : sskernel :
while anlyzing multiple data sessions I encountered the following problem :

Traceback (most recent call last):

  File "/home/azare/groups/PrimNeu/Aryo/analysis/fit/automate_mix_psth_fit_nmz_10_re_sig_8_unit_14_opt.py", line 458, in <module>
    kv , t , okbw = KDE(l_f_8_soi_ms[i])

  File "/home/azare/groups/PrimNeu/Aryo/analysis/opt/KDE.py", line 133, in KDE
    y = y * len(spike_times)

UnboundLocalError: local variable 'y' referenced before assignment

The problematic input array :
np.array([425.36666667, 230.6 , 35.86666667])

While an array of only 3 elemtns is not realistic to be considered as data, this was running through a loop of hundreds of sessions, hence such input data is also imaginable.
The program stuck in the middle of a loop with the above error.

It seems to me that in this case, your while statement was never satisfied (not 'True') :

while (np.abs(b-a) > tol * (np.abs(c1) + np.abs(c2))) & (k < 20):

Hence the program stepped out of the While loop without defining the inside parameters which were called later => UnboundLocalError.

Code breaks on sskernel line 182

The code needs to cast from a float to an int when making the call to np.ceil(). Right now it wont run unless the code is normalized to integer values.

real and normalized firing rates.

I would like to mention about adding an option to the current sskernel or ssvkernel functions :
It seems to me that your functions normalize the plot so that the area under the curve would be 1.
The similar function in your colleague's (Shinomoto) website returns similar plots but the y axis has a different scale (possibly not normalized).
https://s-shinomoto.com/histograms/python/KDE_rate_v4.py

While normalization has particular advantages, I would also like to get an estimated real (absolute) firing rate.
The reason is that I would like to compare the firing rate of different sessions.
How can this be achieved ?

type-casting _ float__integer

First, many thanks for providing this package.

I would like to mention a small bug in this program :
The following line outputs a float :

N_MAX = min(np.floor((x_max - x_min) / (2*dx)), max(N))

The line thereafter ('range' function) accepts an integer :

N = range(N_MIN, N_MAX+1)

This can simply be fixed by type-casting when defining 'N_MAX' :
N_MAX = int ( min(np.floor((x_max - x_min) / (2*dx)), max(N)) )

numpy deprecation warnings _ np.float , np.int should be converted to native python 'float' , 'int'.

I would like to mention a small but important improvement to the program.

np.int & np.float are aliases of the python operator 'int' , 'float' respectively. They are deprecated in newer versions of numpy.
Usage of them does not make any error but since they are extensively used in your program, there are over 10 warnings per analysis session, which if used in a loop of many sessions, may cause crashing of the IDE and may decrease the speed of the program.

Just using 'int' or 'float' instead is safe & is preferred.
Below I put the program warnings :


N = sum(y_hist).astype(np.float)
/home/azare/anaconda3/envs/env_2/lib/python3.10/site-packages/adaptivekde/ssvkernel.py:99: DeprecationWarning: np.float is a deprecated alias for the builtin float. To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations


f = np.linspace(0, n-1, n.astype(np.int)) / n
/home/azare/anaconda3/envs/env_2/lib/python3.10/site-packages/adaptivekde/ssvkernel.py:268: DeprecationWarning: np.int is a deprecated alias for the builtin int. To silence this warning, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Please provide a couple of example usages

Dear developers of AdaptiveKDE method,

I am trying to use this package for estimating the temporal firing rate profile from spike trains of several trials. I had a look a the function "ssvkernel" and I am having trouble understanding the input parameters of this function. The argument "x" says it requires "The one-dimensional samples drawn from the underlying density". I am not able to figure out how to transform information in the trial spike trains of my data before supplying it to "x". Could you provide an example use case, preferably, the code used to generate Fig. 4(b) or (c) of the reference?

Thank you.

Sincerely
Ajay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.