setup_2.py 685 B

12345678910111213141516171819202122
  1. def sort_data(num_vincs=6):
  2. """
  3. DESCRIPTION:
  4. Sorts data folders in Ejecta_Simulation_Data by vinc.
  5. CALLING SEQUENCE:
  6. sort_data(num_vincs=6)
  7. KEYWORDS:
  8. ## num_vincs: number of velocity increments (default 6; +0-5 km/s)
  9. """
  10. parent = os.getcwd()
  11. folders = sorted(glob.glob(parent + '/Ejecta_Simulation_Data/5000e*'))
  12. for i in range(num_vincs):
  13. Path(parent + '/Ejecta_Simulation_Data/'+str(i)+'vinc').mkdir(parents=True, exist_ok=True)
  14. for folder in folders:
  15. vincnum = folder.split('/')[-1].split('_')[2][0]
  16. shutil.move(folder, parent + '/Ejecta_Simulation_Data/' + str(vincnum) + 'vinc')