def simpleModellingFinishReceiver(self, succeed): if succeed: self.enableSimulationBlock(True) pickle.dump(GlobalValue.modelParams, open("globalValue_modelParams.dat", "wb")) pickle.dump(GlobalValue.yahooData, open("globalValue_yahooData.dat", "wb")) else: self.enableSimulationBlock(False) QtGui.QMessageBox.warning(self, "Error", "Simple Modelling failed!") for i in range(len(GlobalValue.yahooData)): plot.plot_simulation(GlobalValue.modelParams[i], GlobalValue.yahooData[i],i)
def simpleModellingFinishReceiver(self, succeed): if succeed: self.enableSimulationBlock(True) pickle.dump(GlobalValue.modelParams, open("globalValue_modelParams.dat", "wb")) pickle.dump(GlobalValue.yahooData, open("globalValue_yahooData.dat", "wb")) else: self.enableSimulationBlock(False) QtGui.QMessageBox.warning(self, "Error", "Simple Modelling failed!") for i in range(len(GlobalValue.yahooData)): plot.plot_simulation(GlobalValue.modelParams[i], GlobalValue.yahooData[i], i)
else: break else: break if t_m < t: print 'Integrate from t=%s to t=%s' % (t_m, t) dt = t - t_m x_p = velocity_vervet(x_m, dt) r.append(x_p) x_m = x_p t_m = t else: r.append(x_p) except KeyboardInterrupt: return done(r) return done(r) def resume(r, T): if type(r) == str: r = np.load(r) print '%s rows loaded' % r.shape[0] x0 = r[-1, :, :] r2 = simulate(x0, T)[1:, :, :] r = np.concatenate((r, r2), axis=0) np.save('lastresume.npy', r) return r from plot import plot_simulation r = simulate(gen_x0(N), T) plot_simulation(r[0::10, :, :])