import os try: from numba import jit # embed() except ImportError: def jit(nopython): def decorator_jit(func): return func return decorator_jit import inspect if 'cv_cell_types' not in inspect.stack()[-1][1]: try: from plotstyle import plot_style, spines_params except: a = 5 import sys 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_name2 = 'utils_susept2' utils_susept_name2 = 'utils_paper2' utils_suseptibility_name_all = 'utils_all' utils_susept_name_all = 'utils_all_down'#_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 cont_other_dir = True# except: cont_other_dir = False#then I know that I am on alexandras PC and I can update my code #embed() if cont_other_dir == False: import filecmp # I can also update the folder in another directy to double check its dependencies 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 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 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 else: # wir schauen erstmal ohne sys dass das immer zu teilen da ist import shutil if os.path.exists('../'+utils_suseptibility_name+'.py'): shutil.copyfile('../'+utils_suseptibility_name+'.py', utils_susept_name+'.py') import shutil if os.path.exists('../' + utils_suseptibility_name + '.py'): shutil.copyfile('../' + utils_suseptibility_name_all + '.py', utils_susept_name_all + '.py') print('copied utils all') # 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 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 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 ############################## # find out if we are in the code or develop mode (alexandra) or the public mode! names_extra_modules = [] version = 'code' # for name in names_extra_modules: if 'suseptibility' in inspect.stack()[-1][1]: # 'code' not in # da ist jetzt die Starter Directory version = 'develop' if ('code' not in inspect.stack()[-1][1]) | (not (('alex' in os.getlogin()) | ('rudnaya' in os.getlogin()))): version = 'public' # für alle sollte version public sein! # embed() # this we do only in the develop mode if version == 'develop': # copy = True if copy: if __name__ == '__main__': from distutils.dir_util import copy_tree import time import shutil #shutil.rmtree("../../make_folder/suseptibility")#delet t1 = time.time() dirs = os.listdir("../suseptibility") d_count = 0 for d, dir in enumerate(dirs): if (('.csv' in dir) | ('.npy' in dir) | ('.pkl' in dir) | ('.py' in dir)| ('suseptibility' in dir)| ('make' in dir.lower()) | ('.dat' in dir)) & ('__pycache__' not in dir): new_folder_make = '../../../make_folder' if not os.path.exists(new_folder_make): os.mkdir(new_folder_make) new_dir = new_folder_make+"/suseptibility/" if not os.path.exists(new_dir): os.mkdir(new_dir) # clean the previous directory #embed() if d_count == 0: dirs_new = os.listdir(new_dir) for dir_n in dirs_new: if '__pycache__' not in dir_n: os.remove(new_dir + dir_n) # nicht remove three sonst macht es alles weg #shutil.rmtree(new_dir) #os.mkdir(new_dir) # redo the directory # if os.path.exists(new_dir + dir): embed() #print(new_dir+dir) #try: shutil.copy2("../suseptibility/" + dir, new_dir + dir) #print(new_dir + dir) #shutil.copy("../suseptibility/" + dir, new_dir + dir) #shutil.copyfile("../suseptibility/"+dir, new_dir+dir) #except: # print('shutil stuff') # embed() d_count += 1 t2 = time.time() -t1 print('Time='+str(t2)) print('copied') #copy_tree("../suseptibility", "../../make_folder/suseptibility") def plt_scatter_four(grid, frame, cell_types, cell_type_type, annotate, colors): grid2 = gridspec.GridSpecFromSubplotSpec(1, 4, grid[0], wspace=0.4, hspace=0.2) add = ['', '_burst_corr', ] ax0 = plt.subplot(grid2[0]) # ok hier plotten wir nur den scatter der auch ein gwn hat, aber was ist wenn es mehr sind? # ok im prinzip sollte das zwar schon stimmen aber für das Bild kann man wirklich mehr machen for c, cell_type_it in enumerate(cell_types): frame_g = frame[ (frame[cell_type_type] == cell_type_it) & ((frame.gwn == True) | (frame.fs == True))] plt_cv_fr(annotate, ax0, add[0], frame_g, colors, cell_type_it) ax1 = plt.subplot(grid2[1]) for c, cell_type_it in enumerate(cell_types): frame_g = frame[ (frame[cell_type_type] == cell_type_it) & ((frame.gwn == True) | (frame.fs == True))] plt_cv_vs(frame_g, ax1, add[0], annotate, colors, cell_type_it) ax2 = plt.subplot(grid2[2]) ax2.set_title('burst') for c, cell_type_it in enumerate(cell_types): # frame_all = frame[(frame[cell_type_type] == cell_type)] frame_g = frame[ (frame[cell_type_type] == cell_type_it) & ((frame.gwn == True) | (frame.fs == True))] # embed() plt_cv_fr(annotate, ax2, add[1], frame_g, colors, cell_type_it) return ax0, ax1, ax2,