def mkdir(directory, replace=False): """ Creates directory if not existing, erases and recreates it if replace is set to be True. Parameters ---------- directory : string Name of directory. """ if pathexists(directory) and replace: rmr(directory) makedirs(directory, exist_ok=True)
def mkdir(directory, replace=False): """ Creates directory if not existing, erases and recreates it if replace is set to True. Parameters ---------- directory : string Name of directory. replace : bool Erase and recreate directory. (default: False) Returns ------- directory : string Name of directory. """ if pathexists(directory) and replace: rmr(directory) makedirs(directory, exist_ok=True) return directory
] for i in range(gNum)]) activeWorkOri = np.array( [[tmp_out[i][j].activeWorkOri[skipDump:].mean() for j in range(nRuns)] for i in range(gNum)]) orderParameter = np.array([[ tmp_out[i][j].orderParameter[skipDump:].mean() for j in range(nRuns) ] for i in range(gNum)]) torqueIntegral1 = np.array([[ tmp_out[i][j].torqueIntegral1[skipDump:].mean() for j in range(nRuns) ] for i in range(gNum)]) torqueIntegral2 = np.array([[ tmp_out[i][j].torqueIntegral2[skipDump:].mean() for j in range(nRuns) ] for i in range(gNum)]) # OUT with open(out_file, 'wb') as output: pickle.dump([ exec_path, initSim, Niter, dt, nRuns, gValues, seed, seeds, N, lp, phi, activeWork, activeWorkForce, activeWorkOri, orderParameter, torqueIntegral1, torqueIntegral2 ], output) # CLEAN if get_env('CLEAN', default=True, vartype=bool): move(out_file, path.join(out_dir, sim_name + '.datG')) # move output file to output directory rmr(sim_dir, ignore_errors=True) # delete simulation directory