diff --git a/Bleach_compare.py b/Bleach_compare.py index 530e518..102a716 100644 --- a/Bleach_compare.py +++ b/Bleach_compare.py @@ -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) @@ -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() diff --git a/Simulation.ipynb b/Simulation.ipynb index 8a50875..e402b9a 100644 --- a/Simulation.ipynb +++ b/Simulation.ipynb @@ -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" ] @@ -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", diff --git a/__pycache__/s_functions.cpython-311.pyc b/__pycache__/s_functions.cpython-311.pyc index 35d6310..18bb740 100644 Binary files a/__pycache__/s_functions.cpython-311.pyc and b/__pycache__/s_functions.cpython-311.pyc differ diff --git a/f_rate2.py b/f_rate2.py index 34de8cd..1269baa 100644 --- a/f_rate2.py +++ b/f_rate2.py @@ -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()