-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modfy some files since change to windows platform
- Loading branch information
Showing
21 changed files
with
540 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Guest lecture on Retina -- Dr. Fred Rieke | ||
``` | ||
Retina cell --- where visual processing begins. | ||
Photo-receptors are transduced and converted into electrical responses. | ||
The rand photo-receptors are receptive to dim light. | ||
The cone photo-receptors helps in extending higher visual levels. | ||
The signals produced in the rand and cone segments are processed by serveral layers of cells within the retina before passing to the optic nerve of the brain. | ||
The few photons are coming-in are being absorbed within a pool of several 100s upto 1000s of rods generate electrical signals which are not only reliably detective with the retina, but it sends to brain with reliable perception. | ||
``` | ||
 | ||
``` | ||
So, what are we looking for is, | ||
The threshold of retaining the non-linearity of signals on rods from the photons, where it ejects noise from the remaining rods. | ||
It's the case where in the nervous systems over the aspects of convergence of many inputs on downstream cell and those small subset of inputs where all those outputs are generating noise. | ||
``` | ||
 | ||
``` | ||
Advantages: | ||
``` | ||
``` | ||
1. Access to rod signal and noise properties, | ||
where it measure the response of the rods of single photons. | ||
We can measure the noise of the rod responses and | ||
We can summarize it by constructing the distributions that capture the probability of the given rod generates the amplitude responses, | ||
where we can plot it as the probability versus the amplitude. | ||
For those in black curve, the rod failed to absorb the photon that's being generating noise. | ||
For those in red curve, the rod absorbs the photon that's being generated as single photons. | ||
This helps in giving a theoritical prediction of how to make selection of signals and noise. | ||
``` | ||
 | ||
``` | ||
2. Circuitry points | ||
-- The circuitry points are likely the location at synapse between rods and rod bipolar cells. | ||
-- Rod bipolar cell seems to receive multiple inputs. | ||
Combination of multiple inputs in a linear manner. | ||
``` | ||
``` | ||
3. Direct recording | ||
-- Majority of rod single photon responses were rejected. | ||
``` | ||
 | ||
``` | ||
The plots above were kinda misleading... | ||
``` | ||
``` | ||
Here is an improved way of representing the distribution. | ||
``` | ||
 | ||
``` | ||
Now, the question is, | ||
What will happen to the visual threshold (like 1 in 1000 rods absorb the photons)? | ||
The second chart shows it (in the above diagram). | ||
The maximum amplitude is gained from the rod associating with the noise and then, associating with signal. | ||
This helps in predicting the position of non-linearity. | ||
``` | ||
<br> | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pickle | ||
|
||
import numpy as np | ||
|
||
|
||
def load_data(path): | ||
with open(path, 'rb') as f: | ||
data = pickle.load(f) | ||
return data | ||
|
||
|
||
# question 9 | ||
data = load_data("pop_coding_3.4.pickle") | ||
|
||
c = [data['c1'], data['c2'], data['c3'], data['c4']] | ||
r = [data['r1'], data['r2'], data['r3'], data['r4']] | ||
|
||
data = load_data("tuning_3.4.pickle") | ||
|
||
stim = data['stim'] | ||
n = [data['neuron1'], data['neuron2'], data['neuron3'], data['neuron4']] | ||
|
||
n_max = [np.max(np.mean(ni, axis=0)) for ni in n] | ||
|
||
arg = np.divide([rr.mean() for rr in r], n_max) | ||
|
||
popultion = np.multiply(c, arg.T) | ||
popultion = popultion.sum(axis=1) | ||
angle = np.arctan(-popultion[0] / popultion[1]) | ||
answer = 180 - angle * 180.0 / np.pi | ||
print(answer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
Finally, we ran an additional set of experiments in which we exposed each of the | ||
neurons to a single stimulus of unknown direction for 10 trials of 10 seconds | ||
each. We have placed the results of this experiment in the following file: | ||
pop_coding contains four vectors named r1, r2, r3, and r4 that contain the | ||
responses (firing rate in Hz) of the four neurons to this mystery stimulus. | ||
It also contains four vectors named c1, c2, c3, and c4. These are the basis | ||
vectors corresponding to neuron 1, neuron 2, neuron 3, and neuron 4. | ||
Decode the neural responses and recover the mystery stimulus vector by computing | ||
the population vector for these neurons. You should use the maximum average | ||
firing rate (over any of the stimulus values in 'tuning.mat') for a neuron as | ||
the value of rmax for that neuron. That is, rmax should be the maximum value in | ||
the tuning curve for that neuron. | ||
What is the direction, in degrees, of the population vector? You should round | ||
your answer to the nearest degree. Your answer should contain the value only (no | ||
units!) and should be between 0∘ and 360∘. If your calculations give a negative | ||
number or a number greater than or equal to 360, convert it to a number in the | ||
proper range (you may use the mod function to do this). | ||
You may need to convert your resulting vector from Cartesian coordinates to | ||
polar coordinates to find the angle. You may use the atan() function in MATLAB | ||
to do this. Note that the the convention we're using defines 0∘ to point in the | ||
direction of the positive y-axis and 90∘ to point in the direction of the | ||
positive x-axis (i.e., 0 degrees is north, 90 degrees is east). | ||
""" | ||
|
||
import numpy as np | ||
import pickle | ||
|
||
FILENAME = 'pop_coding_3.4.pickle' | ||
|
||
with open(FILENAME, 'rb') as f: | ||
data = pickle.load(f) | ||
|
||
c = [data['c1'], data['c2'], data['c3'], data['c4']] | ||
r = [data['r1'], data['r2'], data['r3'], data['r4']] | ||
|
||
basis_vector = [] | ||
for rr, cc in zip(r, c): | ||
# Calculate the weighted basis vector | ||
nr = rr / rr.max() | ||
mean_vector = np.outer(nr, cc).mean(axis=0) | ||
|
||
# Normalize the vector | ||
mean_vector /= np.sqrt(np.inner(mean_vector, mean_vector)) | ||
|
||
basis_vector.append(mean_vector) | ||
|
||
print('Weighted basis vectors: %s' % basis_vector) | ||
|
||
# Only take the first two, because the rest are nan | ||
pop_vector = np.nansum(basis_vector, axis=0) | ||
pop_vector /= np.sqrt(np.inner(pop_vector, pop_vector)) | ||
|
||
print('Population Vector (X, Y): %s' % pop_vector) | ||
print('Population vector in polar coordinates: %f' % np.arctan(pop_vector[1]/pop_vector[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
""" | ||
Created on Wed Apr 22 15:15:16 2015 | ||
Quiz 2 code. | ||
This exercise is based on a set of artificial "experiments" that we've run on | ||
four simulated neurons that emulate the behavior found in the cercal organs of a | ||
cricket. Please note that all the supplied data is synthetic. Any resemblance to | ||
a real cricket is purely coincidental. | ||
In the first set of experiments, we probed each neuron with a range of air | ||
velocity stimuli of uniform intensity and differing direction. We recorded the | ||
firing rate of each of the neurons in response to each of the stimulus values. | ||
Each of these recordings lasted 10 seconds and we repeated this process 100 | ||
times for each neuron-stimulus combination. | ||
We've supplied you with a .mat file for each of the neurons that contains the | ||
recorded firing rates (in Hz). These are named neuron1, neuron2, neuron3, and | ||
neuron4. The stimulus, that is, the direction of the air velocity, is in the | ||
vector named stim. | ||
Plot the tuning curve-- the mean firing rate of the neuron as a function of the | ||
stimulus-- for each of the neurons. | ||
""" | ||
|
||
from __future__ import division | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
import pickle | ||
|
||
FILENAME = 'tuning_3.4.pickle' | ||
|
||
with open(FILENAME, 'rb') as f: | ||
data = pickle.load(f) | ||
|
||
stim = data['stim'] | ||
neurons = ['neuron1', 'neuron2', 'neuron3', 'neuron4'] | ||
|
||
f, ax = plt.subplots(len(neurons), 1, sharex=True, sharey=True) | ||
for i, n in enumerate(neurons): | ||
ax[i].plot(stim, data[n].mean(axis=0)) | ||
ax[i].set_title(n) | ||
|
||
plt.xlabel('Air direction [degree]') | ||
plt.ylabel('Spike Rate [Hz]') | ||
f.subplots_adjust(hspace=0.5) | ||
plt.show() | ||
|
||
|
||
""" | ||
We have reason to suspect that one of the neurons is not like the others. Three | ||
of the neurons are Poisson neurons (they are accurately modeling using a Poisson | ||
process), but we believe that the remaining one might not be. | ||
Which of the neurons (if any) is NOT Poisson? | ||
Hint: Think carefully about what it means for a neuron to be Poisson. You may | ||
find it useful to review the last lecture of week 2. Note that we give you the | ||
firing rate of each of the neurons, not the spike count. You may find it useful | ||
to convert the firing rates to spike counts in order to test for "Poisson-ness", | ||
however this is not necessary. | ||
In order to realize why this might be helpful, consider the fact that, for a | ||
constant a and a random variable X, 𝔼[aX]=a𝔼[X] but Var(aX)=a2Var(X). What might | ||
this imply about the Poisson statistics (like the Fano factor) when we convert | ||
the spike counts (the raw output of the Poisson spike generator) into a firing | ||
rate (what we gave you)? | ||
""" | ||
|
||
a = 10.0 # 10Hz | ||
# As mentioned in the hint above | ||
# a E[X] = a**2 Var(X) -> E[x] = a Var(X) | ||
# So test for diversions from the similarity | ||
f, ax = plt.subplots(len(neurons), 1, sharex=True, sharey=True) | ||
for i, n in enumerate(neurons): | ||
y = data[n].mean(axis=0) - a * data[n].var(axis=0) | ||
ax[i].plot(stim, y) | ||
ax[i].set_title(n) | ||
|
||
plt.xlabel('Air direction [degree]') | ||
plt.ylabel('E[X] - 10.0 * Var(X)') | ||
f.subplots_adjust(hspace=0.5) | ||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.