dodo.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. from glob import glob
  2. import os
  3. from os import path
  4. import itertools as it
  5. fname_merged = '../data/VRCliff_AllData.h5'
  6. def task_merge_sessions():
  7. loadpath = '/home/nickdg/labshare/Projects/VRExperiments_Round2/Data/motion_tracking/processed'
  8. fnames = glob(loadpath + '/VRWall*/*.h5', recursive=True)
  9. print(len(fnames))
  10. return {
  11. 'actions': ['python merge_data.py'],
  12. 'file_dep': [sorted(fnames)[0]],
  13. 'targets': [fname_merged],
  14. 'verbosity': 2,
  15. }
  16. # fname_clean = '../data/VRCliff_AllData_cleaned.h5'
  17. # def task_process_cliffdata():
  18. # return {
  19. # 'actions': ['python cleaning.py'],
  20. # 'file_dep': [fname_merged],
  21. # 'targets': [fname_clean],
  22. # 'verbosity': 0,
  23. # }
  24. # Write the notebook filenames in the order you want them to be run.
  25. notebooks = [
  26. 'Merge Data and Label Phases.ipynb',
  27. 'Calculate and Transform Data.ipynb',
  28. 'Crossings Deflections Analysis By Distance2.ipynb',
  29. 'Movement Direction Analysis2.ipynb',
  30. ]
  31. def task_update_and_export_notebooks():
  32. for basename in notebooks:
  33. notebook = '../notebooks/{}'.format(basename)
  34. yield {
  35. 'actions': ['jupyter nbconvert --config=/home/nickdg/.ipython/profile_default/ipython_nbconvert_config.py --execute "%(dependencies)s" '],
  36. 'file_dep': [notebook],
  37. 'name': 'run_notebook: {}'.format(path.basename(notebook)),
  38. # 'verbosity': 2,
  39. }
  40. for output in ['html', 'latex']:
  41. pdf_dirname = path.join(path.dirname(notebook), output)
  42. if not path.exists(pdf_dirname):
  43. os.mkdir(pdf_dirname)
  44. yield {
  45. 'actions': ['jupyter nbconvert "%(dependencies)s" --to {} --output-dir "{}"'.format(output, path.abspath(pdf_dirname))],
  46. 'file_dep': [path.abspath(notebook)],
  47. 'targets': [path.join(pdf_dirname, path.splitext(path.basename(notebook))[0] + '.' + output)],
  48. 'name': 'convert_to_{}: {}'.format(output, path.basename(notebook)),
  49. 'verbosity': 2
  50. }