plots
This commit is contained in:
parent
396347bd74
commit
f1b588d9ae
@ -1,5 +1,4 @@
|
||||
|
||||
from threefish.utils0 import p_units_to_show, update_cell_names
|
||||
from threefish.core_cell_choice import p_units_to_show, update_cell_names
|
||||
from threefish.plot_suscept import ampullary_punit
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
@ -1,5 +1,5 @@
|
||||
from threefish.utils0 import p_units_to_show
|
||||
from threefish.utils1_suscept import fr_name_rm
|
||||
from threefish.core_cell_choice import p_units_to_show
|
||||
from threefish.core_plot_labels import label_fr_name_rm
|
||||
from threefish.plot_suscept import ampullary_punit
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -7,4 +7,4 @@ if __name__ == '__main__':
|
||||
|
||||
#stack_file = pd.read_csv('..\calc_RAM\calc_nix_RAM-eod_2022-01-28-ag-invivo-1_all__amp_20.0_filename_InputArr_400hz_30_P-unitApteronotusleptorhynchus.csv')
|
||||
cells_plot2 = p_units_to_show(type_here = 'contrasts')#permuted = True,
|
||||
ampullary_punit(eod_metrice = False, color_same = False,base_extra = True, fr_name = fr_name_rm(), cells_plot2=[cells_plot2[0]], isi_delta = 5, titles=[''],tags_individual = True, xlim_p = [0,1.15])#Low-CV P-unit,
|
||||
ampullary_punit(eod_metrice = False, color_same = False, base_extra = True, fr_name = label_fr_name_rm(), cells_plot2=[cells_plot2[0]], isi_delta = 5, titles=[''], tags_individual = True, xlim_p = [0, 1.15])#Low-CV P-unit,
|
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
from threefish.utils0 import p_units_to_show
|
||||
from threefish.utils1_suscept import fr_name_rm
|
||||
from threefish.core_cell_choice import p_units_to_show
|
||||
from threefish.core_plot_labels import label_fr_name_rm
|
||||
from threefish.plot_suscept import ampullary_punit
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
cells_plot2 = p_units_to_show(type_here='contrasts')#permuted = True,
|
||||
ampullary_punit(base_extra = True,eod_metrice = False, color_same = False, fr_name = fr_name_rm(), tags_individual = True, isi_delta = 5, cells_plot2=[cells_plot2[1]], titles=['', 'Ampullary cell,'],)#High-CV P-unit,
|
||||
ampullary_punit(base_extra = True, eod_metrice = False, color_same = False, fr_name = label_fr_name_rm(), tags_individual = True, isi_delta = 5, cells_plot2=[cells_plot2[1]], titles=['', 'Ampullary cell,'], )#High-CV P-unit,
|
Binary file not shown.
@ -2,12 +2,17 @@ from IPython import embed
|
||||
from matplotlib import gridspec as gridspec, pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from threefish.utils0 import basename_small, colors_overview, default_figsize, exclude_nans_for_corr, get_grid_4, \
|
||||
scatter_with_marginals_colorcoded, update_cell_names, \
|
||||
load_overview_susept, \
|
||||
make_log_ticks, save_visualization, setting_overview_score, version_final
|
||||
from threefish.core_plot_labels import pearson_label
|
||||
from threefish.utils1_suscept import plt_specific_cells, stimname_small, NLI_scorename2_small, start_name
|
||||
from threefish.core_cell_choice import update_cell_names
|
||||
from threefish.core_filenames import version_final
|
||||
from threefish.core_plot_suscept import get_grid_4, scatter_with_marginals_colorcoded
|
||||
from threefish.defaults import default_figsize
|
||||
from threefish.core_plot_colors import colors_overview
|
||||
from threefish.core_reformat import exclude_nans_for_corr, load_overview_susept
|
||||
from threefish.core_load import save_visualization
|
||||
from threefish.core_bursts import setting_overview_score
|
||||
from threefish.core_plot_labels import basename_small, label_NLI_scorename2_small, label_pearson, label_stimname_small, \
|
||||
make_log_ticks
|
||||
from threefish.utils1_suscept import plt_specific_cells, start_name
|
||||
from scipy import stats
|
||||
try:
|
||||
from plotstyle import plot_style, spines_params
|
||||
@ -126,14 +131,14 @@ def data_overview3():
|
||||
var_item_names = [var_it,var_it,var_it2]#,var_it2]#['Response Modulation [Hz]',]
|
||||
var_types = ['response_modulation','response_modulation','']#,'']#'response_modulation'
|
||||
max_x = max_xs[c]
|
||||
x_axis_names = ['CV$'+basename_small()+'$','CV$'+stimname_small()+'$','Response Modulation [Hz]']#$'+basename()+'$,'Fr$'+basename()+'$',]
|
||||
x_axis_names = ['CV$' + basename_small() +'$','CV$' + label_stimname_small() + '$', 'Response Modulation [Hz]']#$'+basename()+'$,'Fr$'+basename()+'$',]
|
||||
#score = scores[0]
|
||||
score_n = ['Perc99/Med', 'Perc99/Med', 'Perc99/Med']
|
||||
score = scores[c]
|
||||
scores_here = [score,score,score]#,score]
|
||||
score_name = ['max(diag5Hz)/med_diagonal_proj_fr','max(diag5Hz)/med_diagonal_proj_fr']#,'max(diag5Hz)/med_diagonal_proj_fr']#'Perc99/Med'
|
||||
score_name = ['Fr/Med', 'Fr/Med']#'Fr/Med'] # 'Perc99/Med'
|
||||
score_name = [NLI_scorename2_small(), NLI_scorename2_small(), NLI_scorename2_small()]#NLI_scorename()] # 'Fr/Med''Perc99/Med'
|
||||
score_name = [label_NLI_scorename2_small(), label_NLI_scorename2_small(), label_NLI_scorename2_small()]#NLI_scorename()] # 'Fr/Med''Perc99/Med'
|
||||
ax_j = []
|
||||
axls = []
|
||||
axss = []
|
||||
@ -246,7 +251,7 @@ def data_overview3():
|
||||
print('frame file lost')
|
||||
embed()
|
||||
corr, p_value = stats.pearsonr(x_axis, y_axis)
|
||||
pears_l = pearson_label(corr, p_value, y_axis, n=True)
|
||||
pears_l = label_pearson(corr, p_value, y_axis, n=True)
|
||||
print(start_name(cell_type_here, species) + ' ' + corr_var + ' to '+str(score) + pears_l)
|
||||
#if corr_var == 'ser_first_base':#
|
||||
# embed()
|
||||
@ -256,7 +261,7 @@ def data_overview3():
|
||||
c_axis, x_axis, y_axis, exclude_here = exclude_nans_for_corr(frame_file, 'fr_base', cv_name='fr_base',
|
||||
score='cv_base')
|
||||
corr, p_value = stats.pearsonr(x_axis, y_axis)
|
||||
pears_l = pearson_label(corr, p_value, y_axis, n=True)
|
||||
pears_l = label_pearson(corr, p_value, y_axis, n=True)
|
||||
print(start_name(cell_type_here, species) + ' ' + 'fr_base' + ' to ' + 'cv_base' + pears_l)
|
||||
|
||||
|
||||
@ -266,7 +271,7 @@ def data_overview3():
|
||||
c_axis, x_axis, y_axis, exclude_here = exclude_nans_for_corr(frame_file, 'burst_fraction_burst_corr_individual_base', cv_name='burst_fraction_burst_corr_individual_base',
|
||||
score='cv_base')
|
||||
corr, p_value = stats.pearsonr(x_axis, y_axis)
|
||||
pears_l = pearson_label(corr, p_value, y_axis, n=True)
|
||||
pears_l = label_pearson(corr, p_value, y_axis, n=True)
|
||||
print(start_name(cell_type_here, species) + ' amprange: ' + 'burst_fraction_individual_base' + ' to ' + 'cv_base' + pears_l)
|
||||
###############################
|
||||
# fr to nonline but for both modulations
|
||||
@ -274,7 +279,7 @@ def data_overview3():
|
||||
c_axis, x_axis, y_axis, exclude_here = exclude_nans_for_corr(frame_file, 'fr_base', cv_name='fr_base',
|
||||
score=score)
|
||||
corr, p_value = stats.pearsonr(x_axis, y_axis)
|
||||
pears_l = pearson_label(corr, p_value, y_axis, n=True)
|
||||
pears_l = label_pearson(corr, p_value, y_axis, n=True)
|
||||
print(start_name(cell_type_here, species) + ' amprange: ' + ' ' + 'fr_base' + ' to score' + pears_l)
|
||||
##################################
|
||||
print('\n')
|
||||
|
BIN
flowchart.pdf
BIN
flowchart.pdf
Binary file not shown.
13
flowchart.py
13
flowchart.py
@ -1,18 +1,21 @@
|
||||
#from utils0import default_settings
|
||||
#from plt_RAM import model_and_data_isi, model_cells
|
||||
from plotstyle import plot_style
|
||||
from threefish.utils0 import default_figsize, save_visualization
|
||||
from threefish.plot_suscept import model_sheme_split2
|
||||
#from threefish.utils0 import default_settings, resave_small_files
|
||||
#from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
import matplotlib.gridspec as gridspec
|
||||
# from threefish.utils0 import default_settings, resave_small_files
|
||||
# from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
|
||||
from threefish.plot_suscept import model_sheme_split2
|
||||
# from threefish.utils0 import default_settings, resave_small_files
|
||||
# from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
# from threefish.utils0 import default_settings, resave_small_files
|
||||
# from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
import matplotlib.gridspec as gridspec
|
||||
|
||||
from plotstyle import plot_style
|
||||
from threefish.core_load import save_visualization
|
||||
from threefish.plot_suscept import model_sheme_split2
|
||||
from threefish.utils0 import default_figsize, save_visualization
|
||||
from threefish.defaults import default_figsize
|
||||
|
||||
|
||||
def flowchart():
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 109 KiB |
@ -7,18 +7,18 @@ from IPython import embed
|
||||
from matplotlib import gridspec, pyplot as plt
|
||||
|
||||
from plotstyle import plot_style
|
||||
from threefish.utils0 import default_settings, find_cell_add, get_flowchart_params, load_model_susept, \
|
||||
nonlin_title, overlap_cells, \
|
||||
perc_model_full, plot_lowpass2, plt_data_susept, plt_single_square_modl, plt_time_arrays, \
|
||||
remove_xticks, \
|
||||
remove_yticks, \
|
||||
save_visualization, set_same_ylim
|
||||
from threefish.core_calc_model import load_folder_name, resave_small_files
|
||||
from threefish.core_plot_labels import noise_name
|
||||
from threefish.core_plot_subplots import plot_lowpass2, plt_single_square_modl, plt_time_arrays
|
||||
from threefish.core_plot_suscept import perc_model_full, plt_data_susept
|
||||
from threefish.core_filenames import overlap_cells
|
||||
from threefish.core_load import save_visualization
|
||||
from threefish.core_reformat import get_flowchart_params, load_model_susept
|
||||
from threefish.core_calc_model import resave_small_files
|
||||
from threefish.core import find_folder_name
|
||||
from threefish.core_plot_labels import label_noise_name, nonlin_title, remove_xticks, remove_yticks, set_xlabel_arrow, \
|
||||
set_ylabel_arrow, title_find_cell_add, xlabel_xpos_y_modelanddata
|
||||
import itertools as it
|
||||
from threefish.utils0 import default_figsize
|
||||
from threefish.utils1_suscept import xpos_y_modelanddata
|
||||
from threefish.utils0 import join_x, join_y, set_clim_same, set_xlabel_arrow, set_ylabel_arrow
|
||||
from threefish.defaults import default_figsize, default_settings
|
||||
from threefish.core_plot_lims import join_x, join_y, set_clim_same, set_same_ylim
|
||||
|
||||
|
||||
#from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
@ -35,22 +35,10 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
contrasts=[0], noises_added=[''], D_extraction_method=['additiv_cv_adapt_factor_scaled'],
|
||||
internal_noise=['RAM'], external_noise=['RAM'], level_extraction=[''], receiver_contrast=[1],
|
||||
dendrids=[''], ref_types=[''], adapt_types=[''], c_noises=[0.1], c_signal=[0.9], cut_offs1=[300]): # ['eRAM']
|
||||
# plot_style()#['_RAMscaled']'_RAMscaled'
|
||||
|
||||
duration_noise = '_short',
|
||||
formula = 'code' ##'formula'
|
||||
# ,int(2 ** 16) int(2 ** 16), int(2 ** 15),
|
||||
stimulus_length = 1 # 20#550 # 30 # 15#45#0.5#1.5 15 45 100
|
||||
trials_nrs = [1] # [100, 500, 1000, 3000, 10000, 100000, 1000000] # 500
|
||||
stimulus_type = '_StimulusOrig_' # ,#
|
||||
# ,3]#, 3, 1, 1.5, 0.5, ] # ,1,1.5, 0.5] #[1,1.5, 0.5] # 1.5,0.5]3, 1,
|
||||
variant = 'sinz'
|
||||
mimick = 'no'
|
||||
cell_recording_save_name = ''
|
||||
trans = 1 # 5
|
||||
rep = 1000000 # 500000#0
|
||||
repeats = [20, rep] # 250000
|
||||
aa = 0
|
||||
good_data, remaining = overlap_cells()
|
||||
cells_all = [good_data[0]]
|
||||
|
||||
@ -64,8 +52,7 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
mins = []
|
||||
mats = []
|
||||
ims = []
|
||||
perc05 = []
|
||||
perc95 = []
|
||||
|
||||
iternames = [D_extraction_method, external_noise,
|
||||
internal_noise, powers, nffts, dendrids, cut_offs1, trials_nrs, c_signal,
|
||||
c_noises,
|
||||
@ -95,28 +82,16 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
|
||||
grid_data = gridspec.GridSpecFromSubplotSpec(1, 1, grid[0, 0],
|
||||
hspace=hs)
|
||||
|
||||
fr_print = False #True
|
||||
#ypos_x_modelanddata()
|
||||
fr_print = False
|
||||
nr = 1
|
||||
ax_data, stack_spikes_all, eod_frs = plt_data_susept(fig, grid_data, cells_all, cell_type='p-unit', width=width,
|
||||
cbar_label=True, fr_print=fr_print,
|
||||
eod_metrice=eod_metrice, nr=nr, amp_given=1, xlabel=False,
|
||||
lp=lp, title=True)
|
||||
for ax_external in ax_data:
|
||||
# ax.set_ylabel(F2_xlabel())
|
||||
# remove_xticks(ax)
|
||||
ax_external.set_xticks_delta(100)
|
||||
set_ylabel_arrow(ax_external, xpos=xpos_y_modelanddata(), ypos=0.87)
|
||||
|
||||
#embed()
|
||||
set_ylabel_arrow(ax_external, xpos=xlabel_xpos_y_modelanddata(), ypos=0.87)
|
||||
set_xlabel_arrow(ax_external, ypos=ypos_x_modelanddata())
|
||||
# ax.text(-0.42, 0.87, F2_xlabel(), ha='center', va='center',
|
||||
# transform=ax.transAxes, rotation = 90)
|
||||
# ax.text(1.66, 0.5, nonlin_title(), rotation=90, ha='center', va='center',
|
||||
# transform=ax.transAxes)
|
||||
|
||||
#ax_external.arrow_spines('lb')
|
||||
|
||||
#embed()
|
||||
#plt.show()
|
||||
@ -128,7 +103,7 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
cell = '2012-07-03-ak-invivo-1'
|
||||
print('cell' + str(cell))
|
||||
cells_given = [cell]
|
||||
save_name_rev = load_folder_name(
|
||||
save_name_rev = find_folder_name(
|
||||
'calc_model') + '/' + 'calc_RAM_model-2__nfft_whole_power_1_RAM_additiv_cv_adapt_factor_scaled_cNoise_0.1_cSig_0.9_cutoff1_300_cutoff2_300no_sinz_length1_TrialsStim_' + str(
|
||||
trial_nr) + '_a_fr_1__trans1s__TrialsNr_1_fft_o_forward_fft_i_forward_Hz_mV_revQuadrant_'
|
||||
# for trial in trials:#.009
|
||||
@ -164,7 +139,10 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
# Hier werde ich nun mit dem Fehler von 0.36 verfahren
|
||||
# das bedeutet aber das sich den Stimulus zwar mit 0.009 ins Modell reintue später für die
|
||||
# Susceptiblitätsberechnung sollte ich ihn aber um den Faktor 0.36 teilen
|
||||
bias_factor = 0.36
|
||||
|
||||
# oben habe ich einen bias factor weil die Zelle zu sensitiv gefittet ist, also passe ich das an dass die den
|
||||
# gleichen CV und feurrate hat, wie die Zelle in der Stimulation, deswegen ist dieser Bias faktor nur oben!
|
||||
bias_factors = [0.36, 0.36, 1, 1]#0.36
|
||||
save_names = [
|
||||
'calc_RAM_model-2__nfft_whole_power_1_afe_0.009_RAM_cutoff1_300_cutoff2_300no_sinz_length1_TrialsStim_11_a_fr_1__trans1s__TrialsNr_1_fft_o_forward_fft_i_forward_Hz_mV',
|
||||
'calc_RAM_model-2__nfft_whole_power_1_afe_0.009_RAM_cutoff1_300_cutoff2_300no_sinz_length1_TrialsStim_' + str(
|
||||
@ -187,8 +165,8 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
c = 2.5
|
||||
cs = ['$c=%.1f$' % c + '$\,\%$', '$c=0\,\%$']
|
||||
titles = ['Model\n$N=11$', 'Model\n' + '$N=10^6$',
|
||||
'Model\,(' + noise_name().lower() + ')' + '\n' + '$N=11$',
|
||||
'Model\,(' + noise_name().lower() + ')' + '\n' + '$N=10^6$'
|
||||
'Model\,(' + label_noise_name().lower() + ')' + '\n' + '$N=11$',
|
||||
'Model\,(' + label_noise_name().lower() + ')' + '\n' + '$N=10^6$'
|
||||
] #%#%s$' % (tr_name) + '\,million'
|
||||
#'Model\,('+noise_name().lower()+')' + '\n' + '$N=11$\n $c=1\,\%$',$N=%s $' % (tr_name) +'\,million'
|
||||
# 'Model\,('+noise_name().lower()+')' + '\n' + '$N=%s$' % (tr_name) + '\,million\n $c=1\,\%$ '
|
||||
@ -202,28 +180,28 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
embed()
|
||||
ax_model.append(ax_external)
|
||||
|
||||
save_name = load_folder_name('calc_model') + '/' + sav_name
|
||||
save_name = find_folder_name('calc_model') + '/' + sav_name
|
||||
|
||||
cell_add, cells_save = find_cell_add(cells_given)
|
||||
cell_add, cells_save = title_find_cell_add(cells_given)
|
||||
perc = 'perc'
|
||||
|
||||
path = save_name + '.pkl' # '../'+
|
||||
# stack = get_stack_one_quadrant(cell, cell_add, cells_save, path, save_name)
|
||||
# model = get_stack_one_quadrant(cell, cell_add, cells_save, path, save_name)
|
||||
|
||||
# full_matrix = create_full_matrix2(np.array(stack), np.array(stack_rev))
|
||||
# stack_final = get_axis_on_full_matrix(full_matrix, stack)
|
||||
# im = plt_RAM_perc(ax, perc, np.abs(stack))
|
||||
# full_matrix = create_full_matrix2(np.array(model), np.array(stack_rev))
|
||||
# stack_final = get_axis_on_full_matrix(full_matrix, model)
|
||||
# im = plt_RAM_perc(ax, perc, np.abs(model))
|
||||
|
||||
stack = load_model_susept(path, cells_save, save_name.split(r'/')[-1] + cell_add)
|
||||
model = load_model_susept(path, cells_save, save_name.split(r'/')[-1] + cell_add)
|
||||
|
||||
#embed()
|
||||
if len(stack) > 0:
|
||||
add_nonlin_title, cbar, fig, stack_plot, im = plt_single_square_modl(ax_external, cell, stack, perc,
|
||||
if len(model) > 0:
|
||||
add_nonlin_title, cbar, fig, stack_plot, im = plt_single_square_modl(ax_external, cell, model, perc,
|
||||
titles[s],
|
||||
width, eod_metrice=eod_metrice,
|
||||
titles_plot=True,
|
||||
resize=True,
|
||||
bias_factor=bias_factor,
|
||||
bias_factor=bias_factors[s],
|
||||
fr_print=fr_print, nr=nr)
|
||||
|
||||
# if s in [1,3,5]:
|
||||
@ -242,7 +220,7 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
if s in np.arange(col - 1, 100, col): # | (s == 0)
|
||||
remove_yticks(ax_external)
|
||||
else:
|
||||
set_ylabel_arrow(ax_external, xpos=xpos_y_modelanddata(), ypos=0.87)
|
||||
set_ylabel_arrow(ax_external, xpos=xlabel_xpos_y_modelanddata(), ypos=0.87)
|
||||
|
||||
if s >= row * col - col:
|
||||
set_xlabel_arrow(ax_external, ypos=ypos_x_modelanddata())
|
||||
@ -258,141 +236,8 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
#################################################
|
||||
# Flowcharts
|
||||
|
||||
var_types = ['', 'additiv_cv_adapt_factor_scaled'] #'additiv_cv_adapt_factor_scaled',
|
||||
##additiv_cv_adapt_factor_scaled
|
||||
a_fes = [c / 100, 0] #, 0.009
|
||||
eod_fe = [750, 750] #, 750
|
||||
ylim = [-0.5, 0.5]
|
||||
c_sigs = [0, 0.9] #, 0.9
|
||||
grid_left = [[], grid[1, 0]] #, grid[2, 0]
|
||||
ax_ams = []
|
||||
for g, grid_here in enumerate([grid[0, 2], grid[1, 2]]): #, grid[2, 0]
|
||||
grid_lowpass = gridspec.GridSpecFromSubplotSpec(4, 1,
|
||||
subplot_spec=grid_here, hspace=0.2,
|
||||
height_ratios=[1, 1, 1, 0.1])
|
||||
|
||||
models = resave_small_files("models_big_fit_d_right.csv", load_folder='calc_model_core')
|
||||
model_params = models[models['cell'] == '2012-07-03-ak-invivo-1'].iloc[0]
|
||||
cell = model_params.pop('cell') # .iloc[0]# Werte für das Paper nachschauen
|
||||
eod_fr = model_params['EODf'] # .iloc[0]
|
||||
deltat = model_params.pop("deltat") # .iloc[0]
|
||||
v_offset = model_params.pop("v_offset") # .iloc[0]
|
||||
eod_fr = stack.eod_fr.iloc[0]
|
||||
print(var_types[g] + ' a_fe ' + str(a_fes[g]))
|
||||
noise_final_c, spike_times, stimulus, stimulus_here, time, v_dent_output, v_mem_output, frame = get_flowchart_params(
|
||||
a_fes, a_fr, g, c_sigs[g], cell, deltat, eod_fr, model_params, stimulus_length, v_offset, var_types,
|
||||
eod_fe=eod_fe)
|
||||
|
||||
if (len(np.unique(frame.RAM_afe)) > 1) & (len(np.unique(frame.RAM_noise)) > 1):
|
||||
grid_lowpass2 = gridspec.GridSpecFromSubplotSpec(4, 1,
|
||||
subplot_spec=grid_here, height_ratios=[1, 1, 1, 0.1],
|
||||
hspace=0.05)
|
||||
|
||||
# if (np.unique(frame.RAM_afe) != 0):grid_left[g]
|
||||
|
||||
ax_external = plt_time_arrays('red', grid_lowpass2, 1, frame.RAM_afe * 100, time=time, nr=0)
|
||||
# if (np.unique(frame.RAM_noise) != 0):
|
||||
remove_xticks(ax_external)
|
||||
ax_intrinsic = plt_time_arrays('purple', grid_lowpass2, 1, frame.RAM_noise * 100, time=time, nr=1)
|
||||
ax_intrinsic.text(-0.6, 0.5, '$\%$', rotation=90, va='center', transform=ax_intrinsic.transAxes)
|
||||
ax_intrinsic.show_spines('l')
|
||||
ax_external.show_spines('l')
|
||||
# ax_ams.append(axt_p2)
|
||||
#color_timeseries = 'black'
|
||||
#axt_p2.set_xlabel('Time [ms]')
|
||||
#axt_p2.text(-0.6, 0.5, '$\%$', rotation=90, va='center', transform=axt_p2.transAxes)
|
||||
#ax_ams.append(axt_p2)
|
||||
vers = 'all'
|
||||
elif len(np.unique(frame.RAM_afe)) > 1:
|
||||
color_timeseries = 'red'
|
||||
nr_plot = 0
|
||||
print(str(g) + ' afevar ' + str(np.var(frame.RAM_afe)) + ' afenoise ' + str(np.var(frame.RAM_noise)))
|
||||
try:
|
||||
ax_external, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[nr_plot]], time,
|
||||
(frame.RAM_afe + frame.RAM_noise) * 100,
|
||||
deltat, eod_fr,
|
||||
color1=color_timeseries, lw=1, extract=False)
|
||||
except:
|
||||
print('add up thing')
|
||||
embed()
|
||||
ax_external.show_spines('l')
|
||||
|
||||
ax_intrinsic = plt.subplot(grid_lowpass[1])
|
||||
ax_intrinsic.show_spines('l')
|
||||
ax_intrinsic.axhline(0, color='black', lw=0.5)
|
||||
ax_intrinsic.axhline(0, color='purple', lw=0.5)
|
||||
|
||||
remove_xticks(ax_external)
|
||||
remove_xticks(ax_intrinsic)
|
||||
join_x([ax_intrinsic, ax_external])
|
||||
join_y([ax_intrinsic, ax_external])
|
||||
vers = 'first'
|
||||
elif len(np.unique(frame.RAM_noise)) > 1:
|
||||
color_timeseries = 'purple'
|
||||
nr_plot = 1
|
||||
print(str(g) + ' afevar ' + str(np.var(frame.RAM_afe)) + ' afenoise ' + str(np.var(frame.RAM_noise)))
|
||||
try:
|
||||
ax_intrinsic, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[nr_plot]], time,
|
||||
(frame.RAM_afe + frame.RAM_noise) * 100,
|
||||
deltat, eod_fr,
|
||||
color1=color_timeseries, lw=1, extract=False)
|
||||
except:
|
||||
print('add up thing')
|
||||
|
||||
embed()
|
||||
|
||||
ax_external = plt.subplot(grid_lowpass[0])
|
||||
ax_external.show_spines('l')
|
||||
ax_intrinsic.show_spines('l')
|
||||
|
||||
ax_external.axhline(0, color='black', lw=0.5)
|
||||
ax_external.axhline(0, color='red', lw=0.5)
|
||||
join_x([ax_intrinsic, ax_external])
|
||||
join_y([ax_intrinsic, ax_external])
|
||||
vers = 'second'
|
||||
ax_intrinsic.set_yticks_delta(6)
|
||||
ax_external.set_yticks_delta(6)
|
||||
ax_external.text(-0.6, 0.5, '$\%$', va='center', rotation=90, transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(-0.6, 0.5, '$\%$', va='center', rotation=90, transform=ax_intrinsic.transAxes)
|
||||
remove_xticks(ax_intrinsic)
|
||||
# if (len(np.unique(frame.RAM_afe)) > 1) & (len(np.unique(frame.RAM_noise)) > 1):
|
||||
ax_external.set_xlabel('')
|
||||
# remove_yticks(ax)
|
||||
ax_ams, ax_external = plt_model_flowcharts(a_fr, ax_external, c, cs, grid, model, stimulus_length)
|
||||
|
||||
ax_ams.append(ax_external)
|
||||
remove_xticks(ax_external)
|
||||
|
||||
ax_n, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[2]], time, noise_final_c, deltat, eod_fr,
|
||||
extract=False, color1='grey', lw=1)
|
||||
remove_yticks(ax_n)
|
||||
if g == 1:
|
||||
#ax_n.set_xlabel('Time [ms]', labelpad=-0.5)
|
||||
ax_n.text(0.5, xpos_y_modelanddata()*3, 'Time [ms]', transform = ax_n.transAxes, ha = 'center')
|
||||
else:
|
||||
remove_xticks(ax_n)
|
||||
ax_n.set_ylim(ylim)
|
||||
|
||||
if vers == 'first':
|
||||
ax_external.text(1, 1, 'RAM(' + cs[0] + ')', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_n.text(start_pos_modeldata(), 1.1, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
elif vers == 'second':
|
||||
ax_external.text(1, 1, 'RAM(' + cs[1] + ')', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(start_pos_modeldata(), 1.1, signal_component_name(), ha='right', color='purple',
|
||||
transform=ax_intrinsic.transAxes)
|
||||
ax_n.text(start_pos_modeldata(), 0.9, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
else:
|
||||
ax_n.text(start_pos_modeldata(), 0.9, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
ax_external.text(1, 1, 'RAM', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(start_pos_modeldata(), 1.1, signal_component_name(), ha='right', color='purple',
|
||||
transform=ax_intrinsic.transAxes)
|
||||
ax_external.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
ax_intrinsic.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
ax_n.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
#xtick_labelsize =
|
||||
#embed()
|
||||
set_same_ylim(ax_ams, up='up')
|
||||
|
||||
axes = np.concatenate([ax_data, ax_model])
|
||||
@ -419,6 +264,145 @@ def model_and_data2(eod_metrice=False, width=0.005, nffts=['whole'], powers=[1],
|
||||
save_visualization(pdf=True)
|
||||
|
||||
|
||||
def plt_model_flowcharts(a_fr, ax_external, c, cs, grid, stack, stimulus_length):
|
||||
var_types = ['', 'additiv_cv_adapt_factor_scaled'] # 'additiv_cv_adapt_factor_scaled',
|
||||
##additiv_cv_adapt_factor_scaled
|
||||
a_fes = [c / 100, 0] # , 0.009
|
||||
eod_fe = [750, 750] # , 750
|
||||
ylim = [-0.5, 0.5]
|
||||
c_sigs = [0, 0.9] # , 0.9
|
||||
grid_left = [[], grid[1, 0]] # , grid[2, 0]
|
||||
ax_ams = []
|
||||
for g, grid_here in enumerate([grid[0, 2], grid[1, 2]]): # , grid[2, 0]
|
||||
grid_lowpass = gridspec.GridSpecFromSubplotSpec(4, 1,
|
||||
subplot_spec=grid_here, hspace=0.2,
|
||||
height_ratios=[1, 1, 1, 0.1])
|
||||
|
||||
models = resave_small_files("models_big_fit_d_right.csv", load_folder='calc_model_core')
|
||||
model_params = models[models['cell'] == '2012-07-03-ak-invivo-1'].iloc[0]
|
||||
cell = model_params.pop('cell') # .iloc[0]# Werte für das Paper nachschauen
|
||||
eod_fr = model_params['EODf'] # .iloc[0]
|
||||
deltat = model_params.pop("deltat") # .iloc[0]
|
||||
v_offset = model_params.pop("v_offset") # .iloc[0]
|
||||
eod_fr = stack.eod_fr.iloc[0]
|
||||
print(var_types[g] + ' a_fe ' + str(a_fes[g]))
|
||||
noise_final_c, spike_times, stimulus, stimulus_here, time, v_dent_output, v_mem_output, frame = get_flowchart_params(
|
||||
a_fes, a_fr, g, c_sigs[g], cell, deltat, eod_fr, model_params, stimulus_length, v_offset, var_types,
|
||||
eod_fe=eod_fe)
|
||||
|
||||
if (len(np.unique(frame.RAM_afe)) > 1) & (len(np.unique(frame.RAM_noise)) > 1):
|
||||
grid_lowpass2 = gridspec.GridSpecFromSubplotSpec(4, 1,
|
||||
subplot_spec=grid_here, height_ratios=[1, 1, 1, 0.1],
|
||||
hspace=0.05)
|
||||
|
||||
# if (np.unique(frame.RAM_afe) != 0):grid_left[g]
|
||||
|
||||
ax_external = plt_time_arrays('red', grid_lowpass2, 1, frame.RAM_afe * 100, time=time, nr=0)
|
||||
# if (np.unique(frame.RAM_noise) != 0):
|
||||
remove_xticks(ax_external)
|
||||
ax_intrinsic = plt_time_arrays('purple', grid_lowpass2, 1, frame.RAM_noise * 100, time=time, nr=1)
|
||||
ax_intrinsic.text(-0.6, 0.5, '$\%$', rotation=90, va='center', transform=ax_intrinsic.transAxes)
|
||||
ax_intrinsic.show_spines('l')
|
||||
ax_external.show_spines('l')
|
||||
# ax_ams.append(axt_p2)
|
||||
# color_timeseries = 'black'
|
||||
# axt_p2.set_xlabel('Time [ms]')
|
||||
# axt_p2.text(-0.6, 0.5, '$\%$', rotation=90, va='center', transform=axt_p2.transAxes)
|
||||
# ax_ams.append(axt_p2)
|
||||
vers = 'all'
|
||||
elif len(np.unique(frame.RAM_afe)) > 1:
|
||||
color_timeseries = 'red'
|
||||
nr_plot = 0
|
||||
print(str(g) + ' afevar ' + str(np.var(frame.RAM_afe)) + ' afenoise ' + str(np.var(frame.RAM_noise)))
|
||||
try:
|
||||
ax_external, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[nr_plot]], time,
|
||||
(frame.RAM_afe + frame.RAM_noise) * 100,
|
||||
deltat, eod_fr,
|
||||
color1=color_timeseries, lw=1, extract=False)
|
||||
except:
|
||||
print('add up thing')
|
||||
embed()
|
||||
ax_external.show_spines('l')
|
||||
|
||||
ax_intrinsic = plt.subplot(grid_lowpass[1])
|
||||
ax_intrinsic.show_spines('l')
|
||||
ax_intrinsic.axhline(0, color='black', lw=0.5)
|
||||
ax_intrinsic.axhline(0, color='purple', lw=0.5)
|
||||
|
||||
remove_xticks(ax_external)
|
||||
remove_xticks(ax_intrinsic)
|
||||
join_x([ax_intrinsic, ax_external])
|
||||
join_y([ax_intrinsic, ax_external])
|
||||
vers = 'first'
|
||||
elif len(np.unique(frame.RAM_noise)) > 1:
|
||||
color_timeseries = 'purple'
|
||||
nr_plot = 1
|
||||
print(str(g) + ' afevar ' + str(np.var(frame.RAM_afe)) + ' afenoise ' + str(np.var(frame.RAM_noise)))
|
||||
try:
|
||||
ax_intrinsic, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[nr_plot]], time,
|
||||
(frame.RAM_afe + frame.RAM_noise) * 100,
|
||||
deltat, eod_fr,
|
||||
color1=color_timeseries, lw=1, extract=False)
|
||||
except:
|
||||
print('add up thing')
|
||||
|
||||
embed()
|
||||
|
||||
ax_external = plt.subplot(grid_lowpass[0])
|
||||
ax_external.show_spines('l')
|
||||
ax_intrinsic.show_spines('l')
|
||||
|
||||
ax_external.axhline(0, color='black', lw=0.5)
|
||||
ax_external.axhline(0, color='red', lw=0.5)
|
||||
join_x([ax_intrinsic, ax_external])
|
||||
join_y([ax_intrinsic, ax_external])
|
||||
vers = 'second'
|
||||
ax_intrinsic.set_yticks_delta(6)
|
||||
ax_external.set_yticks_delta(6)
|
||||
ax_external.text(-0.6, 0.5, '$\%$', va='center', rotation=90, transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(-0.6, 0.5, '$\%$', va='center', rotation=90, transform=ax_intrinsic.transAxes)
|
||||
remove_xticks(ax_intrinsic)
|
||||
# if (len(np.unique(frame.RAM_afe)) > 1) & (len(np.unique(frame.RAM_noise)) > 1):
|
||||
ax_external.set_xlabel('')
|
||||
# remove_yticks(ax)
|
||||
|
||||
ax_ams.append(ax_external)
|
||||
remove_xticks(ax_external)
|
||||
|
||||
ax_n, ff, pp, ff_am, pp_am = plot_lowpass2([grid_lowpass[2]], time, noise_final_c, deltat, eod_fr,
|
||||
extract=False, color1='grey', lw=1)
|
||||
remove_yticks(ax_n)
|
||||
if g == 1:
|
||||
# ax_n.set_xlabel('Time [ms]', labelpad=-0.5)
|
||||
ax_n.text(0.5, xlabel_xpos_y_modelanddata() * 3, 'Time [ms]', transform=ax_n.transAxes, ha='center')
|
||||
else:
|
||||
remove_xticks(ax_n)
|
||||
ax_n.set_ylim(ylim)
|
||||
|
||||
if vers == 'first':
|
||||
ax_external.text(1, 1, 'RAM(' + cs[0] + ')', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_n.text(start_pos_modeldata(), 1.1, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
elif vers == 'second':
|
||||
ax_external.text(1, 1, 'RAM(' + cs[1] + ')', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(start_pos_modeldata(), 1.1, signal_component_name(), ha='right', color='purple',
|
||||
transform=ax_intrinsic.transAxes)
|
||||
ax_n.text(start_pos_modeldata(), 0.9, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
else:
|
||||
ax_n.text(start_pos_modeldata(), 0.9, noise_component_name(), ha='right', color='gray',
|
||||
transform=ax_n.transAxes)
|
||||
ax_external.text(1, 1, 'RAM', ha='right', color='red', transform=ax_external.transAxes)
|
||||
ax_intrinsic.text(start_pos_modeldata(), 1.1, signal_component_name(), ha='right', color='purple',
|
||||
transform=ax_intrinsic.transAxes)
|
||||
ax_external.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
ax_intrinsic.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
ax_n.tick_params(axis='y', which='major', labelsize=8.4)
|
||||
# xtick_labelsize =
|
||||
# embed()
|
||||
return ax_ams, ax_external
|
||||
|
||||
|
||||
def start_pos_modeldata():
|
||||
return 1.03
|
||||
|
||||
|
BIN
model_full.pdf
BIN
model_full.pdf
Binary file not shown.
BIN
model_full.png
BIN
model_full.png
Binary file not shown.
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 83 KiB |
1063
model_full.py
1063
model_full.py
File diff suppressed because it is too large
Load Diff
BIN
motivation.pdf
BIN
motivation.pdf
Binary file not shown.
@ -1,14 +1,17 @@
|
||||
##from update_project import **
|
||||
import numpy as np
|
||||
|
||||
from threefish.utils0 import chose_mat_max_value, cr_spikes_mat, default_figsize, find_all_dir_cells, \
|
||||
plot_arrays_ROC_psd_single3, plot_shemes4, plt_coherences, save_visualization
|
||||
from threefish.core_calc_model import find_code_vs_not
|
||||
from threefish.core_cell_choice import find_all_dir_cells
|
||||
from threefish.core_reformat import chose_mat_max_value, load_b_public
|
||||
from threefish.core_plot_suscept import plt_coherences
|
||||
from threefish.defaults import default_figsize
|
||||
from threefish.core_time import cr_spikes_mat
|
||||
from threefish.core import find_code_vs_not
|
||||
import time
|
||||
from threefish.utils1_suscept import check_var_substract_method, chose_certain_group, circle_plot, colors_suscept_paper_dots, \
|
||||
extract_waves, load_cells_three, predefine_grouping_frame, restrict_cell_type, save_arrays_susept, title_motivation, \
|
||||
ws_nonlin_systems
|
||||
from threefish.utils0 import load_b_public
|
||||
from threefish.utils1_suscept import check_var_substract_method, chose_certain_group, circle_plot, extract_waves, load_cells_three, predefine_grouping_frame, restrict_cell_type, save_arrays_susept, ws_nonlin_systems
|
||||
from threefish.core_plot_labels import title_motivation
|
||||
from threefish.core_plot_subplots import colors_suscept_paper_dots, plot_arrays_ROC_psd_single3, plot_shemes4
|
||||
from threefish.core_load import save_visualization
|
||||
|
||||
#from matplotlib import gridspec as gridspec, gridspec, mlab as ml, pyplot as plt, ticker as ticker
|
||||
from matplotlib import pyplot as plt
|
||||
|
BIN
trialnr.pdf
BIN
trialnr.pdf
Binary file not shown.
17
trialnr.py
17
trialnr.py
@ -4,10 +4,13 @@ import numpy as np
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
from plotstyle import plot_style
|
||||
from threefish.utils0 import default_figsize, default_settings, find_cell_add, get_stack, load_model_susept, \
|
||||
overlap_cells, \
|
||||
save_visualization # utils0_project
|
||||
from threefish.core_calc_model import load_folder_name, resave_small_files
|
||||
from threefish.core_plot_labels import title_find_cell_add
|
||||
from threefish.defaults import default_figsize, default_settings
|
||||
from threefish.core_filenames import overlap_cells
|
||||
from threefish.core_load import save_visualization
|
||||
from threefish.core_reformat import get_stack, load_model_susept
|
||||
from threefish.core_calc_model import resave_small_files
|
||||
from threefish.core import find_folder_name
|
||||
from threefish.utils1_suscept import trial_nrs_ram_model
|
||||
import itertools as it
|
||||
|
||||
@ -89,7 +92,7 @@ def trialnr(nffts=['whole'], powers=[1], contrasts=[0], noises_added=[''], D_ext
|
||||
cell = '2012-07-03-ak-invivo-1'
|
||||
print('cell'+str(cell))
|
||||
cells_given = [cell]
|
||||
save_name_rev = load_folder_name(
|
||||
save_name_rev = find_folder_name(
|
||||
'calc_model') + '/' + 'calc_RAM_model-2__nfft_whole_power_1_RAM_additiv_cv_adapt_factor_scaled_cNoise_0.1_cSig_0.9_cutoff1_300_cutoff2_300no_sinz_length1_TrialsStim_' + str(
|
||||
trial_nr) + '_a_fr_1__trans1s__TrialsNr_1_fft_o_forward_fft_i_forward_Hz_mV_revQuadrant_'
|
||||
# for trial in trials:#.009
|
||||
@ -121,9 +124,9 @@ def trialnr(nffts=['whole'], powers=[1], contrasts=[0], noises_added=[''], D_ext
|
||||
|
||||
for s, sav_name in enumerate(save_names):
|
||||
|
||||
save_name = load_folder_name('calc_model') + '/' + sav_name
|
||||
save_name = find_folder_name('calc_model') + '/' + sav_name
|
||||
|
||||
cell_add, cells_save = find_cell_add(cells_given)
|
||||
cell_add, cells_save = title_find_cell_add(cells_given)
|
||||
perc = 'perc'
|
||||
|
||||
path = save_name + '.pkl' # '../'+
|
||||
|
@ -130,9 +130,9 @@ if cont_other_dir == False:
|
||||
embed()
|
||||
#print(new_dir+dir)
|
||||
#try:
|
||||
shutil.copy2("../suseptibility/" + dir, new_dir + directory)
|
||||
shutil.copy2("../suseptibility/" + directory,new_dir + directory)
|
||||
#print(new_dir + directory)
|
||||
#shutil.copy("../suseptibility/" + dir, new_dir + directory)
|
||||
#shutil.copy("../suseptibility/" + directory,new_dir + directory)
|
||||
#shutil.copyfile("../suseptibility/"+dir, new_dir+dir)
|
||||
#except:
|
||||
# print('shutil stuff')
|
||||
|
Loading…
Reference in New Issue
Block a user