class SimPanel(QtGui.QWidget): def __init__(self, parent, sim): super(SimPanel, self).__init__(parent) self.sim = sim box = QtGui.QHBoxLayout() self.solution = GlumpyPatchWidget(self, self.sim.grid) self.bar = ColorBarWidget(self) box.addWidget(self.solution, 2) box.addWidget(self.bar, 2) self.param_panel = ParamRuler(self, sim) box.addWidget(self.param_panel) self.setLayout(box) def solve_update(self): tic = time.time() self.param_panel.enable(False) args = self.sim.args shape = (args['YBLOCKS'], args['XBLOCKS']) mu = {'diffusion': np.array([s.value() for s in self.param_panel.spins]).reshape(shape)} U = self.sim.solve(mu) print('Simtime {}'.format(time.time() - tic)) tic = time.time() self.solution.set(U.data.ravel()) self.bar.set(U.data.ravel()) self.param_panel.enable(True) print('Drawtime {}'.format(time.time() - tic))
def __init__(self, parent, sim): super(SimPanel, self).__init__(parent) self.sim = sim box = QtGui.QHBoxLayout() self.solution = GlumpyPatchWidget(self, self.sim.grid) self.bar = ColorBarWidget(self) box.addWidget(self.solution, 2) box.addWidget(self.bar, 2) self.param_panel = ParamRuler(self, sim) box.addWidget(self.param_panel) self.setLayout(box)