highspeed-bids-participants.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # ======================================================================
  2. # SCRIPT INFORMATION:
  3. # ======================================================================
  4. # SCRIPT: UPDATE PARTICIPANTS .JSON FILE
  5. # PROJECT: HIGHSPEED
  6. # WRITTEN BY LENNART WITTKUHN, 2018 - 2019
  7. # CONTACT: WITTKUHN AT MPIB HYPHEN BERLIN DOT MPG DOT DE
  8. # MAX PLANCK RESEARCH GROUP NEUROCODE
  9. # MAX PLANCK INSTITUTE FOR HUMAN DEVELOPMENT
  10. # MAX PLANCK UCL CENTRE FOR COMPUTATIONAL PSYCHIATRY AND AGEING RESEARCH
  11. # LENTZEALLEE 94, 14195 BERLIN, GERMANY
  12. # ======================================================================
  13. # IMPORT RELEVANT PACKAGES
  14. # ======================================================================
  15. import json
  16. import os
  17. # ======================================================================
  18. # DEFINE PATHS
  19. # ======================================================================
  20. # path to the project root:
  21. project_name = 'highspeed-bids'
  22. path_root = os.getcwd().split(project_name)[0] + project_name
  23. path_desc = os.path.join(path_root, 'participants.json')
  24. # ======================================================================
  25. # UPDATE DATA-SET DESCRIPTION FILE
  26. # ======================================================================
  27. # update fields of the json file:
  28. json_desc = dict()
  29. json_desc["participant_id"] = {
  30. "Description": "Participant identifier"
  31. }
  32. json_desc["age"] = {
  33. "Description": "Age, in years as in the first session",
  34. "Units": "years"
  35. }
  36. json_desc["sex"] = {
  37. "Description": "Sex, self-rated by participant",
  38. "Levels": {
  39. "m": "male",
  40. "f": "female",
  41. "o": "other"
  42. }
  43. }
  44. json_desc["handedness"] = {
  45. "Description": "Handedness, self-rated by participant; note that participants were required to be right-handed",
  46. "Levels": {
  47. "right": "right",
  48. "left": "left"
  49. }
  50. }
  51. json_desc["digit_span"] = {
  52. "Description": "Total score in Digit-Span Test (Petermann & Wechsler, 2012), assessing working memory capacity",
  53. "Units": "total scores"
  54. }
  55. json_desc["randomization"] = {
  56. "Description": "Pseudo-randomized group assignment for selection of sequences in sequence trials"
  57. }
  58. json_desc["session_interval"] = {
  59. "Description:": "Interval in days between the two experimental sessions",
  60. "Units": "days"
  61. }
  62. # save updated data-set_description.json file:
  63. with open(path_desc, 'w') as outfile:
  64. json.dump(json_desc, outfile, indent=4)
  65. outfile.close()