stim lfp response
|
@ -1,5 +1,5 @@
|
||||||
registered: '2019-10-14T17:03:05'
|
registered: '2019-10-14T17:03:05'
|
||||||
data:
|
data:
|
||||||
results: results.csv
|
results: results.csv
|
||||||
notebook: 10-calculate-stimulus-lfp-response.ipynb
|
notebook: 20_stimulus-lfp-response.ipynb
|
||||||
html: 10-calculate-stimulus-lfp-response.html
|
html: 20_stimulus-lfp-response.html
|
||||||
|
|
|
@ -13171,7 +13171,7 @@ div#notebook {
|
||||||
|
|
||||||
|
|
||||||
<div class="output_subarea output_stream output_stderr output_text">
|
<div class="output_subarea output_stream output_stderr output_text">
|
||||||
<pre>15:15:05 [I] klustakwik KlustaKwik2 version 0.2.6
|
<pre>10:26:07 [I] klustakwik KlustaKwik2 version 0.2.6
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13201,7 +13201,7 @@ div#notebook {
|
||||||
<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">output</span> <span class="o">=</span> <span class="n">pathlib</span><span class="o">.</span><span class="n">Path</span><span class="p">(</span><span class="s1">'output/stimulus-lfp-response'</span><span class="p">)</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">output</span> <span class="o">=</span> <span class="n">pathlib</span><span class="o">.</span><span class="n">Path</span><span class="p">(</span><span class="s1">'output/stimulus-lfp-response'</span><span class="p">)</span>
|
||||||
<span class="p">(</span><span class="n">output</span> <span class="o">/</span> <span class="s1">'figures'</span><span class="p">)</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">parents</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
<span class="p">(</span><span class="n">output</span> <span class="o">/</span> <span class="s1">'data'</span><span class="p">)</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">parents</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -13255,7 +13255,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 [ ]:</div>
|
<div class="prompt input_prompt">In [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="k">def</span> <span class="nf">get_lim</span><span class="p">(</span><span class="n">action_id</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">get_lim</span><span class="p">(</span><span class="n">action_id</span><span class="p">):</span>
|
||||||
|
@ -13286,7 +13286,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 [ ]:</div>
|
<div class="prompt input_prompt">In [9]:</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="k">def</span> <span class="nf">signaltonoise</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">signaltonoise</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">ddof</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
|
||||||
|
@ -13313,7 +13313,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 [ ]:</div>
|
<div class="prompt input_prompt">In [10]:</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="k">def</span> <span class="nf">compute_energy</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">f1</span><span class="p">,</span> <span class="n">f2</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">compute_energy</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">f1</span><span class="p">,</span> <span class="n">f2</span><span class="p">):</span>
|
||||||
|
@ -13331,7 +13331,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 [ ]:</div>
|
<div class="prompt input_prompt">In [11]:</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="k">def</span> <span class="nf">find_theta_peak</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">find_theta_peak</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">):</span>
|
||||||
|
@ -13350,7 +13350,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 [ ]:</div>
|
<div class="prompt input_prompt">In [12]:</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="k">def</span> <span class="nf">compute_half_width</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">m_p</span><span class="p">,</span> <span class="n">m_f</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">compute_half_width</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">m_p</span><span class="p">,</span> <span class="n">m_f</span><span class="p">):</span>
|
||||||
|
@ -13389,7 +13389,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 [ ]:</div>
|
<div class="prompt input_prompt">In [13]:</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="k">def</span> <span class="nf">compute_stim_peak</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">s_f</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">compute_stim_peak</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">s_f</span><span class="p">):</span>
|
||||||
|
@ -13405,7 +13405,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 [ ]:</div>
|
<div class="prompt input_prompt">In [14]:</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">NFFT</span> <span class="o">=</span> <span class="mi">10000</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">NFFT</span> <span class="o">=</span> <span class="mi">10000</span>
|
||||||
|
@ -13419,7 +13419,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 [ ]:</div>
|
<div class="prompt input_prompt">In [15]:</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="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">row</span><span class="p">):</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">row</span><span class="p">):</span>
|
||||||
|
@ -13486,7 +13486,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 [ ]:</div>
|
<div class="prompt input_prompt">In [16]:</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">results</span> <span class="o">=</span> <span class="n">channel_groups</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span>
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">results</span> <span class="o">=</span> <span class="n">channel_groups</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span>
|
||||||
|
@ -13512,18 +13512,138 @@ div#notebook {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="fcbe1331-76c0-47d8-a4f1-70988217251b"></div>
|
<div id="ccdb069e-4b63-4db1-9535-31624e57bc0e"></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 = $('#fcbe1331-76c0-47d8-a4f1-70988217251b');
|
var element = $('#ccdb069e-4b63-4db1-9535-31624e57bc0e');
|
||||||
</script>
|
</script>
|
||||||
<script type="application/vnd.jupyter.widget-view+json">
|
<script type="application/vnd.jupyter.widget-view+json">
|
||||||
{"model_id": "81d917d31c0e43cf80ec3398d46b2c01", "version_major": 2, "version_minor": 0}
|
{"model_id": "e733903bb8d7406ea6c05bf5af093bfc", "version_major": 2, "version_minor": 0}
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="output_area">
|
||||||
|
|
||||||
|
<div class="prompt"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="output_subarea output_stream output_stdout output_text">
|
||||||
|
<pre>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="cell border-box-sizing code_cell rendered">
|
||||||
|
<div class="input">
|
||||||
|
<div class="prompt input_prompt">In [17]:</div>
|
||||||
|
<div class="inner_cell">
|
||||||
|
<div class="input_area">
|
||||||
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">psd</span><span class="p">,</span> <span class="n">freqs</span> <span class="o">=</span> <span class="p">{},</span> <span class="p">{}</span>
|
||||||
|
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">tqdm</span><span class="p">(</span><span class="n">channel_groups</span><span class="o">.</span><span class="n">iterrows</span><span class="p">(),</span> <span class="n">total</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">channel_groups</span><span class="p">)):</span>
|
||||||
|
<span class="n">action_id</span> <span class="o">=</span> <span class="n">row</span><span class="p">[</span><span class="s1">'action'</span><span class="p">]</span>
|
||||||
|
<span class="n">channel_group</span> <span class="o">=</span> <span class="n">row</span><span class="p">[</span><span class="s1">'channel_group'</span><span class="p">]</span>
|
||||||
|
<span class="n">action_group</span> <span class="o">=</span> <span class="n">f</span><span class="s1">'</span><span class="si">{action_id}</span><span class="s1">_</span><span class="si">{channel_group}</span><span class="s1">'</span>
|
||||||
|
<span class="n">lfp</span> <span class="o">=</span> <span class="n">data_loader</span><span class="o">.</span><span class="n">lfp</span><span class="p">(</span><span class="n">action_id</span><span class="p">,</span> <span class="n">channel_group</span><span class="p">)</span>
|
||||||
|
<span class="n">clean_lfp</span> <span class="o">=</span> <span class="n">select_and_clean</span><span class="p">(</span><span class="n">lfp</span><span class="p">)</span>
|
||||||
|
<span class="n">snls</span> <span class="o">=</span> <span class="n">signaltonoise</span><span class="p">(</span><span class="n">clean_lfp</span><span class="p">)</span>
|
||||||
|
<span class="n">best_channel</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">snls</span><span class="p">)</span>
|
||||||
|
<span class="n">snl</span> <span class="o">=</span> <span class="n">snls</span><span class="p">[</span><span class="n">best_channel</span><span class="p">]</span>
|
||||||
|
|
||||||
|
<span class="n">lim</span> <span class="o">=</span> <span class="n">get_lim</span><span class="p">(</span><span class="n">action_id</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="n">mask</span> <span class="o">=</span> <span class="n">get_mask</span><span class="p">(</span><span class="n">lfp</span><span class="p">,</span> <span class="n">lim</span><span class="p">)</span>
|
||||||
|
<span class="n">signal</span> <span class="o">=</span> <span class="n">zscore</span><span class="p">(</span><span class="n">clean_lfp</span><span class="p">[</span><span class="n">mask</span><span class="p">,</span> <span class="n">best_channel</span><span class="p">]</span><span class="o">.</span><span class="n">ravel</span><span class="p">())</span>
|
||||||
|
|
||||||
|
<span class="n">p_xx</span><span class="p">,</span> <span class="n">freq</span> <span class="o">=</span> <span class="n">mlab</span><span class="o">.</span><span class="n">psd</span><span class="p">(</span><span class="n">signal</span><span class="p">,</span> <span class="n">Fs</span><span class="o">=</span><span class="n">lfp</span><span class="o">.</span><span class="n">sampling_rate</span><span class="o">.</span><span class="n">magnitude</span><span class="p">,</span> <span class="n">NFFT</span><span class="o">=</span><span class="n">NFFT</span><span class="p">)</span>
|
||||||
|
<span class="n">psd</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">action_group</span><span class="p">:</span> <span class="n">p_xx</span><span class="p">})</span>
|
||||||
|
<span class="n">freqs</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">action_group</span><span class="p">:</span> <span class="n">freq</span><span class="p">})</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="output_wrapper">
|
||||||
|
<div class="output">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="output_area">
|
||||||
|
|
||||||
|
<div class="prompt"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="6a05ea1e-3782-40af-8458-e7713b9c2fb7"></div>
|
||||||
|
<div class="output_subarea output_widget_view ">
|
||||||
|
<script type="text/javascript">
|
||||||
|
var element = $('#6a05ea1e-3782-40af-8458-e7713b9c2fb7');
|
||||||
|
</script>
|
||||||
|
<script type="application/vnd.jupyter.widget-view+json">
|
||||||
|
{"model_id": "0184251a265a40a2a1e9910405f05db8", "version_major": 2, "version_minor": 0}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="output_area">
|
||||||
|
|
||||||
|
<div class="prompt"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="output_subarea output_stream output_stdout output_text">
|
||||||
|
<pre>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="cell border-box-sizing code_cell rendered">
|
||||||
|
<div class="input">
|
||||||
|
<div class="prompt input_prompt">In [18]:</div>
|
||||||
|
<div class="inner_cell">
|
||||||
|
<div class="input_area">
|
||||||
|
<div class=" highlight hl-ipython3"><pre><span></span><span class="p">(</span><span class="n">psd</span><span class="p">)</span><span class="o">.</span><span class="n">to_feather</span><span class="p">(</span><span class="n">output</span> <span class="o">/</span> <span class="s1">'data'</span> <span class="o">/</span> <span class="s1">'psd.feather'</span><span class="p">)</span>
|
||||||
|
<span class="n">freqs</span><span class="o">.</span><span class="n">to_feather</span><span class="p">(</span><span class="n">output</span> <span class="o">/</span> <span class="s1">'data'</span> <span class="o">/</span> <span class="s1">'freqs.feather'</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="output_wrapper">
|
||||||
|
<div class="output">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="output_area">
|
||||||
|
|
||||||
|
<div class="prompt"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="output_subarea output_text output_error">
|
||||||
|
<pre>
|
||||||
|
<span class="ansi-red-fg">---------------------------------------------------------------------------</span>
|
||||||
|
<span class="ansi-red-fg">AttributeError</span> Traceback (most recent call last)
|
||||||
|
<span class="ansi-green-fg"><ipython-input-18-7660e1d3307d></span> in <span class="ansi-cyan-fg"><module></span>
|
||||||
|
<span class="ansi-green-fg">----> 1</span><span class="ansi-red-fg"> </span>psd<span class="ansi-blue-fg">.</span>to_feather<span class="ansi-blue-fg">(</span>output <span class="ansi-blue-fg">/</span> <span class="ansi-blue-fg">'data'</span> <span class="ansi-blue-fg">/</span> <span class="ansi-blue-fg">'psd.feather'</span><span class="ansi-blue-fg">)</span>
|
||||||
|
<span class="ansi-green-intense-fg ansi-bold"> 2</span> freqs<span class="ansi-blue-fg">.</span>to_feather<span class="ansi-blue-fg">(</span>output <span class="ansi-blue-fg">/</span> <span class="ansi-blue-fg">'data'</span> <span class="ansi-blue-fg">/</span> <span class="ansi-blue-fg">'freqs.feather'</span><span class="ansi-blue-fg">)</span>
|
||||||
|
|
||||||
|
<span class="ansi-red-fg">AttributeError</span>: 'dict' object has no attribute 'to_feather'</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"15:15:05 [I] klustakwik KlustaKwik2 version 0.2.6\n"
|
"10:26:07 [I] klustakwik KlustaKwik2 version 0.2.6\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"output = pathlib.Path('output/stimulus-lfp-response')\n",
|
"output = pathlib.Path('output/stimulus-lfp-response')\n",
|
||||||
"(output / 'figures').mkdir(parents=True, exist_ok=True)"
|
"(output / 'data').mkdir(parents=True, exist_ok=True)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 8,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 9,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 10,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 11,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 12,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 14,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 15,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -303,13 +303,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 16,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "81d917d31c0e43cf80ec3398d46b2c01",
|
"model_id": "e733903bb8d7406ea6c05bf5af093bfc",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
|
@ -319,6 +319,13 @@
|
||||||
},
|
},
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "display_data"
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -327,6 +334,77 @@
|
||||||
" left_index=True, right_index=True)"
|
" left_index=True, right_index=True)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 17,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
|
"model_id": "0184251a265a40a2a1e9910405f05db8",
|
||||||
|
"version_major": 2,
|
||||||
|
"version_minor": 0
|
||||||
|
},
|
||||||
|
"text/plain": [
|
||||||
|
"HBox(children=(IntProgress(value=0, max=704), HTML(value='')))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"psd, freqs = {}, {}\n",
|
||||||
|
"for i, row in tqdm(channel_groups.iterrows(), total=len(channel_groups)):\n",
|
||||||
|
" action_id = row['action']\n",
|
||||||
|
" channel_group = row['channel_group']\n",
|
||||||
|
" action_group = f'{action_id}_{channel_group}'\n",
|
||||||
|
" lfp = data_loader.lfp(action_id, channel_group)\n",
|
||||||
|
" clean_lfp = select_and_clean(lfp)\n",
|
||||||
|
" snls = signaltonoise(clean_lfp)\n",
|
||||||
|
" best_channel = np.argmax(snls)\n",
|
||||||
|
" snl = snls[best_channel]\n",
|
||||||
|
" \n",
|
||||||
|
" lim = get_lim(action_id)\n",
|
||||||
|
" \n",
|
||||||
|
" mask = get_mask(lfp, lim)\n",
|
||||||
|
" signal = zscore(clean_lfp[mask, best_channel].ravel())\n",
|
||||||
|
" \n",
|
||||||
|
" p_xx, freq = mlab.psd(signal, Fs=lfp.sampling_rate.magnitude, NFFT=NFFT)\n",
|
||||||
|
" psd.update({action_group: p_xx})\n",
|
||||||
|
" freqs.update({action_group: freq})"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 18,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "AttributeError",
|
||||||
|
"evalue": "'dict' object has no attribute 'to_feather'",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[0;32m<ipython-input-18-7660e1d3307d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mpsd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_feather\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutput\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;34m'data'\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;34m'psd.feather'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mfreqs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_feather\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutput\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;34m'data'\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;34m'freqs.feather'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[0;31mAttributeError\u001b[0m: 'dict' object has no attribute 'to_feather'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"(psd).to_feather(output / 'data' / 'psd.feather')\n",
|
||||||
|
"freqs.to_feather(output / 'data' / 'freqs.feather')"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
|
After Width: | Height: | Size: 12 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-stim_energy.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-stim_half_width.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-stim_p_max.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-stim_strength.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-theta_energy.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-theta_freq.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-theta_half_width.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
actions/stimulus-lfp-response/data/figures/lfp-psd-histogram-theta_peak.svg (Stored with Git LFS)
Normal file
After Width: | Height: | Size: 45 KiB |