dodo.py~ 2.0 KB

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