update statistics

This commit is contained in:
Mikkel Elle Lepperød 2019-10-14 09:39:41 +02:00
parent 7f044e9b5b
commit 2c4e19a3aa
3 changed files with 1396 additions and 1350 deletions

View File

@ -13173,7 +13173,7 @@ div#notebook {
<div class="output_subarea output_stream output_stderr output_text"> <div class="output_subarea output_stream output_stderr output_text">
<pre>14:03:52 [I] klustakwik KlustaKwik2 version 0.2.6 <pre>14:18:41 [I] klustakwik KlustaKwik2 version 0.2.6
</pre> </pre>
</div> </div>
</div> </div>
@ -13335,7 +13335,7 @@ div#notebook {
<div class="output_text output_subarea output_execute_result"> <div class="output_text output_subarea output_execute_result">
<pre>&lt;matplotlib.axes._subplots.AxesSubplot at 0x7f1dd5d9ea90&gt;</pre> <pre>&lt;matplotlib.axes._subplots.AxesSubplot at 0x7fd37b11ed30&gt;</pre>
</div> </div>
</div> </div>
@ -13361,7 +13361,7 @@ div#notebook {
</div> </div>
<div class="cell border-box-sizing code_cell rendered"> <div class="cell border-box-sizing code_cell rendered">
<div class="input"> <div class="input">
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div> <div class="prompt input_prompt">In&nbsp;[7]:</div>
<div class="inner_cell"> <div class="inner_cell">
<div class="input_area"> <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">data_loader</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="n">Data</span><span class="p">(</span> <div class=" highlight hl-ipython3"><pre><span></span><span class="n">data_loader</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="n">Data</span><span class="p">(</span>
@ -13378,7 +13378,7 @@ div#notebook {
</div> </div>
<div class="cell border-box-sizing code_cell rendered"> <div class="cell border-box-sizing code_cell rendered">
<div class="input"> <div class="input">
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div> <div class="prompt input_prompt">In&nbsp;[8]:</div>
<div class="inner_cell"> <div class="inner_cell">
<div class="input_area"> <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">first_row</span> <span class="o">=</span> <span class="n">units</span><span class="p">[</span><span class="n">units</span><span class="p">[</span><span class="s1">&#39;action&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;1849-060319-3&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <div class=" highlight hl-ipython3"><pre><span></span><span class="n">first_row</span> <span class="o">=</span> <span class="n">units</span><span class="p">[</span><span class="n">units</span><span class="p">[</span><span class="s1">&#39;action&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;1849-060319-3&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
@ -13473,6 +13473,8 @@ div#notebook {
<span class="n">information_rate</span> <span class="o">=</span> <span class="n">stats</span><span class="o">.</span><span class="n">information_rate</span><span class="p">(</span><span class="n">smooth_high_rate_map</span><span class="p">,</span> <span class="n">prob_dist</span><span class="p">)</span> <span class="n">information_rate</span> <span class="o">=</span> <span class="n">stats</span><span class="o">.</span><span class="n">information_rate</span><span class="p">(</span><span class="n">smooth_high_rate_map</span><span class="p">,</span> <span class="n">prob_dist</span><span class="p">)</span>
<span class="n">information_spec</span> <span class="o">=</span> <span class="n">stats</span><span class="o">.</span><span class="n">information_specificity</span><span class="p">(</span><span class="n">smooth_high_rate_map</span><span class="p">,</span> <span class="n">prob_dist</span><span class="p">)</span>
<span class="n">single_spikes</span><span class="p">,</span> <span class="n">bursts</span><span class="p">,</span> <span class="n">bursty_spikes</span> <span class="o">=</span> <span class="n">spikes</span><span class="o">.</span><span class="n">find_bursts</span><span class="p">(</span><span class="n">spike_times</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">0.01</span><span class="p">)</span> <span class="n">single_spikes</span><span class="p">,</span> <span class="n">bursts</span><span class="p">,</span> <span class="n">bursty_spikes</span> <span class="o">=</span> <span class="n">spikes</span><span class="o">.</span><span class="n">find_bursts</span><span class="p">(</span><span class="n">spike_times</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">0.01</span><span class="p">)</span>
<span class="n">burst_event_ratio</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursts</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">single_spikes</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursts</span><span class="p">))</span> <span class="n">burst_event_ratio</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursts</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">single_spikes</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursts</span><span class="p">))</span>
<span class="n">bursty_spike_ratio</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursty_spikes</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursty_spikes</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">single_spikes</span><span class="p">))</span> <span class="n">bursty_spike_ratio</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursty_spikes</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">bursty_spikes</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">single_spikes</span><span class="p">))</span>
@ -13500,6 +13502,7 @@ div#notebook {
<span class="s1">&#39;gridness&#39;</span><span class="p">:</span> <span class="n">gridness</span><span class="p">,</span> <span class="s1">&#39;gridness&#39;</span><span class="p">:</span> <span class="n">gridness</span><span class="p">,</span>
<span class="s1">&#39;border_score&#39;</span><span class="p">:</span> <span class="n">border_score</span><span class="p">,</span> <span class="s1">&#39;border_score&#39;</span><span class="p">:</span> <span class="n">border_score</span><span class="p">,</span>
<span class="s1">&#39;information_rate&#39;</span><span class="p">:</span> <span class="n">information_rate</span><span class="p">,</span> <span class="s1">&#39;information_rate&#39;</span><span class="p">:</span> <span class="n">information_rate</span><span class="p">,</span>
<span class="s1">&#39;information_specificity&#39;</span><span class="p">:</span> <span class="n">information_spec</span><span class="p">,</span>
<span class="s1">&#39;head_mean_ang&#39;</span><span class="p">:</span> <span class="n">head_mean_ang</span><span class="p">,</span> <span class="s1">&#39;head_mean_ang&#39;</span><span class="p">:</span> <span class="n">head_mean_ang</span><span class="p">,</span>
<span class="s1">&#39;head_mean_vec_len&#39;</span><span class="p">:</span> <span class="n">head_mean_vec_len</span><span class="p">,</span> <span class="s1">&#39;head_mean_vec_len&#39;</span><span class="p">:</span> <span class="n">head_mean_vec_len</span><span class="p">,</span>
<span class="s1">&#39;spacing&#39;</span><span class="p">:</span> <span class="n">spacing</span><span class="p">,</span> <span class="s1">&#39;spacing&#39;</span><span class="p">:</span> <span class="n">spacing</span><span class="p">,</span>
@ -13552,6 +13555,7 @@ bursty_spike_ratio 0.676486
gridness -0.459487 gridness -0.459487
border_score 0.078474 border_score 0.078474
information_rate 0.965845 information_rate 0.965845
information_specificity 0.309723
head_mean_ang 5.788704 head_mean_ang 5.788704
head_mean_vec_len 0.043321 head_mean_vec_len 0.043321
spacing 0.624971 spacing 0.624971
@ -13593,13 +13597,13 @@ dtype: float64</pre>
<div id="2b4825d6-9766-4260-96f8-a8462ab148ed"></div> <div id="c75fbc7b-721e-4d42-9315-b47198e54bff"></div>
<div class="output_subarea output_widget_view "> <div class="output_subarea output_widget_view ">
<script type="text/javascript"> <script type="text/javascript">
var element = $('#2b4825d6-9766-4260-96f8-a8462ab148ed'); var element = $('#c75fbc7b-721e-4d42-9315-b47198e54bff');
</script> </script>
<script type="application/vnd.jupyter.widget-view+json"> <script type="application/vnd.jupyter.widget-view+json">
{"model_id": "efa60f02cd1b4f1a946f01a7f61c1640", "version_major": 2, "version_minor": 0} {"model_id": "df0e286d762c4ef3b5a6a00a3b82eee6", "version_major": 2, "version_minor": 0}
</script> </script>
</div> </div>
@ -13629,7 +13633,6 @@ var element = $('#2b4825d6-9766-4260-96f8-a8462ab148ed');
ret = ret.dtype.type(ret / rcount) ret = ret.dtype.type(ret / rcount)
/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/quantities/quantity.py:624: RuntimeWarning: Mean of empty slice. /home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/quantities/quantity.py:624: RuntimeWarning: Mean of empty slice.
ret = self.magnitude.mean(axis, dtype, None if out is None else out.magnitude) ret = self.magnitude.mean(axis, dtype, None if out is None else out.magnitude)
/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/ipykernel_launcher.py:82: RuntimeWarning: invalid value encountered in long_scalars
</pre> </pre>
</div> </div>
</div> </div>
@ -13711,6 +13714,28 @@ var element = $('#2b4825d6-9766-4260-96f8-a8462ab148ed');
</div> </div>
</div> </div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">statistics_action</span><span class="o">.</span><span class="n">modules</span><span class="p">[</span><span class="s1">&#39;parameters&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;max_speed&#39;</span><span class="p">:</span> <span class="n">max_speed</span><span class="p">,</span>
<span class="s1">&#39;min_speed&#39;</span><span class="p">:</span> <span class="n">min_speed</span><span class="p">,</span>
<span class="s1">&#39;position_sampling_rate&#39;</span><span class="p">:</span> <span class="n">position_sampling_rate</span><span class="p">,</span>
<span class="s1">&#39;position_low_pass_frequency&#39;</span><span class="p">:</span> <span class="n">position_low_pass_frequency</span><span class="p">,</span>
<span class="s1">&#39;box_size&#39;</span><span class="p">:</span> <span class="n">box_size</span><span class="p">,</span>
<span class="s1">&#39;bin_size&#39;</span><span class="p">:</span> <span class="n">bin_size</span><span class="p">,</span>
<span class="s1">&#39;smoothing_low&#39;</span><span class="p">:</span> <span class="n">smoothing_low</span><span class="p">,</span>
<span class="s1">&#39;smoothing_high&#39;</span><span class="p">:</span> <span class="n">smoothing_high</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
</div> </div>
<div class="cell border-box-sizing code_cell rendered"> <div class="cell border-box-sizing code_cell rendered">
<div class="input"> <div class="input">

View File

@ -19,7 +19,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"14:03:52 [I] klustakwik KlustaKwik2 version 0.2.6\n" "14:18:41 [I] klustakwik KlustaKwik2 version 0.2.6\n"
] ]
} }
], ],
@ -175,7 +175,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f1dd5d9ea90>" "<matplotlib.axes._subplots.AxesSubplot at 0x7fd37b11ed30>"
] ]
}, },
"execution_count": 6, "execution_count": 6,
@ -202,7 +202,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -215,7 +215,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -255,6 +255,7 @@
"gridness -0.459487\n", "gridness -0.459487\n",
"border_score 0.078474\n", "border_score 0.078474\n",
"information_rate 0.965845\n", "information_rate 0.965845\n",
"information_specificity 0.309723\n",
"head_mean_ang 5.788704\n", "head_mean_ang 5.788704\n",
"head_mean_vec_len 0.043321\n", "head_mean_vec_len 0.043321\n",
"spacing 0.624971\n", "spacing 0.624971\n",
@ -346,6 +347,8 @@
"\n", "\n",
" information_rate = stats.information_rate(smooth_high_rate_map, prob_dist)\n", " information_rate = stats.information_rate(smooth_high_rate_map, prob_dist)\n",
" \n", " \n",
" information_spec = stats.information_specificity(smooth_high_rate_map, prob_dist)\n",
"\n",
" single_spikes, bursts, bursty_spikes = spikes.find_bursts(spike_times, threshold=0.01)\n", " single_spikes, bursts, bursty_spikes = spikes.find_bursts(spike_times, threshold=0.01)\n",
" burst_event_ratio = np.sum(bursts) / (np.sum(single_spikes) + np.sum(bursts))\n", " burst_event_ratio = np.sum(bursts) / (np.sum(single_spikes) + np.sum(bursts))\n",
" bursty_spike_ratio = np.sum(bursty_spikes) / (np.sum(bursty_spikes) + np.sum(single_spikes))\n", " bursty_spike_ratio = np.sum(bursty_spikes) / (np.sum(bursty_spikes) + np.sum(single_spikes))\n",
@ -373,6 +376,7 @@
" 'gridness': gridness,\n", " 'gridness': gridness,\n",
" 'border_score': border_score,\n", " 'border_score': border_score,\n",
" 'information_rate': information_rate,\n", " 'information_rate': information_rate,\n",
" 'information_specificity': information_spec,\n",
" 'head_mean_ang': head_mean_ang,\n", " 'head_mean_ang': head_mean_ang,\n",
" 'head_mean_vec_len': head_mean_vec_len,\n", " 'head_mean_vec_len': head_mean_vec_len,\n",
" 'spacing': spacing,\n", " 'spacing': spacing,\n",
@ -393,7 +397,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "efa60f02cd1b4f1a946f01a7f61c1640", "model_id": "df0e286d762c4ef3b5a6a00a3b82eee6",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
@ -425,8 +429,7 @@
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/core/_methods.py:132: RuntimeWarning: invalid value encountered in double_scalars\n", "/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/numpy/core/_methods.py:132: RuntimeWarning: invalid value encountered in double_scalars\n",
" ret = ret.dtype.type(ret / rcount)\n", " ret = ret.dtype.type(ret / rcount)\n",
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/quantities/quantity.py:624: RuntimeWarning: Mean of empty slice.\n", "/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/quantities/quantity.py:624: RuntimeWarning: Mean of empty slice.\n",
" ret = self.magnitude.mean(axis, dtype, None if out is None else out.magnitude)\n", " ret = self.magnitude.mean(axis, dtype, None if out is None else out.magnitude)\n"
"/home/mikkel/.virtualenvs/expipe/lib/python3.6/site-packages/ipykernel_launcher.py:82: RuntimeWarning: invalid value encountered in long_scalars\n"
] ]
} }
], ],
@ -490,6 +493,24 @@
"copy_tree(output_path, str(statistics_action.data_path()))" "copy_tree(output_path, str(statistics_action.data_path()))"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"statistics_action.modules['parameters'] = {\n",
" 'max_speed': max_speed,\n",
" 'min_speed': min_speed,\n",
" 'position_sampling_rate': position_sampling_rate,\n",
" 'position_low_pass_frequency': position_low_pass_frequency,\n",
" 'box_size': box_size,\n",
" 'bin_size': bin_size,\n",
" 'smoothing_low': smoothing_low,\n",
" 'smoothing_high': smoothing_high\n",
"}"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,

File diff suppressed because it is too large Load Diff