rproepp / spykeutils Goto Github PK
View Code? Open in Web Editor NEWspykeutils is a Python library for analyzing and plotting data from neurophysiological recordings.
License: BSD 3-Clause "New" or "Revised" License
spykeutils is a Python library for analyzing and plotting data from neurophysiological recordings.
License: BSD 3-Clause "New" or "Revised" License
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!
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.]]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.