setup_1.py 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. def setup_folders(num_vincs=6, num_sites=6):
  2. """
  3. DESCRIPTION:
  4. Sets up directory structure for storing plotfiles.
  5. CALLING SEQUENCE:
  6. setup_folders(num_vincs=6, num_sites=6)
  7. KEYWORDS:
  8. ## num_vincs: number of velocity increments (default 6; +0-5 km/s)
  9. ## num_sites: number of specific collision sites (default 6)
  10. Directory Structure:
  11. Plots
  12. - all_ejecta
  13. - vincs_separate
  14. - 0vinc
  15. - all_planets
  16. - per_planet
  17. - cols_v_time
  18. - cols_v_time_fits
  19. - inc_v_a
  20. - e_v_a
  21. - 1vinc
  22. - 2vinc
  23. ...
  24. ...
  25. - vincs_compared
  26. - histograms
  27. - cols_v_time
  28. - inc_v_a
  29. - e_v_a
  30. - specific_collision_sites
  31. - site1
  32. - vincs_separate
  33. - 0vinc
  34. - all_planets
  35. - per_planet
  36. - cols_v_time
  37. - cols_v_time_fits
  38. - inc_v_a
  39. - e_v_a
  40. - 1vinc
  41. - 2vinc
  42. ...
  43. ...
  44. - vincs_compared
  45. - histograms
  46. - cols_v_time
  47. - inc_v_a
  48. - e_v_a
  49. - site2
  50. ...
  51. ...
  52. - single_ejecta
  53. - 0vinc
  54. - 1vinc
  55. ...
  56. ...
  57. """
  58. object_names = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
  59. parent = os.getcwd()
  60. plotspath = parent + "/Plots"
  61. all_ejecta_path = plotspath + "/all_ejecta"
  62. specific_sites_path = plotspath + "/specific_collision_sites"
  63. single_ejecta_path = plotspath + "/single_ejecta"
  64. #create Plots directory
  65. Path(plotspath).mkdir(parents=True, exist_ok=True)
  66. #create all_ejecta folder
  67. Path(all_ejecta_path).mkdir(parents=True, exist_ok=True)
  68. #populate all_ejecta_folder:
  69. ###1. vincs_separate folder
  70. Path(all_ejecta_path + "/vincs_separate").mkdir(parents=True, exist_ok=True)
  71. for i in range(num_vincs):
  72. #make vincs_separate
  73. vinc_folder = all_ejecta_path + "/vincs_separate/" + str(i) + "vinc"
  74. Path(vinc_folder).mkdir(parents=True, exist_ok=True)
  75. #make all_planets
  76. Path(vinc_folder + "/all_planets").mkdir(parents=True, exist_ok=True)
  77. Path(vinc_folder + "/all_planets/inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  78. Path(vinc_folder + "/all_planets/e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  79. #make and populate per_planet
  80. per_p_folder = vinc_folder + "/per_planet"
  81. Path(per_p_folder).mkdir(parents=True, exist_ok=True)
  82. Path(per_p_folder + "/cols_v_time").mkdir(parents=True, exist_ok=True)
  83. Path(per_p_folder + "/cols_v_time_fits").mkdir(parents=True, exist_ok=True)
  84. Path(per_p_folder + "/inc_v_a").mkdir(parents=True, exist_ok=True)
  85. Path(per_p_folder + "/e_v_a").mkdir(parents=True, exist_ok=True)
  86. for o in object_names[1:]:
  87. Path(per_p_folder + "/inc_v_a/" + o + "_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  88. Path(per_p_folder + "/e_v_a/" + o + "_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  89. Path(per_p_folder + "/inc_v_a/remaining_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  90. Path(per_p_folder + "/e_v_a/remaining_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  91. Path(per_p_folder + "/inc_v_a/esc_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  92. Path(per_p_folder + "/e_v_a/esc_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  93. Path(per_p_folder + "/inc_v_a/mixed_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  94. Path(per_p_folder + "/e_v_a/mixed_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  95. ###2. vincs_compared folder
  96. Path(all_ejecta_path + "/vincs_compared").mkdir(parents=True, exist_ok=True)
  97. Path(all_ejecta_path + "/vincs_compared/histograms").mkdir(parents=True, exist_ok=True)
  98. Path(all_ejecta_path + "/vincs_compared/cols_v_time").mkdir(parents=True, exist_ok=True)
  99. Path(all_ejecta_path + "/vincs_compared/inc_v_a").mkdir(parents=True, exist_ok=True)
  100. Path(all_ejecta_path + "/vincs_compared/e_v_a").mkdir(parents=True, exist_ok=True)
  101. #create specific_collision_sites folder
  102. Path(specific_sites_path).mkdir(parents=True, exist_ok=True)
  103. #populate specific_collision_sites folder
  104. for j in range(num_sites):
  105. #folder for each site
  106. site_path = specific_sites_path + "/site" + str(j)
  107. Path(site_path).mkdir(parents=True, exist_ok=True)
  108. #1. vincs_separate folder
  109. for i in range(num_vincs):
  110. #make vincs_separate
  111. vinc_folder = site_path + "/vincs_separate/" + str(i) + "vinc"
  112. Path(vinc_folder).mkdir(parents=True, exist_ok=True)
  113. #make all_planets
  114. Path(vinc_folder + "/all_planets").mkdir(parents=True, exist_ok=True)
  115. Path(vinc_folder + "/all_planets/inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  116. Path(vinc_folder + "/all_planets/e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  117. #make and populate per_planet
  118. per_p_folder = vinc_folder + "/per_planet"
  119. Path(per_p_folder).mkdir(parents=True, exist_ok=True)
  120. Path(per_p_folder + "/cols_v_time").mkdir(parents=True, exist_ok=True)
  121. Path(per_p_folder + "/cols_v_time_fits").mkdir(parents=True, exist_ok=True)
  122. Path(per_p_folder + "/inc_v_a").mkdir(parents=True, exist_ok=True)
  123. Path(per_p_folder + "/e_v_a").mkdir(parents=True, exist_ok=True)
  124. for o in object_names[1:]:
  125. Path(per_p_folder + "/inc_v_a/" + o + "_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  126. Path(per_p_folder + "/e_v_a/" + o + "_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  127. Path(per_p_folder + "/inc_v_a/remaining_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  128. Path(per_p_folder + "/e_v_a/remaining_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  129. Path(per_p_folder + "/inc_v_a/esc_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  130. Path(per_p_folder + "/e_v_a/esc_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  131. Path(per_p_folder + "/inc_v_a/mixed_inc_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  132. Path(per_p_folder + "/e_v_a/mixed_e_v_a_snapshots").mkdir(parents=True, exist_ok=True)
  133. ###2. vincs_compared folder
  134. Path(site_path + "/vincs_compared").mkdir(parents=True, exist_ok=True)
  135. Path(site_path + "/vincs_compared/histograms").mkdir(parents=True, exist_ok=True)
  136. Path(site_path + "/vincs_compared/cols_v_time").mkdir(parents=True, exist_ok=True)
  137. Path(site_path + "/vincs_compared/inc_v_a").mkdir(parents=True, exist_ok=True)
  138. Path(site_path + "/vincs_compared/e_v_a").mkdir(parents=True, exist_ok=True)
  139. #create single_ejecta_path folder
  140. Path(single_ejecta_path).mkdir(parents=True, exist_ok=True)
  141. #populate
  142. for i in range(num_vincs):
  143. Path(single_ejecta_path + '/' + str(i) + 'vinc').mkdir(parents=True, exist_ok=True)