GithubHelp home page GithubHelp logo

rproepp / spykeutils Goto Github PK

View Code? Open in Web Editor NEW
17.0 7.0 8.0 1 MB

spykeutils is a Python library for analyzing and plotting data from neurophysiological recordings.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

spykeutils's People

Contributors

jgosmann avatar rproepp avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

spykeutils's Issues

Pass mode parameter to st_convolve from spike_density_estimation

In some cases it might be useful to specify 'valid' mode when convolving spike trains in order to avoid boundary effects. It would be convenient to have a mode parameter in spike_density_estimation that passes it to st_convolve. Thanks for the consideration!

tau=0 setting in m.u. Van Rossum metric gives NaN for cross-observation terms

Is this intentional? pymuvr always returns 0, which seems to me a more sensible solution as it matches the limit of the definition of the metric for tau->0.

You can test for this with the following script:

import quantities as pq
import spykeutils.spike_train_generation as stg
import spykeutils.spike_train_metrics as stm
import pymuvr

n_observations = 4
n_cells = 20
rate = 30
tstop = 2
cos = 0.02
tau = 0
sutils_units = {}
pymuvr_observations = []

for unit in range(n_cells):
    sutils_units[unit] = []
    for ob in range(n_observations):
        sutils_units[unit].append(stg.gen_homogeneous_poisson(rate * pq.Hz, t_stop=tstop * pq.s))
    # observation 1 is identical to observation 0 for all the cells.
for unit in range(n_cells):
    sutils_units[unit][1] = sutils_units[unit][0]
for ob in range(n_observations):
    pymuvr_observations.append([])
    for unit in range(n_cells):
        pymuvr_observations[ob].append(sutils_units[unit][ob].tolist())

sutils_d = stm.van_rossum_multiunit_dist(sutils_units,
                                         weighting=cos,
                                         tau=tau)
pymuvr_d = pymuvr.square_distance_matrix(pymuvr_observations,
                                         cos,
                                         tau)

print("\nspykeutils result:")
print(sutils_d)

print"\npymuvr result:"
print(pymuvr_d)

On my system, this gives

/home/eugenio/virtualenv/local/lib/python2.7/site-packages/spykeutils/signal_processing.py:291: RuntimeWarning: divide by zero encountered in divide
  (v / self.kernel_size * pq.dimensionless).simplified
/home/eugenio/virtualenv/local/lib/python2.7/site-packages/spykeutils/signal_processing.py:293: RuntimeWarning: invalid value encountered in subtract
  exp_diffs = sp.exp(values[:, :-1] - values[:, 1:])
/home/eugenio/virtualenv/local/lib/python2.7/site-packages/spykeutils/signal_processing.py:313: RuntimeWarning: invalid value encountered in subtract
  sp.exp(values[v][js[slice_j]] - values[u][slice_j]) *

spykeutils result:
[[  0.  nan  nan  nan]
 [ nan   0.  nan  nan]
 [ nan  nan   0.  nan]
 [ nan  nan  nan   0.]]

pymuvr result:
[[ 0.  0.  0.  0.]
 [ 0.  0.  0.  0.]
 [ 0.  0.  0.  0.]
 [ 0.  0.  0.  0.]]

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.