Skip to content

Commit

Permalink
01/12
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianNGitahi committed Dec 4, 2023
1 parent 3d0ee3f commit 574a1b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
15 changes: 8 additions & 7 deletions Bleach_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
# plot bleached signal for the bleach factor acting on different components of f

# create timesteps array for the plot
t = np.linspace(0,nm_conc.size-1,nm_conc.size)
# t = np.linspace(0,nm_conc.size-1,nm_conc.size)

b1 = bleach_nm(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
b2 = bleach_dnm(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
b3 = bleach_t(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
b4 = bleach_all(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
# b1 = bleach_nm(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
# b2 = bleach_dnm(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
# b3 = bleach_t(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)
# b4 = bleach_all(K_D = 1000, tau=chosen_tau, F_max = 45, F_min = 10, nm_conc=nm_conc, bline_len=5000)



Expand All @@ -52,9 +52,10 @@

# for different variances, get the heatmap
plt.figure()
for i in range(len(var_v)):
for i in range(len(var_values)):
plt.subplot(3,2,i+1)
bleach_dnm_heat(specific_taus,nm_conc_input=nm_conc, var = var_v[i])
bleach_dnm_heat(specific_taus,nm_conc_input=nm_conc, var = var_values[i])
print('Generated heatmap {}'.format(i))

plt.suptitle('SNR vs bleach strength at different variance for ftissue', size = 16)
plt.tight_layout()
Expand Down
6 changes: 3 additions & 3 deletions Simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Ok, look's like the neuron is firing as we expect it to over number of timesteps. This section of code produced figure 1 on the interal note document.\n",
"Ok, look's like the neuron is firing as we expect it to over number of timesteps. (This section of code produced figure 1 on the interal note document.)\n",
"\n",
"Bonus: run this function several times and histogram the n_spikes to see if it's actually a poisson w mean of n_timesteps spikes.\n"
]
Expand Down Expand Up @@ -423,11 +423,11 @@
"Now, let's simulate the flourescence signal produced by the changes in the neuromodulator concentration, $\\ \\Delta$ [NM]. This is described by eq. 3 in the paper by Neher/Augustine -- 1992: \n",
"\n",
"$\\begin{equation}\n",
" \\frac{\\Delta F(t)}{F(0)} = \\frac{(K'_D + [NM]_{i,t})/(K_D + [NM]_{i,t})}{(K'_D + [NM]_{i,0})/(K_D + [NM]_{i,0})} - 1\n",
" \\frac{\\Delta F(t)}{F(0)} = \\frac{(K'_D + [NM]_{t})/(K_D + [NM]_{t})}{(K'_D + [NM]_{0})/(K_D + [NM]_{0})} - 1\n",
"\\end{equation}\n",
"$\n",
"\n",
"where $K_D$ is the dissociation constant for the NM binding to the sensor, $\\ [NM]_{i,0}\\ $ is the initial (resting) [NM], $\\ [NM]_{i,t}\\ $ is the [NM] for the current timestep, and $K'_D$ is defined as:\n",
"where $K_D$ is the dissociation constant for the NM binding to the sensor, $\\ [NM]_{0}\\ $ is the initial (resting) [NM], $\\ [NM]_{t}\\ $ is the [NM] for the current timestep, and $K'_D$ is defined as:\n",
"\n",
"$\\begin{equation} \\tag{2}\n",
" K'_D = K_D\\ (F_{min}/F_{max})\n",
Expand Down
Binary file modified __pycache__/s_functions.cpython-311.pyc
Binary file not shown.
24 changes: 0 additions & 24 deletions f_rate2.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,5 @@ def plot_dff_v_activity(firing_rates, dff, fit):
# plt.show()


# Test 2:

# check the effect of changing the variance of the gaussian noise on ftissue on the snr
var_values = np.array([0.0001,0.001,0.01,0.1,1,3])
var_v = np.array([1,3,10])

# bleach time constants for heatmap
specific_taus = np.logspace(5,7,20)

# generate a firing neuron
neuron = simulate_neuron(n_timesteps=70000,firing_rate=13)

# generate nm_conc
nm_conc, nm_b_conc, nm_r_conc = simulate_nm_conc(neuron,nm_conc0=0,k_b=0.6, k_r=0.4,gamma=0.004)

# for different variances, get the heatmap
plt.figure()
for i in range(len(var_v)):
plt.subplot(3,2,i+1)
bleach_dnm_heat(specific_taus,nm_conc_input=nm_conc, var = var_v[i])

plt.suptitle('SNR vs bleach strength at different variance for ftissue', size = 16)
plt.tight_layout()
plt.show()


0 comments on commit 574a1b9

Please sign in to comment.