for code refer to package threefish
This commit is contained in:
parent
be527bcb0d
commit
7a9bbd1fbd
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
all_cells.npy
Normal file
BIN
all_cells.npy
Normal file
Binary file not shown.
BIN
ampullary.pdf
BIN
ampullary.pdf
Binary file not shown.
@ -1,8 +1,9 @@
|
||||
from utils_suseptibility import ampullary_punit
|
||||
from utils_all import p_units_to_show, update_cell_names, load_folder_name
|
||||
#from utils_all import load_folder_name
|
||||
##from update_project import *ampullary_punit, p_units_to_show, update_cell_names#, load_folder_name
|
||||
#from threefish.utils0 import load_folder_name
|
||||
#from plt_RAM import plt_punit
|
||||
from IPython import embed
|
||||
|
||||
from threefish.utils0 import p_units_to_show, update_cell_names
|
||||
from threefish.utils1_suscept import ampullary_punit
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
Binary file not shown.
@ -1,8 +1,7 @@
|
||||
from utils_suseptibility import ampullary_punit, fr_name_rm
|
||||
from utils_all import p_units_to_show
|
||||
#from utils_all import load_folder_name
|
||||
from threefish.utils0 import p_units_to_show
|
||||
from threefish.utils1_suscept import ampullary_punit, fr_name_rm
|
||||
#from threefish.utils0 import load_folder_name
|
||||
#from plt_RAM import plt_punit
|
||||
from IPython import embed
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
Binary file not shown.
@ -1,8 +1,7 @@
|
||||
from utils_suseptibility import ampullary_punit, fr_name_rm
|
||||
from utils_all import p_units_to_show
|
||||
#from utils_all import load_folder_name
|
||||
from threefish.utils0 import p_units_to_show
|
||||
from threefish.utils1_suscept import ampullary_punit, fr_name_rm
|
||||
#from threefish.utils0 import load_folder_name
|
||||
#from plt_RAM import plt_punit
|
||||
from IPython import embed
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
Binary file not shown.
@ -1,15 +1,12 @@
|
||||
#sys.path.insert(0, '..')
|
||||
#from plt_RAM import plt_RAM_overview_nice
|
||||
#from utils_susept import
|
||||
#from threefish.utils1 import
|
||||
from IPython import embed
|
||||
from matplotlib import gridspec as gridspec, pyplot as plt
|
||||
import numpy as np
|
||||
from utils_all_down import default_settings
|
||||
from utils_suseptibility import colors_overview
|
||||
from utils_suseptibility import default_figsize, NLI_scorename2_small,pearson_label, exclude_nans_for_corr, kernel_scatter, \
|
||||
scatter_with_marginals_colorcoded, \
|
||||
version_final, basename_small, stimname_small
|
||||
from utils_all import update_cell_names, load_overview_susept, make_log_ticks, p_units_to_show, save_visualization, setting_overview_score
|
||||
from threefish.utils0 import colors_overview,default_figsize, update_cell_names, load_overview_susept, make_log_ticks, p_units_to_show, save_visualization, setting_overview_score
|
||||
from threefish.utils1_suscept import basename_small, exclude_nans_for_corr, kernel_scatter, pearson_label, \
|
||||
scatter_with_marginals_colorcoded, stimname_small, version_final, NLI_scorename2_small
|
||||
from scipy import stats
|
||||
try:
|
||||
from plotstyle import plot_style, spines_params
|
||||
|
BIN
flowchart.pdf
BIN
flowchart.pdf
Binary file not shown.
BIN
flowchart.png
BIN
flowchart.png
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
@ -1,12 +1,11 @@
|
||||
#from utils_suseptibility import default_settings
|
||||
#from utils0import default_settings
|
||||
#from plt_RAM import model_and_data_isi, model_cells
|
||||
from IPython import embed
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from plotstyle import plot_style, spines_params
|
||||
from utils_suseptibility import model_sheme_in_one
|
||||
from utils_all import default_figsize, model_sheme_split2, remove_yticks, save_visualization
|
||||
#from utils_all import default_settings, resave_small_files
|
||||
from threefish.utils0 import default_figsize, model_sheme_split2, save_visualization
|
||||
#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 matplotlib import pyplot as plt
|
||||
|
10010
gwn150Hz10s0.3.dat
Normal file
10010
gwn150Hz10s0.3.dat
Normal file
File diff suppressed because it is too large
Load Diff
2010
gwn150Hz10s0.3short.dat
Normal file
2010
gwn150Hz10s0.3short.dat
Normal file
File diff suppressed because it is too large
Load Diff
10010
gwn300Hz10s0.3.dat
Normal file
10010
gwn300Hz10s0.3.dat
Normal file
File diff suppressed because it is too large
Load Diff
10010
gwn300Hz10s0.3short.dat
Normal file
10010
gwn300Hz10s0.3short.dat
Normal file
File diff suppressed because it is too large
Load Diff
1000010
gwn300Hz50s0.3.dat
Normal file
1000010
gwn300Hz50s0.3.dat
Normal file
File diff suppressed because it is too large
Load Diff
10010
gwn50Hz10s0.3.dat
Normal file
10010
gwn50Hz10s0.3.dat
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,16 +1,25 @@
|
||||
#from utils_suseptibility import default_settings
|
||||
#from plt_RAM import model_and_data_isi, model_cells
|
||||
##from update_project import **#model_and_data
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
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_folder_name, load_model_susept, \
|
||||
noise_name, overlap_cells, \
|
||||
plot_lowpass2, plt_time_arrays, \
|
||||
remove_xticks, \
|
||||
remove_yticks, \
|
||||
resave_small_files, \
|
||||
save_visualization, set_same_ylim
|
||||
import itertools as it
|
||||
from threefish.utils0 import default_figsize
|
||||
from threefish.utils1_suscept import nonlin_title, perc_model_full, plt_data_susept, plt_single_square_modl, \
|
||||
xpos_y_modelanddata
|
||||
from threefish.utils0 import join_x, join_y, set_clim_same, set_xlabel_arrow, set_ylabel_arrow
|
||||
|
||||
#from utils_suseptibility import model_and_data, remove_yticks
|
||||
#from utils_suseptibility import *
|
||||
#from utils_susept import nonlin_title, plt_data_susept, plt_single_square_modl, set_clim_same_here, set_xlabel_arrow, \
|
||||
# set_ylabel_arrow, \
|
||||
# xpos_y_modelanddata
|
||||
|
||||
#from utils_all import default_settings, find_cell_add, get_flowchart_params, load_folder_name, load_model_susept, \
|
||||
# overlap_cells, \
|
||||
# plot_lowpass2, plt_time_arrays, remove_xticks, remove_yticks, resave_small_files, save_visualization, set_same_ylim
|
||||
from utils_suseptibility import *#model_and_data
|
||||
|
||||
#from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
|
||||
@ -323,6 +332,7 @@ def model_and_data2(eod_metrice = False, width=0.005, nffts=['whole'], powers=[1
|
||||
color1=color_timeseries, lw=1, extract=False)
|
||||
except:
|
||||
print('add up thing')
|
||||
|
||||
embed()
|
||||
|
||||
ax_external = plt.subplot(grid_lowpass[0])
|
||||
|
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: 96 KiB After Width: | Height: | Size: 97 KiB |
@ -1,4 +1,29 @@
|
||||
from utils_suseptibility import *
|
||||
##from update_project import **
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from IPython import embed
|
||||
from matplotlib import gridspec, pyplot as plt
|
||||
import matplotlib.mlab as ml
|
||||
from scipy.ndimage import gaussian_filter
|
||||
|
||||
from threefish.utils0 import find_code_vs_not, load_folder_name
|
||||
from plotstyle import plot_style
|
||||
from threefish.utils0 import resave_small_files, ISI_frequency, colorbar_outside, cr_spikes_mat, create_stimulus_SAM, default_figsize, \
|
||||
eod_fish_r_generation, extract_am, \
|
||||
find_base_fr, find_base_fr2, plt_RAM_perc, \
|
||||
remove_xticks, remove_yticks, save_visualization, simulate, time
|
||||
from threefish.utils1_suscept import all_damping_variants, calc_ps, check_var_substract_method, chose_certain_group, \
|
||||
colors_suscept_paper_dots, convert_csv_str_to_float, create_full_matrix2, default_model0, deltaf1_label, \
|
||||
deltaf2_label, deltat_choice, diagonal_points, diff_label, exclude_file_name_short, \
|
||||
extract_waves, fbasename_small, find_all_dir_cells, gaussian_intro, get_arrays_for_three, get_axis_on_full_matrix, \
|
||||
get_cutoffs_nr, get_file_names_exclude, get_mat_susept, get_phaseshifts, get_psds_ROC, labels_didactic2, \
|
||||
load_cells_three, log_calc_psd, nonlin_title, outputmodel, perc_model_full, plt_model_big, \
|
||||
plt_peaks_several, plt_psds_ROC, predefine_grouping_frame, rescale_colorbar_and_values, restrict_cell_type, \
|
||||
save_arrays_susept, sum_label, title_motivation, \
|
||||
two_deltaf1_label, two_deltaf2_label, version_final
|
||||
from threefish.utils0 import eod_fish_e_generation, join_y, load_b_public, set_clim_same, set_xlabel_arrow, set_ylabel_arrow, chose_mat_max_value
|
||||
from threefish.utils1_suscept import load_data_susept, restrict_punits #test_spikes_clusters,
|
||||
|
||||
|
||||
def model_full(c1=10, mult_type='_multsorted2_', devs=['05'], end='all', chose_score='mean_nrs',
|
||||
detections=['MeanTrialsIndexPhaseSort'], sorted_on='LocalReconst0.2NormAm', dfs = ['m1', 'm2']):
|
||||
@ -285,7 +310,8 @@ def plt_model_full_model(axp, min=0.2, cells=[], a_f2 = 0.1, perc = 0.05, alpha
|
||||
base_cut, mat_base = find_base_fr(spike_adapted, deltat, stimulus_length, time_array)
|
||||
fr = np.mean(base_cut)
|
||||
frate, isis_diff = ISI_frequency(time_array, spike_adapted[0], fill=0.0)
|
||||
isi = np.diff(spike_adapted[0])
|
||||
isi = (
|
||||
np.diff(spike_adapted[0]))
|
||||
cv0 = np.std(isi) / np.mean(isi)
|
||||
cv1 = np.std(frate) / np.mean(frate)
|
||||
|
||||
@ -445,7 +471,9 @@ def plt_model_full_model2(grid0, reshuffled='reshuffled', af_2 = 0.1, dev=0.0005
|
||||
fish_jammer='Alepto', markers = [], clip_on = True,
|
||||
ms = 14, us_name='', dev_spikes='original', log =''):
|
||||
plot_style()
|
||||
model_cells = pd.read_csv(load_folder_name('calc_model_core') + "/models_big_fit_d_right.csv")
|
||||
#model_cells = pd.read_csv(load_folder_name('calc_model_core') + "/models_big_fit_d_right.csv")
|
||||
model_cells = resave_small_files("models_big_fit_d_right.csv", load_folder='calc_model_core', index_col = True)
|
||||
#embed()
|
||||
|
||||
if len(cells) < 1:
|
||||
cells = len(model_cells)
|
||||
@ -465,6 +493,7 @@ def plt_model_full_model2(grid0, reshuffled='reshuffled', af_2 = 0.1, dev=0.0005
|
||||
trials_nr = array_len[g]
|
||||
except:
|
||||
print('array nr something')
|
||||
|
||||
embed()
|
||||
|
||||
for cell_here in cells:
|
||||
|
File diff suppressed because it is too large
Load Diff
BIN
motivation.pdf
BIN
motivation.pdf
Binary file not shown.
@ -1,21 +1,16 @@
|
||||
#from matplotlib import gridspec as gridspec, pyplot as plt
|
||||
|
||||
#from plotstyle import plot_style
|
||||
#from utils_all import chose_mat_max_value, default_settings, find_code_vs_not, save_visualization
|
||||
#from utils_susept import check_var_substract_method, chose_certain_group, divergence_title_add_on, extract_waves, \
|
||||
# find_all_dir_cells, \
|
||||
# load_b_public, \
|
||||
# load_cells_three, \
|
||||
# plot_arrays_ROC_psd_single3, plot_shemes4, plt_coherences, predefine_grouping_frame, \
|
||||
# restrict_cell_type, save_arrays_susept
|
||||
from utils_suseptibility import *
|
||||
|
||||
|
||||
#sys.path.insert(0, '..')
|
||||
#from utils_suseptibility import motivation_small
|
||||
|
||||
#from utils import divergence_title_add_on,chose_certain_group,predefine_grouping_frame,check_nix_fish,find_all_dir_cells,load_cells_three,restrict_cell_type,plot_shemes2,plot_arrays_ROC_psd_single
|
||||
|
||||
##from update_project import **
|
||||
import numpy as np
|
||||
from matplotlib import gridspec, pyplot as plt
|
||||
from scipy.ndimage import gaussian_filter
|
||||
|
||||
from plotstyle import plot_style
|
||||
from threefish.utils0 import chose_mat_max_value, cr_spikes_mat, default_figsize, find_code_vs_not, save_visualization
|
||||
import time
|
||||
from threefish.utils1_suscept import check_var_substract_method, chose_certain_group, circle_plot, colors_suscept_paper_dots, \
|
||||
extract_waves, find_all_dir_cells, load_cells_three, plot_arrays_ROC_psd_single3, plot_shemes4, \
|
||||
plt_coherences, predefine_grouping_frame, restrict_cell_type, save_arrays_susept, title_motivation, \
|
||||
ws_nonlin_systems
|
||||
from threefish.utils0 import load_b_public
|
||||
|
||||
|
||||
def motivation_all_small(dev_desired = '1', ylim=[-1.25, 1.25], c1=10, dfs=['m1', 'm2'], mult_type='_multsorted2_', top=0.94, devs=['2'],
|
||||
|
Binary file not shown.
@ -1,371 +0,0 @@
|
||||
#from matplotlib import gridspec as gridspec, pyplot as plt
|
||||
|
||||
#from plotstyle import plot_style
|
||||
#from utils_all import chose_mat_max_value, default_settings, find_code_vs_not, save_visualization
|
||||
#from utils_susept import check_var_substract_method, chose_certain_group, divergence_title_add_on, extract_waves, \
|
||||
# find_all_dir_cells, \
|
||||
# load_b_public, \
|
||||
# load_cells_three, \
|
||||
# plot_arrays_ROC_psd_single3, plot_shemes4, plt_coherences, predefine_grouping_frame, \
|
||||
# restrict_cell_type, save_arrays_susept
|
||||
from utils_suseptibility import *
|
||||
|
||||
|
||||
#sys.path.insert(0, '..')
|
||||
#from utils_suseptibility import motivation_small
|
||||
|
||||
#from utils import divergence_title_add_on,chose_certain_group,predefine_grouping_frame,check_nix_fish,find_all_dir_cells,load_cells_three,restrict_cell_type,plot_shemes2,plot_arrays_ROC_psd_single
|
||||
|
||||
|
||||
|
||||
def motivation_all_small_stim(dev_desired = '1',ylim=[-1.25, 1.25], c1=10, dfs=['m1', 'm2'], mult_type='_multsorted2_', top=0.94, devs=['2'],
|
||||
figsize=None, redo=False, save=True, end='0', cut_matrix='malefemale', chose_score='mean_nrs',
|
||||
a_fr=1, restrict='modulation', adapt='adaptoffsetallall2', step=str(30),
|
||||
detections=['AllTrialsIndex'], variant='no', sorted_on='LocalReconst0.2Norm'):
|
||||
autodefines = [
|
||||
'triangle_diagonal_fr'] # ['triangle_fr', 'triangle_diagonal_fr', 'triangle_df2_fr','triangle_df2_eodf''triangle_df1_eodf', ] # ,'triangle_df2_fr''triangle_df1_fr','_triangle_diagonal__fr',]
|
||||
cells = ['2021-08-03-ac-invivo-1'] ##'2021-08-03-ad-invivo-1',,[10, ][5 ]
|
||||
c1s = [10] # 1, 10,
|
||||
c2s = [10]
|
||||
|
||||
plot_style()
|
||||
default_figsize(column=2, length=3.3) #6.7 ts=12, ls=12, fs=12
|
||||
show = True
|
||||
DF2_desired = [0.8]
|
||||
DF1_desired = [0.87]
|
||||
|
||||
DF2_desired = [-0.23]
|
||||
DF1_desired = [0.94]
|
||||
|
||||
# mean_type = '_MeanTrialsIndexPhaseSort_Min0.25sExcluded_'
|
||||
extract = ''
|
||||
datasets, data_dir = find_all_dir_cells()
|
||||
cells = ['2022-01-28-ah-invivo-1'] # , '2022-01-28-af-invivo-1', '2022-01-28-ab-invivo-1',
|
||||
# '2022-01-27-ab-invivo-1', ] # ,'2022-01-28-ah-invivo-1', '2022-01-28-af-invivo-1', ]
|
||||
append_others = 'apend_others' # '#'apend_others'#'apend_others'#'apend_others'##'apend_others'
|
||||
autodefine = '_DFdesired_'
|
||||
autodefine = 'triangle_diagonal_fr' # ['triangle_fr', 'triangle_diagonal_fr', 'triangle_df2_fr','triangle_df2_eodf''triangle_df1_eodf', ] # ,'triangle_df2_fr''triangle_df1_fr','_triangle_diagonal__fr',]
|
||||
DF2_desired = [-33]
|
||||
DF1_desired = [133]
|
||||
autodefine = '_dfchosen_closest_'
|
||||
autodefine = '_dfchosen_closest_first_'
|
||||
cells = ['2021-08-03-ac-invivo-1'] ##'2021-08-03-ad-invivo-1',,[10, ][5 ]
|
||||
# c1s = [10] # 1, 10,
|
||||
# c2s = [10]
|
||||
minsetting = 'Min0.25sExcluded'
|
||||
c2 = 10
|
||||
|
||||
# detections = ['MeanTrialsIndexPhaseSort'] # ['AllTrialsIndex'] # ,'MeanTrialsIndexPhaseSort''DetectionAnalysis''_MeanTrialsPhaseSort'
|
||||
# detections = ['AllTrialsIndex'] # ['_MeanTrialsIndexPhaseSort_Min0.25sExcluded_extended_eod_loc_synch']
|
||||
|
||||
extend_trials = '' # 'extended'#''#'extended'#''#'extended'#''#'extended'#''#'extended'#''#'extended'# ok kein Plan was das hier ist
|
||||
# phase_sorting = ''#'PhaseSort'
|
||||
eodftype = '_psdEOD_'
|
||||
concat = '' # 'TrialsConcat'
|
||||
|
||||
indices = ['_allindices_']
|
||||
chirps = [
|
||||
''] # '_ChirpsDelete3_',,'_ChirpsDelete3_'','','',''#'_ChirpsDelete3_'#''#'_ChirpsDelete3_'#'#'_ChirpsDelete2_'#''#'_ChirpsDelete_'#''#'_ChirpsDelete_'#''#'_ChirpsDelete_'#''#'_ChirpsCache_'
|
||||
extract = '' # '_globalmax_'
|
||||
devs_savename = ['original', '05'] # ['05']#####################
|
||||
|
||||
# control = pd.read_pickle(
|
||||
# load_folder_name(
|
||||
# 'calc_model') + '/modell_all_cell_no_sinz3_afe0.1__afr1__afj0.1__length1.5_adaptoffsetallall2___stepefish' + step + 'Hz_ratecorrrisidual35__modelbigfit_nfft4096.pkl')
|
||||
|
||||
if len(cells) < 1:
|
||||
data_dir, cells = load_cells_three(end, data_dir=data_dir, datasets=datasets)
|
||||
cells, p_units_cells, pyramidals = restrict_cell_type(cells, 'p-units')
|
||||
|
||||
# default_settings(fs=8)
|
||||
|
||||
start = 'min' #
|
||||
cells = ['2021-08-03-ac-invivo-1']
|
||||
tag_cells = []
|
||||
for c, cell in enumerate(cells):
|
||||
counter_pic = 0
|
||||
contrasts = [c2]
|
||||
tag_cell = []
|
||||
for c, contrast in enumerate(contrasts):
|
||||
contrast_small = 'c2'
|
||||
contrast_big = 'c1'
|
||||
contrasts1 = [c1]
|
||||
for contrast1 in contrasts1:
|
||||
for devname_orig in devs:
|
||||
datapoints = [1000]
|
||||
for d in datapoints:
|
||||
################################
|
||||
# prepare DF1 desired
|
||||
|
||||
# chose_score = 'auci02_012-auci_base_01'
|
||||
|
||||
# hier muss das halt stimmen mit der auswahl
|
||||
# hier wollen wir eigntlich kein autodefine
|
||||
# sondern wir wollen so ein diagonal ding haben
|
||||
|
||||
extra_f_calculatoin = False
|
||||
if extra_f_calculatoin:
|
||||
divergnce, fr, pivot_chosen, max_val, max_x, max_y, mult, DF1_desired, DF2_desired, min_y, min_x, min_val, diff_cut = chose_mat_max_value(
|
||||
DF1_desired, DF2_desired, '', mult_type, eodftype, indices, cell, contrast_small,
|
||||
contrast_big, contrast1, dfs, start, devname_orig, contrast, autodefine=autodefine,
|
||||
cut_matrix='cut', chose_score=chose_score) # chose_score = 'auci02_012-auci_base_01'
|
||||
DF1_desired = [1.2]#DF1_desired # [::-1]
|
||||
DF2_desired = [0.95]#DF2_desired # [::-1]
|
||||
#embed()
|
||||
|
||||
#######################################
|
||||
# ROC part
|
||||
# fr, celltype = get_fr_from_info(cell, data_dir[c])
|
||||
|
||||
version_comp, subfolder, mod_name_slash, mod_name, subfolder_path = find_code_vs_not()
|
||||
b = load_b_public(c, cell, data_dir)
|
||||
|
||||
mt_sorted = predefine_grouping_frame(b, eodftype=eodftype, cell_name=cell)
|
||||
counter_waves = 0
|
||||
|
||||
mt_sorted = mt_sorted[(mt_sorted['c2'] == c2) & (mt_sorted['c1'] == c1)]
|
||||
for gg in range(len(DF1_desired)):
|
||||
|
||||
|
||||
# try:
|
||||
t3 = time.time()
|
||||
# except:
|
||||
# print('time thing')
|
||||
# embed()
|
||||
ax_w = []
|
||||
|
||||
###################
|
||||
# all trials in one
|
||||
grouped = mt_sorted.groupby(
|
||||
['c1', 'c2', 'm1, m2'],
|
||||
as_index=False)
|
||||
# try:
|
||||
grouped_mean = chose_certain_group(DF1_desired[gg],
|
||||
DF2_desired[gg], grouped,
|
||||
several=True, emb=False,
|
||||
concat=True)
|
||||
# except:
|
||||
# print('grouped thing')
|
||||
# embed()
|
||||
###################
|
||||
# groups sorted by repro tag
|
||||
# todo: evnetuell die tuples gleich hier umspeichern vom csv ''
|
||||
|
||||
grouped = mt_sorted.groupby(
|
||||
['c1', 'c2', 'm1, m2', 'repro_tag_id'],
|
||||
as_index=False)
|
||||
grouped_orig = chose_certain_group(DF1_desired[gg],
|
||||
DF2_desired[gg],
|
||||
grouped,
|
||||
several=True)
|
||||
gr_trials = len(grouped_orig)
|
||||
###################
|
||||
|
||||
groups_variants = [grouped_mean]
|
||||
group_mean = [grouped_orig[0][0], grouped_mean]
|
||||
|
||||
for d, detection in enumerate(detections):
|
||||
mean_type = '_' + detection # + '_' + minsetting + '_' + extend_trials + concat
|
||||
|
||||
##############################################################
|
||||
# load plotting arrays
|
||||
arrays, arrays_original, spikes_pure = save_arrays_susept(
|
||||
data_dir, cell, c, chirps, devs, extract, group_mean, mean_type, plot_group=0,
|
||||
rocextra=False, sorted_on=sorted_on, dev_desired = dev_desired)
|
||||
####################################################
|
||||
|
||||
####################################################
|
||||
# hier checken wir ob für diesen einen Punkt das funkioniert mit der standardabweichung
|
||||
|
||||
try:
|
||||
check_var_substract_method(spikes_pure)
|
||||
except:
|
||||
print('var checking not possible')
|
||||
# fig = plt.figure()
|
||||
# grid = gridspec.GridSpec(2, 1, wspace=0.7, left=0.05, top=0.95, bottom=0.15,
|
||||
# right=0.98)
|
||||
if figsize:
|
||||
fig = plt.figure(figsize=figsize)
|
||||
else:
|
||||
fig = plt.figure()
|
||||
grid = gridspec.GridSpec(1, 1, wspace=0.7, hspace=0.35, left=0.055, top=top,
|
||||
bottom=0.15,
|
||||
right=0.935) # height_ratios=[1, 2], height_ratios = [1,6]bottom=0.25, top=0.8,
|
||||
hr = [1, 0.35, 1.2, 0, 3, ] # 1
|
||||
##########################################################################
|
||||
# several coherence plot
|
||||
|
||||
# frame_psd = pd.read_pickle(load_folder_name('calc_RAM')+'/noise_data11_nfft1sec_original__StimPreSaved4__first__CutatBeginning_0.05_s_NeurDelay_0.005_s_2021-08-03-ab-invivo-1.pkl')
|
||||
# frame_psd = pd.read_pickle(load_folder_name('calc_RAM') + '/noise_data11_nfft1sec_original__StimPreSaved4__first__CutatBeginning_0.05_s_NeurDelay_0.005_s_2021-08-03-ab-invivo-1.pkl')
|
||||
|
||||
coh = False
|
||||
if coh:
|
||||
ax_w, d, data_dir, devs = plt_coherences(ax_w, d, devs, grid)
|
||||
|
||||
# ax_cohs = plt.subplot(grid[0,1])
|
||||
|
||||
##########################################################################
|
||||
# part with the power spectra
|
||||
grid0 = gridspec.GridSpecFromSubplotSpec(5, 4, wspace=0.15, hspace=0.35,
|
||||
subplot_spec=grid[:, :],
|
||||
height_ratios=hr)
|
||||
|
||||
xlim = [0, 100]
|
||||
###########################################
|
||||
stimulus_length = 0.3
|
||||
deltat = 1 / 40000
|
||||
eodf = np.mean(group_mean[1].eodf)
|
||||
eod_fr = eodf
|
||||
|
||||
a_fr = 1
|
||||
|
||||
eod_fe = eodf + np.mean(
|
||||
group_mean[1].DF2) # data.eodf.iloc[0] + 10 # cell_model.eode.iloc[0]
|
||||
a_fe = group_mean[0][1] / 100
|
||||
eod_fj = eodf + np.mean(
|
||||
group_mean[1].DF1) # data.eodf.iloc[0] + 50 # cell_model.eodj.iloc[0]
|
||||
a_fj = group_mean[0][0] / 100
|
||||
variant_cell = 'no' # 'receiver_emitter_jammer'
|
||||
print('f0' + str(eod_fr))
|
||||
print('f1'+str(eod_fe))
|
||||
print('f2' + str(eod_fj))
|
||||
eod_fish_j, time_array, time_fish_r, eod_fish_r, time_fish_e, eod_fish_e, time_fish_sam, eod_fish_sam, stimulus_am, stimulus_sam = extract_waves(
|
||||
variant_cell, '',
|
||||
stimulus_length, deltat, eod_fr, a_fr, a_fe, [eod_fe], 0, eod_fj, a_fj)
|
||||
|
||||
jammer_name = 'female'
|
||||
cocktail_names = False
|
||||
if cocktail_names:
|
||||
titles = ['receiver ',
|
||||
'+' + 'intruder ',
|
||||
'+' + jammer_name,
|
||||
|
||||
'+' + jammer_name + '+intruder',
|
||||
[]] ##'receiver + ' + 'receiver + receiver
|
||||
else:
|
||||
titles = title_motivation()
|
||||
gs = [0, 1, 2, 3, 4]
|
||||
waves_presents = [['receiver', '', '', 'all'],
|
||||
['receiver', 'emitter', '', 'all'],
|
||||
['receiver', '', 'jammer', 'all'],
|
||||
|
||||
['receiver', 'emitter', 'jammer', 'all'],
|
||||
] # ['', '', '', ''],['receiver', '', '', 'all'],
|
||||
# ['receiver', '', 'jammer', 'all'],
|
||||
# ['receiver', 'emitter', '', 'all'],'receiver', 'emitter', 'jammer',
|
||||
symbols = [''] # '$+$', '$-$', '$-$', '$=$',
|
||||
symbols = ['', '', '', '', '']
|
||||
|
||||
time_array = time_array * 1000
|
||||
|
||||
color01, color012, color01_2, color02, color0_burst, color0 = colors_suscept_paper_dots()
|
||||
colors_am = ['black', 'black', 'black', 'black'] # color01, color02, color012]
|
||||
extracted = [False, True, True, True]
|
||||
extracted2 = [False, False, False, False]
|
||||
for i in range(len(waves_presents)):
|
||||
ax = plot_shemes4(eod_fish_r, eod_fish_e, eod_fish_j, grid0, time_array,
|
||||
g=gs[i], title_top=True, eod_fr=eod_fr,
|
||||
waves_present=waves_presents[i], ylim=ylim,
|
||||
xlim=xlim, color_am=colors_am[i],
|
||||
color_am2 = color01_2, extracted=extracted[i], extracted2=extracted2[i],
|
||||
title=titles[i]) # 'intruder','receiver'#jammer_name
|
||||
|
||||
ax_w.append(ax)
|
||||
if ax != []:
|
||||
ax.text(1.1, 0.45, symbols[i], fontsize=35, transform=ax.transAxes)
|
||||
bar = False
|
||||
if bar:
|
||||
if i == 0:
|
||||
ax.plot([0, 20], [ylim[0] + 0.01, ylim[0] + 0.01], color='black')
|
||||
ax.text(0, -0.16, '20 ms', va='center', fontsize=10,
|
||||
transform=ax.transAxes)
|
||||
|
||||
printing = True
|
||||
if printing:
|
||||
print(time.time() - t3)
|
||||
|
||||
|
||||
|
||||
##########################################
|
||||
# spike response
|
||||
array_chosen = 1
|
||||
if d == 0: #
|
||||
|
||||
#embed()
|
||||
|
||||
frs = []
|
||||
for i in range(len(spikes_pure['base_0'])):
|
||||
#duration = spikes_pure['base_0'][i][-1] / 1000
|
||||
duration = 0.5
|
||||
fr = len(spikes_pure['base_0'][i])/duration
|
||||
frs.append(fr)
|
||||
fr = np.mean(frs)
|
||||
#embed()
|
||||
|
||||
base_several = False
|
||||
if base_several:
|
||||
spikes_new = []
|
||||
for i in range(len(spikes_pure['base_0'])):
|
||||
duration = 100
|
||||
duration_full = 101#501
|
||||
dur = np.arange(0, duration_full, duration)
|
||||
for d_nr in range(len(dur) - 1):
|
||||
#embed()
|
||||
spikes_new.append(np.array(spikes_pure['base_0'][i][
|
||||
(spikes_pure['base_0'][i] > dur[d_nr]) & (
|
||||
spikes_pure['base_0'][i] < dur[
|
||||
d_nr + 1])])/1000-dur[d_nr]/1000)
|
||||
# spikes_pure['base_0'] = spikes_new
|
||||
|
||||
sampling_rate = 1/np.diff(time_array)
|
||||
sampling_rate = int(sampling_rate[0]*1000)
|
||||
spikes_mats = []
|
||||
smoothed05 = []
|
||||
for i in range(len(spikes_new)):
|
||||
spikes_mat = cr_spikes_mat(spikes_new[i], sampling_rate, int(sampling_rate*duration/1000))
|
||||
spikes_mats.append(spikes_mat)
|
||||
smoothed05.append(gaussian_filter(spikes_mat, sigma=(float(dev_desired)/1000) * sampling_rate))
|
||||
smoothed_base = np.mean(smoothed05, axis=0)
|
||||
mat_base = np.mean(spikes_mats, axis=0)
|
||||
else:
|
||||
smoothed_base = arrays[0][0]
|
||||
mat_base = arrays_original[0][0]
|
||||
#embed()#arrays[0]v
|
||||
fr_isi, ax_ps, ax_as = plot_arrays_ROC_psd_single4([[smoothed_base], arrays[2], arrays[1], arrays[3]],
|
||||
[[smoothed_base], arrays[2], arrays[1], arrays[3]],
|
||||
[[mat_base], arrays_original[2], arrays_original[1],
|
||||
arrays_original[3]], spikes_pure, cell, grid0, mean_type,
|
||||
group_mean, xlim=xlim, row=1 + d * 3,
|
||||
array_chosen=array_chosen,
|
||||
color0_burst=color0_burst, color01=color01, color02=color02,ylim_log=(-15, 3),
|
||||
color012=color012,color012_minus = color01_2,color0=color0)
|
||||
|
||||
##########################################################################
|
||||
|
||||
individual_tag = 'DF1' + str(DF1_desired[gg]) + 'DF2' + str(
|
||||
DF2_desired[gg]) + cell + '_c1_' + str(c1) + '_c2_' + str(c2) + mean_type
|
||||
|
||||
# save_all(individual_tag, show, counter_contrast=0, savename='')
|
||||
# print('individual_tag')
|
||||
|
||||
axes = []
|
||||
axes.append(ax_w)
|
||||
# axes.extend(np.transpose(ax_as))
|
||||
# axes.append(np.transpose(ax_ps))
|
||||
# np.transpose(axes)
|
||||
|
||||
#fig.tag(ax_w[0:3], xoffs=-2.3, yoffs=1.7)
|
||||
#fig.tag(ax_w[3::], xoffs=-1.9, yoffs=1.4)
|
||||
fig.tag(ax_w, xoffs=-1.9, yoffs=1.4)
|
||||
# ax_w, np.transpose(ax_as), ax_ps
|
||||
if save:
|
||||
save_visualization(individual_tag=individual_tag, show=show, pdf=True)
|
||||
# fig = plt.gcf()
|
||||
# fig.savefig
|
||||
# plt.show()
|
||||
|
||||
|
||||
#if __name__ == '__main__':#2.5
|
||||
# motivation_all_small_stim(dev_desired = '1', c1=10, mult_type='_multsorted2_', devs=['05'], redo=True, save=True, end='all',
|
||||
# cut_matrix='malefemale', chose_score='mean_nrs', restrict='modulation_no_classes', step='50',
|
||||
# detections=['MeanTrialsIndexPhaseSort'], sorted_on='LocalReconst0.2NormAm')#
|
BIN
trialnr.pdf
BIN
trialnr.pdf
Binary file not shown.
32
trialnr.py
32
trialnr.py
@ -1,18 +1,17 @@
|
||||
#from utils_suseptibility import default_settings
|
||||
#from plt_RAM import model_and_data_isi, model_cells
|
||||
import os
|
||||
|
||||
#from utils_suseptibility import model_and_data, remove_yticks
|
||||
#from utils_suseptibility import *
|
||||
#from utils_susept import nonlin_title, plt_data_susept, plt_single_square_modl, set_clim_same_here, set_xlabel_arrow, \
|
||||
# set_ylabel_arrow, \
|
||||
# xpos_y_modelanddata
|
||||
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, load_folder_name, load_model_susept, \
|
||||
overlap_cells, \
|
||||
resave_small_files, save_visualization #utils0_project
|
||||
from threefish.utils1_suscept import get_stack, trial_nrs_ram_model
|
||||
import itertools as it
|
||||
|
||||
#from utils_all import default_settings, find_cell_add, get_flowchart_params, load_folder_name, load_model_susept, \
|
||||
# overlap_cells, \
|
||||
# plot_lowpass2, plt_time_arrays, remove_xticks, remove_yticks, resave_small_files, save_visualization, set_same_ylim
|
||||
from utils_suseptibility import *#model_and_data
|
||||
##from update_project import *
|
||||
|
||||
#from plt_RAM import model_and_data, model_and_data_sheme, model_and_data_vertical2
|
||||
|
||||
def table_printen(table):
|
||||
print(table.keys())
|
||||
@ -22,11 +21,9 @@ def table_printen(table):
|
||||
print(l1)
|
||||
|
||||
|
||||
def trialnr(eod_metrice = False, width=0.005, nffts=['whole'], powers=[1], cells=["2013-01-08-aa-invivo-1"], show=False,
|
||||
contrasts=[0], noises_added=[''], D_extraction_method=['additiv_cv_adapt_factor_scaled'],
|
||||
def trialnr(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],
|
||||
label=r'$\frac{1}{mV^2S}$'): # ['eRAM']
|
||||
dendrids=[''], ref_types=[''], adapt_types=[''], c_noises=[0.1], c_signal=[0.9], cut_offs1=[300]): # ['eRAM']
|
||||
# plot_style()#['_RAMscaled']'_RAMscaled'
|
||||
|
||||
duration_noise = '_short',
|
||||
@ -258,7 +255,6 @@ if __name__ == '__main__':
|
||||
|
||||
##########################
|
||||
#embed()
|
||||
trialnr(eod_metrice = False, width=0.005, show=show, D_extraction_method=D_extraction_method,
|
||||
label=r'$\frac{1}{mV^2S}$') #r'$\frac{1}{mV^2S}$'
|
||||
trialnr(D_extraction_method=D_extraction_method) #r'$\frac{1}{mV^2S}$'
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import os
|
||||
'''import os
|
||||
|
||||
try:
|
||||
from numba import jit
|
||||
@ -22,18 +22,19 @@ from IPython import embed
|
||||
|
||||
|
||||
# utils susept wird in utils paper copiert und von utisl_susepitbility gestartet
|
||||
utils_suseptibility_name = 'utils_susept'
|
||||
utils_susept_name = 'utils_paper'
|
||||
utils_suseptibility_name = 'utils1'
|
||||
utils_susept_name = 'utils1_project'
|
||||
|
||||
utils_suseptibility_name2 = 'utils_susept2'
|
||||
utils_susept_name2 = 'utils_paper2'
|
||||
|
||||
utils_suseptibility_name_all = 'utils_all'
|
||||
utils_susept_name_all = 'utils_all_down'#_down
|
||||
utils_suseptibility_name_all = 'utils0'
|
||||
utils_susept_name_all = 'utils0_project'#_down
|
||||
|
||||
|
||||
|
||||
try:# this will not load but I want this to be reference for the refractoring in pycharm
|
||||
from utils_susept import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from threefish.utils1 import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
cont_other_dir = True#
|
||||
except:
|
||||
cont_other_dir = False#then I know that I am on alexandras PC and I can update my code
|
||||
@ -45,18 +46,18 @@ if cont_other_dir == False:
|
||||
|
||||
|
||||
if not os.path.exists('../'+utils_suseptibility_name+'.py'):
|
||||
from utils_paper import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from utils1_project import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
#from utils_paper2 import * # resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
|
||||
else:
|
||||
#embed()
|
||||
if filecmp.cmp('../'+utils_suseptibility_name+'.py', utils_susept_name+'.py'):
|
||||
from utils_paper import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from utils1_project import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
#from utils_paper2 import * # resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
|
||||
if os.path.exists('../'+utils_suseptibility_name+'.py'):# das mache ich um in dem richtigen embed zu arbeiten
|
||||
sys.path.insert(0, '..')
|
||||
from utils_susept import *#resave_small_files,remove_yticks, unify_cell_names,load_cv_table, colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from threefish.utils1 import *#resave_small_files,remove_yticks, unify_cell_names,load_cv_table, colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
|
||||
else:
|
||||
# wir schauen erstmal ohne sys dass das immer zu teilen da ist
|
||||
@ -70,15 +71,15 @@ if cont_other_dir == False:
|
||||
# wenn wir auf meinem Computer sind ziehen wir es aber immer vom code
|
||||
# damit das refractors und wenn wir wo anders sind von dem extra kopierten file
|
||||
if not os.path.exists('../'+utils_suseptibility_name+'.py'):
|
||||
from utils_paper import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from utils1_project import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
#from utils_paper2 import * # resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
|
||||
sys.path.insert(0, '..')
|
||||
from utils_susept import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from threefish.utils1 import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
else:
|
||||
|
||||
sys.path.insert(0, '..')
|
||||
from utils_susept import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
from threefish.utils1 import *#resave_small_files,plt_cv_part,RAM_norm_data, remove_yticks, unify_cell_names,load_cv_table, calc_base_reclassification,colorbar_outside_right2, find_code_vs_not, load_folder_name, save_visualization
|
||||
|
||||
##############################
|
||||
# find out if we are in the code or develop mode (alexandra) or the public mode!
|
||||
@ -182,6 +183,6 @@ def plt_scatter_four(grid, frame, cell_types, cell_type_type, annotate, colors):
|
||||
|
||||
|
||||
|
||||
return ax0, ax1, ax2,
|
||||
return ax0, ax1, ax2,'''
|
||||
|
||||
|
14170
utils_all_down.py
14170
utils_all_down.py
File diff suppressed because it is too large
Load Diff
35777
utils_paper.py
35777
utils_paper.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user