Skip to content

Commit

Permalink
+ spike field coherence
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Kramer committed Nov 13, 2024
1 parent 0e793b8 commit 732e154
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 34 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions Coherence_Lab_Part_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
"Yf = np.fft.fft(y - y.mean()) # Compute Fourier transform of y\n",
"\n",
"# Compute the spectra\n",
"Sxx = \"SOMETHING\" # Spectrum of E1 trials\n",
"Syy = \"SOMETHING\" # ... and E2 trials\n",
"Sxx = \"SOMETHING\" # Spectrum of x\n",
"Syy = \"SOMETHING\" # ... and y\n",
"Sxy = \"SOMETHING\" # ... and the cross spectrum\n",
"\n",
"# Compute the coherence.\n",
Expand Down Expand Up @@ -124,7 +124,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.18"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion Coherence_Lab_Part_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.18"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
Binary file modified Slides/Coherence_Lecture_2.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/Analyzing_Rhythms_Lab_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
2 changes: 1 addition & 1 deletion docs/Analyzing_Rhythms_Lab_2a.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
2 changes: 1 addition & 1 deletion docs/Analyzing_Rhythms_Lab_2b.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
2 changes: 1 addition & 1 deletion docs/Analyzing_Rhythms_Lab_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
4 changes: 2 additions & 2 deletions docs/Backpropagation.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down Expand Up @@ -228,7 +228,7 @@
}

// Store cell data
globalThis.qpyodideCellDetails = [{"code":"import numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd","options":{"fig-cap":"","warning":"true","out-width":"700px","message":"true","results":"markup","classes":"","fig-width":7,"dpi":72,"out-height":"","comment":"","context":"interactive","output":"true","label":"","autorun":"","read-only":"false","fig-height":5},"id":1},{"code":"df = pd.read_csv(\"https://raw.githubusercontent.com/Mark-Kramer/BU-MA665-MA666/master/Data/backpropagation_example_data.csv\")\n\n# Extract the variables from the loaded data\nin_true = np.array(df.iloc[:,0]) #Get the values associated with the first column of the dataframe\nout_true = np.array(df.iloc[:,1]) #Get the values associated with the second column of the dataframe","options":{"fig-cap":"","warning":"true","out-width":"700px","message":"true","results":"markup","classes":"","fig-width":7,"dpi":72,"out-height":"","comment":"","context":"interactive","output":"true","label":"","autorun":"","read-only":"false","fig-height":5},"id":2},{"code":"print(np.transpose([in_true, out_true]))","options":{"fig-cap":"","warning":"true","out-width":"700px","message":"true","results":"markup","classes":"","fig-width":7,"dpi":72,"out-height":"","comment":"","context":"interactive","output":"true","label":"","autorun":"","read-only":"false","fig-height":5},"id":3},{"code":"def sigmoid(x):\n return 1/(1+np.exp(-x)) # Define the sigmoid anonymous function.\n\ndef feedforward(w, s0): # Define feedforward solution.\n # ... x1 = activity of first neuron,\n # ... s1 = output of first neuron,\n # ... x2 = activity of second neuron,\n # ... s2 = output of second neuron,\n # ... out = output of neural network.\n return out,s1,s2","options":{"fig-cap":"","warning":"true","out-width":"700px","message":"true","results":"markup","classes":"","fig-width":7,"dpi":72,"out-height":"","comment":"","context":"interactive","output":"true","label":"","autorun":"","read-only":"false","fig-height":5},"id":4},{"code":"w = [0.5,0.5] # Choose initial values for the weights.\nalpha = 0.01 # Set the learning constant.\n\nK = np.size(in_true);\nresults = np.zeros([K,3]) # Define a variable to hold the results of each iteration. \n\nfor k in np.arange(K):\n s0 = in_true[k] # Define the input,\n target = out_true[k] # ... and the target output.\n \n #Calculate feedforward solution to get output.\n \n #Update the weights.\n w0 = w[0]; w1 = w[1];\n w[1] = \"SOMETHING\"\n w[0] = \"SOMETHING\"\n \n # Save the results of this step. --------------------------------------\n # Here we save the 3 weights, and the neural network output.\n # results[k,:] = [w[0],w[1], out]\n\n# Plot the NN weights and error during training \n# plt.clf()\n# plt.plot(results[:,1], label='w1')\n# plt.plot(results[:,0], label='w0')\n# plt.plot(results[:,2]-target, label='error')\n# plt.legend() #Include a legend,\n# plt.xlabel('Iteration number'); #... and axis label.\n\n# Print the NN weights\n# print(results[-1,0:2])","options":{"fig-cap":"","warning":"true","out-width":"700px","message":"true","results":"markup","classes":"","fig-width":7,"dpi":72,"out-height":"","comment":"","context":"interactive","output":"true","label":"","autorun":"","read-only":"false","fig-height":5},"id":5}];
globalThis.qpyodideCellDetails = [{"id":1,"options":{"autorun":"","read-only":"false","fig-width":7,"warning":"true","comment":"","context":"interactive","dpi":72,"label":"","out-width":"700px","message":"true","output":"true","fig-height":5,"classes":"","results":"markup","fig-cap":"","out-height":""},"code":"import numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd"},{"id":2,"options":{"autorun":"","read-only":"false","fig-width":7,"warning":"true","comment":"","context":"interactive","dpi":72,"label":"","out-width":"700px","message":"true","output":"true","fig-height":5,"classes":"","results":"markup","fig-cap":"","out-height":""},"code":"df = pd.read_csv(\"https://raw.githubusercontent.com/Mark-Kramer/BU-MA665-MA666/master/Data/backpropagation_example_data.csv\")\n\n# Extract the variables from the loaded data\nin_true = np.array(df.iloc[:,0]) #Get the values associated with the first column of the dataframe\nout_true = np.array(df.iloc[:,1]) #Get the values associated with the second column of the dataframe"},{"id":3,"options":{"autorun":"","read-only":"false","fig-width":7,"warning":"true","comment":"","context":"interactive","dpi":72,"label":"","out-width":"700px","message":"true","output":"true","fig-height":5,"classes":"","results":"markup","fig-cap":"","out-height":""},"code":"print(np.transpose([in_true, out_true]))"},{"id":4,"options":{"autorun":"","read-only":"false","fig-width":7,"warning":"true","comment":"","context":"interactive","dpi":72,"label":"","out-width":"700px","message":"true","output":"true","fig-height":5,"classes":"","results":"markup","fig-cap":"","out-height":""},"code":"def sigmoid(x):\n return 1/(1+np.exp(-x)) # Define the sigmoid anonymous function.\n\ndef feedforward(w, s0): # Define feedforward solution.\n # ... x1 = activity of first neuron,\n # ... s1 = output of first neuron,\n # ... x2 = activity of second neuron,\n # ... s2 = output of second neuron,\n # ... out = output of neural network.\n return out,s1,s2"},{"id":5,"options":{"autorun":"","read-only":"false","fig-width":7,"warning":"true","comment":"","context":"interactive","dpi":72,"label":"","out-width":"700px","message":"true","output":"true","fig-height":5,"classes":"","results":"markup","fig-cap":"","out-height":""},"code":"w = [0.5,0.5] # Choose initial values for the weights.\nalpha = 0.01 # Set the learning constant.\n\nK = np.size(in_true);\nresults = np.zeros([K,3]) # Define a variable to hold the results of each iteration. \n\nfor k in np.arange(K):\n s0 = in_true[k] # Define the input,\n target = out_true[k] # ... and the target output.\n \n #Calculate feedforward solution to get output.\n \n #Update the weights.\n w0 = w[0]; w1 = w[1];\n w[1] = \"SOMETHING\"\n w[0] = \"SOMETHING\"\n \n # Save the results of this step. --------------------------------------\n # Here we save the 3 weights, and the neural network output.\n # results[k,:] = [w[0],w[1], out]\n\n# Plot the NN weights and error during training \n# plt.clf()\n# plt.plot(results[:,1], label='w1')\n# plt.plot(results[:,0], label='w0')\n# plt.plot(results[:,2]-target, label='error')\n# plt.legend() #Include a legend,\n# plt.xlabel('Iteration number'); #... and axis label.\n\n# Print the NN weights\n# print(results[-1,0:2])"}];


</script>
Expand Down
6 changes: 3 additions & 3 deletions docs/Coherence_Lab_Part_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down Expand Up @@ -238,8 +238,8 @@ <h2 class="anchored" data-anchor-id="compute-the-coherence">Compute the coherenc
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>Yf <span class="op">=</span> np.fft.fft(y <span class="op">-</span> y.mean()) <span class="co"># Compute Fourier transform of y</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute the spectra</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>Sxx <span class="op">=</span> <span class="st">"SOMETHING"</span> <span class="co"># Spectrum of E1 trials</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>Syy <span class="op">=</span> <span class="st">"SOMETHING"</span> <span class="co"># ... and E2 trials</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>Sxx <span class="op">=</span> <span class="st">"SOMETHING"</span> <span class="co"># Spectrum of x</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>Syy <span class="op">=</span> <span class="st">"SOMETHING"</span> <span class="co"># ... and y</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a>Sxy <span class="op">=</span> <span class="st">"SOMETHING"</span> <span class="co"># ... and the cross spectrum</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="co"># Compute the coherence.</span></span>
Expand Down
2 changes: 1 addition & 1 deletion docs/Coherence_Lab_Part_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
2 changes: 1 addition & 1 deletion docs/Coherence_Lab_Part_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">
<meta name="generator" content="quarto-1.5.57">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down
Loading

0 comments on commit 732e154

Please sign in to comment.