import os import mr_epilepsy_timeresolved def run_2parts_regions(): # -----------------------------------------------------------------------# # preictal data 4ms # -----------------------------------------------------------------------# data_path = '../Data/preictal/' result_path = '../Results/preictal/singleunits_regions/' # -----------------------------------------------------------------------# # create result directories # -----------------------------------------------------------------------# recordings = [dI for dI in os.listdir(data_path) if os.path.isdir( os.path.join(data_path, dI))] if not os.path.exists(result_path): os.makedirs(result_path) for rec in recordings: if not os.path.exists(result_path + rec): os.makedirs(result_path + rec) # -----------------------------------------------------------------------# # run mr analysis # -----------------------------------------------------------------------# outputfilename = 'pkl/activity_brainregions_SU_4ms.pkl' x = 2 mr_epilepsy_timeresolved.mt_x_parts(x, outputfilename, data_path, result_path, recordings=recordings, binnings='all', ksteps=(1, 400), fit_method="offset") def run_2parts_hemispheres(): # -----------------------------------------------------------------------# # preictal data 4ms # -----------------------------------------------------------------------# data_path = '../Data/preictal/' result_path = '../Results/preictal/singleunits/' # -----------------------------------------------------------------------# # create result directories # -----------------------------------------------------------------------# recordings = [dI for dI in os.listdir(data_path) if os.path.isdir( os.path.join(data_path, dI))] if not os.path.exists(result_path): os.makedirs(result_path) for rec in recordings: if not os.path.exists(result_path + rec): os.makedirs(result_path + rec) # -----------------------------------------------------------------------# # run timeresolved mr analysis # -----------------------------------------------------------------------# x = 2 outputfilename = "pkl/activity_SU_4ms.pkl" mr_epilepsy_timeresolved.mt_x_parts(x, outputfilename, data_path, result_path, recordings=recordings, binnings=['left', 'right'], ksteps=(1, 400), fit_method="offset") def run_timeresolved_hemispheres(): # -----------------------------------------------------------------------# # preictal data 4ms # -----------------------------------------------------------------------# data_path = '../Data/preictal/' result_path = '../Results/preictal/singleunits/' # -----------------------------------------------------------------------# # create result directories # -----------------------------------------------------------------------# recordings = [dI for dI in os.listdir(data_path) if os.path.isdir( os.path.join(data_path, dI))] if not os.path.exists(result_path): os.makedirs(result_path) for rec in recordings: if not os.path.exists(result_path + rec): os.makedirs(result_path + rec) # -----------------------------------------------------------------------# # run timeresolved mr analysis # -----------------------------------------------------------------------# ksteps = (1, 400) for binning in ['left', 'right']: for rec in recordings[60:]: windowsize = 20000 windowstep = 500 binning = binning fit_method = 'offset' dt = 4 mt_file = '{}{}/mt_results_{}_{}_kmin{}_kmax{}_winsize{}_winstep{}_dt{}.pkl'.format( result_path, rec, binning, fit_method, ksteps[0], ksteps[1], windowsize, windowstep, dt) if not os.path.isfile(mt_file): mr_epilepsy_timeresolved.analyse_timeresolved_mr(data_path, result_path, recordings=[rec], binnings=[binning], ksteps=ksteps, windowsize=20000, windowstep=500, fit_method='offset') def main(): run_2parts_hemispheres() run_2parts_regions() run_timeresolved_hemispheres() # warning: timeresolved analysis is computationally costly if __name__ == '__main__': main()