This Python script is designed to manage the organization of simulation output files. It focuses on integrating low mass model simulation outputs with pre-existing higher mass model outputs into a unified directory structure. The script checks for existing directories, identifies missing ones, and is prepared to copy missing simulation results to ensure a comprehensive set of data, facilitating easier data analysis and access.
# I messed up the low mass models and had to rerun them # This script is meant to resolve the fixed low mass models # and the original high mass models (>0.7Msolar) into the # same directory import os import shutil import re import pathlib basedDir = "./outputs.denseAlpha.fixedLowmass/" origDir = "./outputs.denseAlpha/" numMissing = 0 numFound = 0 for Mdir in pathlib.Path(origDir).rglob("M-*"): popID = Mdir.parts[1] alphaID = Mdir.parts[2] mID = Mdir.parts[3] newPath = os.path.join(basedDir, popID, alphaID, mID) pathExists = os.path.exists(newPath) if pathExists: numFound += 1 else: print("Missing: ", newPath) numMissing += 1 print("Copying: ", Mdir) # shutil.copytree(Mdir, newPath) print(numMissing, " missing paths") print(numFound, " found paths")