Problem with BinCounts

*To*: mathgroup at smc.vnet.net*Subject*: [mg90901] Problem with BinCounts*From*: Mark Teagarden <Mark.Teagarden at utsa.edu>*Date*: Tue, 29 Jul 2008 01:37:15 -0400 (EDT)

Hi, I'm trying to do an autocorrelation analysis on an artificially generated neuronal spike train, but BinCounts is behaving strangely. I first generate a list of spike times for an oscillator with a mean frequency of 1 Hz, plus some gaussian jitter: st = NestList[(1 + RandomReal[NormalDistribution[0, 0.1]] + # &), 0,1000]; Then I do the autocorrelation like this: BinCounts[st, {# - 2.00, # + 2.00, 0.01}] & /@ st; ac = Last[Accumulate[%]]/Length[%]; The output of BinCounts ought to be a list of length st, with each list element having a fixed length of 400. And yet I get error messages like so: Thread::tdlen: Objects of unequal length in \ {13,11,15,9,12,13,14,13,9,6,<<390>>}+{0,1,0,0,0,0,0,0,0,0,<<389>>} \ cannot be combined. >> And sure enough, if I run Dimensions/@ the output of the BinCounts line, I get one or two elements with a length of 399. This happens completely at random, and I don't understand why. It seems to me that BinCounts ought to give me a fixed output length, regardless of what the results of the operation actually were. These shorter elements do not occur near the beginning or end, either, so it's not an edge effect. Furthermore, the values of st corresponding to the shorter elements of ac don't have any unusual properties like being whole numbers or anything. I will add that sometimes the code works correctly, and it's not obvious why. Has anyone else encountered such behavior before? What did you do about it? Using M6.0.2.1 (64 bit) on a MacPro 3.06 GhZ Core Two Duo w/ 4 GB RAM. Thanks, Mark -- Mark A. Teagarden, Ph.D. Institute for Neurosciences University of Texas - San Antonio San Antonio, TX 78249 Office: BSE 2.306 Phone: 210.458.4746