run_analysis_fullrecs.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import mr_epilepsy_fullrec
  2. import os
  3. def run_mr_regions():
  4. for rectype in ['preictal', 'interictal']:
  5. data_path = '../Data/{}/'.format(rectype)
  6. result_path = '../Results/{}/singleunits_regions/'.format(rectype)
  7. # -----------------------------------------------------------------------#
  8. # create result directories
  9. # -----------------------------------------------------------------------#
  10. recordings = [dI for dI in os.listdir(data_path) if os.path.isdir(
  11. os.path.join(data_path, dI))]
  12. if not os.path.exists(result_path):
  13. os.makedirs(result_path)
  14. for rec in recordings:
  15. if not os.path.exists(result_path + rec):
  16. os.makedirs(result_path + rec)
  17. # -----------------------------------------------------------------------#
  18. # run mr analysis
  19. # -----------------------------------------------------------------------#
  20. outputfilename = 'pkl/activity_brainregions_SU_4ms.pkl'
  21. mr_epilepsy_fullrec.mr_analysis_confint(data_path, result_path,
  22. outputfilename=outputfilename, recordings='all',
  23. binnings=[], ksteps=(1, 400), fit_method='offset')
  24. def run_mr_hemispheres():
  25. for rectype in ['preictal', 'interictal']:
  26. data_path = '../Data/{}/'.format(rectype)
  27. result_path = '../Results/{}/singleunits/'.format(rectype)
  28. # -----------------------------------------------------------------------#
  29. # create result directories
  30. # -----------------------------------------------------------------------#
  31. recordings = [dI for dI in os.listdir(data_path) if os.path.isdir(
  32. os.path.join(data_path, dI))]
  33. if not os.path.exists(result_path):
  34. os.makedirs(result_path)
  35. for rec in recordings:
  36. if not os.path.exists(result_path + rec):
  37. os.makedirs(result_path + rec)
  38. # -----------------------------------------------------------------------#
  39. # run mr analysis
  40. # -----------------------------------------------------------------------#
  41. outputfilename = 'pkl/activity_SU_4ms.pkl'
  42. mr_epilepsy_fullrec.mr_analysis_confint(data_path, result_path,
  43. outputfilename=outputfilename, recordings='all',
  44. binnings=['left', 'right'], ksteps=(1, 400),
  45. fit_method='offset')
  46. def main():
  47. run_mr_hemispheres()
  48. #run_mr_regions()
  49. if __name__ == '__main__':
  50. main()