def postProcess(particles, temp, eK, eP, compr, cV, displacement): (comprStable, tempStable,ePStableParticle,eKStable) = computeStable(compr,eK,temp,eP) (comprAvg, cVAvg,tempAvg,ePParticleAvg) = computeAverages(comprStable,tempStable,ePStableParticle,eKStable) # Calculate and display errors for multiple block sizes for j in range( len(config.oscLength) ): print("Block length=",config.oscLength[j]) (comprError,cVError, tempError, ePParticleError)=computeErrors(comprStable,eKStable,tempStable,ePStableParticle,j) displayQuantities(comprAvg, comprError,cVAvg, cVError, tempAvg, tempError, ePParticleAvg, ePParticleError) # Plot the results #calculate Ek and Ep to per particle for use in plotting eKPerParticle = eK / config.nParticles; ePPerParticle = eP / config.nParticles; plotResults(particles, temp, eKPerParticle, ePPerParticle, compr, cV, displacement)
def run(self): plotResults(self.inputFiles, self.outputFile)
from plotResults import plotResults import subprocess # subprocess.call(("cmake", "..", "-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-GNinja"), cwd="../build") # subprocess.call(("ninja", "mocapSim"), cwd="../build") # subprocess.call(("./mocapSim"), cwd="../build") plotResults("/tmp/Salsa/mocapSimulation/", saveFig=True)
from plotResults import plotResults import subprocess import os directory = "/tmp/Salsa/compareSimulation/" # subprocess.call(("cmake", "..", "-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-GNinja"), cwd="../build") # subprocess.call(("ninja", "compareSim"), cwd="../build") # subprocess.call(("./compareSim"), cwd="../build") plotResults(directory, False)
from plotResults import plotResults import subprocess subprocess.call( ("cmake", "..", "-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-GNinja"), cwd="../build") subprocess.call(("ninja", "featSim"), cwd="../build") subprocess.call(("./featSim"), cwd="../build") plotResults("/tmp/Salsa/featSimulation/")
import plotResults fN = '/home/chrisgre/projects/H2/results/bestE' cName = 'NoncodingHuman.conf' plotResults.plotResults(fN, cName) #plotProfile.boxPlotHisto(None, cName)
from plotResults import plotResults import subprocess subprocess.call( ("cmake", "..", "-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-GNinja"), cwd="../build") subprocess.call(("ninja", "gnssSim"), cwd="../build") subprocess.call(("./gnssSim"), cwd="../build") plotResults("/tmp/Salsa/gnssSimulation/")
def run(): pygame.init() nn = deep_QNetwork() countGames = 0 record = 0 backG = 1 listReaches = [] listMisses = [] var = 0 var2 = False while countGames < 150: print("GAME " + str(countGames)) road = Road(800, 450) myCar = road.car myCoins = road.coins startGame(myCar, myCoins, road, nn) display(myCar, myCoins, road, record, backG) while (myCar.reached + myCar.missed) < 50: for event in pygame.event.get(): if event.type == pygame.QUIT: break oldState = nn.get_state(myCar, myCoins, road) nn.epsilon = 90 - var if randint(0, 100) <= nn.epsilon: final_move = to_categorical(randint(0, 2), num_classes=3) else: prediction = nn.model.predict(oldState.reshape((1, nn.dimInput))) final_move = to_categorical(np.argmax(prediction[0]), num_classes=3) myCar.moveCar(final_move, myCar.x, myCar.y, myCoins, road) myCoins.moveCoins(myCar, road) newState = nn.get_state(myCar, myCoins, road) reward = nn.set_reward(myCar) nn.train_short_memory(oldState, final_move, reward, newState, myCar.crashed) nn.remember(oldState, final_move, reward, newState, myCar.crashed) record = getRecord(myCar.reached, record) display(myCar, myCoins, road, record, backG) pygame.time.wait(speed) backG += 1 if backG == 5: backG = 1 if var < 88 and var2 == True: var += 1 var2 = False else: var2 = True listReaches.append(myCar.reached) listMisses.append(myCar.missed) if myCar.reached <= myCar.missed: for j in range(4): myCar.explosionCar(road, myCar.x, myCar.y, j) if myCar.reached > myCar.missed: myCar.win(road) nn.replay_new(nn.memory) countGames += 1 nn.model.save_weights('weights.hdf5') pR.plotResults(listReaches, listMisses, 50) plt.show()