Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created January 20, 2014 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/8518588 to your computer and use it in GitHub Desktop.
Save zeffii/8518588 to your computer and use it in GitHub Desktop.
cf_neural_average_potential_pre_spike_redux2

[ Launch: cf_neural_average_potential_pre_spike_redux ] 8518588 by zeffii
[ Launch: cf_neural_average_potential_pre_spike ] 8518289 by zeffii
[ Launch: cf_neural_sum ] 8510432 by zeffii
[ Launch: coffee_templatefux ] 8493787 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6399870 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6382272 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6382237 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6379220 by zeffii
[ Launch: boomstick_motion_wcolor ] 6376715 by zeffii
[ Launch: boomstick_motion2 ] 6365156 by zeffii
[ Launch: boomstick_motion ] 6364686 by zeffii
[ Launch: boomstick ] 6364584 by zeffii
[ Launch: zeffii default ] 6364028 by zeffii
[ Launch: zeffii default ] 5033869 by zeffii

{"description":"cf_neural_average_potential_pre_spike_redux2","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data2.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"util.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"injet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"utils.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"details.ssv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"details.txt":{"default":true,"vim":false,"emacs":false,"fontSize":12},"details.tsv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"details.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"details2.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/rUN41qB.png"}
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
op1
-2.1290e-001
-3.3083e-001
-2.9084e-001
-2.3076e-001
-2.4637e-001
-1.0963e-001
-3.2233e-002
-5.3667e-002
-1.8999e-002
-1.8992e-002
-8.6980e-002
-1.2392e-001
1.7321e-002
2.3242e-001
2.9631e-001
1.4848e-001
-1.6343e-001
-3.6326e-001
-2.8260e-001
-1.1191e-001
-2.1302e-002
-1.0927e-001
-1.8715e-001
-7.4171e-002
7.5990e-003
2.4167e-002
9.5828e-003
8.5066e-002
2.5436e-001
3.0199e-001
2.1289e-001
1.3428e-001
1.8229e-001
3.7724e-001
4.4580e-001
3.2084e-001
2.3952e-001
2.8931e-001
2.5225e-001
1.6736e-001
9.6830e-002
1.2620e-001
1.8560e-001
1.0894e-001
6.7557e-002
2.4375e-001
4.6676e-001
4.7717e-001
2.9671e-001
2.3532e-001
3.8961e-001
5.9874e-001
6.3610e-001
5.5856e-001
5.3017e-001
5.6925e-001
7.3173e-001
8.2225e-001
7.6161e-001
7.4513e-001
7.5644e-001
7.7179e-001
7.5689e-001
7.9606e-001
8.6495e-001
1.0274e+000
1.0848e+000
1.1408e+000
1.2328e+000
1.1698e+000
1.2604e+000
1.5530e+000
1.6947e+000
1.6083e+000
1.4937e+000
1.6030e+000
1.7408e+000
1.9180e+000
2.1488e+000
2.3003e+000
2.3532e+000
2.4315e+000
2.5691e+000
2.6052e+000
2.5563e+000
2.6035e+000
2.7133e+000
2.8415e+000
2.9971e+000
3.1310e+000
3.2179e+000
3.3400e+000
3.5603e+000
3.8210e+000
4.0406e+000
4.1744e+000
4.2371e+000
4.2363e+000
4.3431e+000
4.5545e+000
4.7193e+000
4.8919e+000
5.1896e+000
5.3937e+000
5.5414e+000
5.7054e+000
5.8584e+000
6.1275e+000
6.5816e+000
7.0366e+000
7.3086e+000
7.4932e+000
7.7023e+000
7.9874e+000
8.4344e+000
9.0279e+000
9.6371e+000
9.9946e+000
1.0357e+001
1.1054e+001
1.1880e+001
1.2684e+001
1.3557e+001
1.4422e+001
1.5374e+001
1.6507e+001
1.7775e+001
1.9046e+001
2.0244e+001
2.1395e+001
2.2640e+001
2.4009e+001
2.5516e+001
2.7038e+001
2.8412e+001
2.9457e+001
2.9473e+001
2.7276e+001
2.2446e+001
1.5986e+001
9.4169e+000
4.4401e+000
1.8049e+000
8.0849e-001
4.7878e-001
2.8708e-001
1.8529e-001
2.4322e-001
1.2873e-001
-6.1341e-002
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
op1
-5.5747e-001
-2.3904e+000
-4.4113e+000
-4.2952e+000
-2.6373e+000
-6.0666e-001
9.9396e-001
7.0715e-001
-1.5942e-001
1.1079e+000
2.1781e+000
1.5881e-003
-2.2245e+000
-1.6022e+000
-1.1210e-001
1.0916e-002
-2.1229e+000
-2.9252e+000
3.8332e-001
3.6650e+000
4.1244e+000
3.9182e+000
3.7972e+000
3.2889e+000
2.0340e+000
-1.0218e+000
-3.4075e+000
-3.4831e+000
-1.8870e+000
-5.2862e-001
-7.8983e-002
1.7604e+000
3.2814e+000
1.4266e+000
-7.9238e-002
-6.3040e-001
-1.5183e+000
-7.6448e-001
1.1649e-001
-8.9800e-001
-1.4739e+000
-2.4851e-001
4.3525e-002
-1.4437e+000
-6.6889e-001
1.6834e+000
1.7127e+000
2.2569e+000
3.9005e+000
4.6328e+000
3.0059e+000
-4.1761e-001
-9.9859e-001
2.0273e+000
4.2161e+000
2.7367e+000
-2.8278e-001
-1.3380e+000
-1.4085e-001
1.9818e+000
3.1458e+000
3.4875e+000
2.6244e+000
6.3636e-001
-6.1258e-001
1.3339e-001
8.2589e-001
6.9660e-001
9.3092e-001
2.1393e+000
3.4891e+000
3.8797e+000
3.2563e+000
2.1512e+000
5.5412e-001
1.2822e-001
5.9235e-001
1.1714e+000
1.8890e+000
2.1369e+000
2.4582e+000
2.8673e+000
4.1766e+000
5.1745e+000
4.0668e+000
2.3001e+000
-6.9874e-002
-6.8978e-001
1.2071e+000
1.9526e+000
7.6897e-001
-1.3049e+000
-1.1357e+000
1.1824e+000
3.8445e+000
5.6841e+000
5.6879e+000
5.7192e+000
6.1560e+000
3.2869e+000
-8.9069e-001
-3.6569e-001
2.8589e+000
4.5900e+000
4.6539e+000
4.3479e+000
6.1019e+000
8.4951e+000
8.3011e+000
7.3345e+000
7.6413e+000
8.8363e+000
9.3832e+000
1.0056e+001
1.1678e+001
1.2856e+001
1.1367e+001
8.1698e+000
6.8975e+000
7.6054e+000
9.2630e+000
1.0814e+001
1.1713e+001
1.3259e+001
1.6171e+001
1.8010e+001
1.9764e+001
2.1508e+001
2.2419e+001
2.3556e+001
2.3620e+001
2.1918e+001
2.1328e+001
2.3914e+001
2.6054e+001
2.9387e+001
3.3195e+001
3.1017e+001
2.3522e+001
1.6267e+001
1.0306e+001
5.7089e+000
2.6084e+000
6.2437e-001
-1.3888e+000
-3.3384e+000
-2.1885e+000
3.9276e-001
1.8468e+000
2.0022e+000
# quick n dirty neural activity: http://en.wikipedia.org/wiki/Spike-triggered_average
svg = d3.select("svg")
svg.append("rect").attr({width:"100%", height:"100%", fill: '#C2C2C2'})
group1 = svg.append('g')
.classed('group1', true)
.attr
transform: 'translate(' + [74, 367] + ')'
data = tributary.details
data2 = tributary.details2
# _".map" is the function and "data_set, (d)" are its arguments
to_numbers = (data_set) ->
_data = _.map data_set,(d) ->
d.op1 = +d.op1
d
# converts data_set to stimuli into path format.
make_path = (data_set) ->
xpos = 0
path = "M"
for val in data_set
x_comp = " " + (xpos += 4)
y_comp = " " + (-val.op1*10)
path += x_comp + y_comp
path
data = to_numbers(data)
data2 = to_numbers(data2)
gop1 = group1.append("g").classed("op1", true)
.style
"stroke-width": 1.4
"fill": "none"
# 1.0 of all spikes , more than 53000 spikes and their preceding 300 ms
# stimuli ( 300 ms is 150 data points at 2ms each, with sample rate 500 hz)
# - this plot shows the average window formed from all windows preceding a spike.
gop1.append("path")
.attr
d: () -> make_path(data)
.style
"stroke": "#232323"
# 0.01 of all spikes, every 100 spikes, but still 150 data points per window
# - this plot happens to look similar to the line gained from averaging over all
# windows, but it might be possible to select a different 1% and
# get a different plot (entirely?).
gop1.append("path")
.attr
d: () -> make_path(data2)
.style
"stroke": "#FFFFFF"
# EOF #
.cm-s-elegant.CodeMirror { background: #1e2426; color: #696969; }
.cm-s-elegant div.CodeMirror-selected {background: #064968 !important;} /* 33322B*/
.cm-s-elegant span.cm-variable { color:#22EFFF; }
.cm-s-elegant span.cm-variable-2 { color: #FFCCB4; }
.cm-s-elegant span.cm-variable-3 { color: white; }
.cm-s-elegant span.cm-string { color: Chartreuse; }
.cm-s-elegant span.cm-string-2 {color: Chartreuse;}
.cm-s-elegant span.cm-def {color: #FFCCB4; opacity: 1.0}
.cm-s-elegant span.cm-bracket { color: #EBEFE7; }
.cm-s-elegant pre { color:#FFF; }
.cm-s-elegant span.cm-qualifier { color:#C0C0C0; }
.cm-s-elegant span.cm-comment { color: #AFB4B4;}
.cm-s-elegant span.cm-property {color: #FDA676;}
.cm-s-elegant span.cm-number { color: #FF92EE;}
.cm-s-elegant span.cm-keyword { color: #FFFF18; }
.cm-s-elegant .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-elegant .CodeMirror-gutters {background: #505050;}
.cm-s-elegant .CodeMirror-linenumber {color: #D3D3D3;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment