Example #1
0
def MultiSimulation(multiParams, simConfs, globalSimParams, path='.') :

    # Seed the PRNG
    random.seed(multiParams['globalSeed'])

    multiDir = os.path.join(path, multiParams['simName'])

    # Create the multi-sim directory
    if (not os.path.exists(multiDir)) :
        os.makedirs(multiDir)

    ParamUtils.Save_MultiSim_Params(os.path.join(multiDir, "MultiSim.ini"),
                                    multiParams)

    # Get the seeds that will be used for each sub-simulation
    theSimSeeds = random.random_integers(9999999, size=multiParams['simCnt'])

    p = Pool()
    
    for index, seed in enumerate(theSimSeeds) :
        p.apply_async(_produce_sim, (index, seed, simConfs,
                                     globalSimParams.copy(),
                                     multiDir))
    p.close()
    p.join()
Example #2
0
def Multi_DownsampleTracks(multiParams, skipCnt, multiSim, newMulti, path='.'):
    simNames = Sims_of_MultiSim(multiSim, path)

    multiDir = os.path.join(path, multiSim)
    newDir = os.path.join(path, newMulti)

    # TODO: Improve this to actually fully resolve these to completely prevent over-writing.
    if multiDir == newDir:
        raise ValueError(
            "The new downsampled directory is the same as the current!")

    p = Pool()

    for simName in simNames:
        p.apply_async(_prepare_and_down,
                      (simName, skipCnt, multiSim, multiDir, newDir))

    p.close()
    p.join()

    multiParams['simName'] = newMulti
    ParamUtils.Save_MultiSim_Params(os.path.join(newDir, "MultiSim.ini"),
                                    multiParams)