class SimPanel(QtGui.QWidget): def __init__(self, parent, sim): super(SimPanel, self).__init__(parent) self.sim = sim box = QtGui.QHBoxLayout() self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) self.bar = ColorBarWidget(self, vmin=0., vmax=0.8) 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.param_panel.enable(True) print('Drawtime {}'.format(time.time() - tic))
class SimPanel(QtWidgets.QWidget): def __init__(self, parent, sim): super().__init__(parent) self.sim = sim box = QtWidgets.QHBoxLayout() if is_windows_platform(): self.solution = MatplotlibPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) box.addWidget(self.solution, 2) else: self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) self.bar = ColorBarWidget(self, vmin=0., vmax=0.8) 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(f'Simtime {time.time()-tic}') tic = time.time() self.solution.set(U.to_numpy().ravel()) self.param_panel.enable(True) print(f'Drawtime {time.time()-tic}')
def __init__(self, parent, sim): super(SimPanel, self).__init__(parent) self.sim = sim box = QtGui.QHBoxLayout() self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) self.bar = ColorBarWidget(self, vmin=0., vmax=0.8) 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 __init__(self, parent, sim): super().__init__(parent) self.sim = sim box = QtWidgets.QHBoxLayout() if is_windows_platform(): self.solution = MatplotlibPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) box.addWidget(self.solution, 2) else: self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) self.bar = ColorBarWidget(self, vmin=0., vmax=0.8) box.addWidget(self.solution, 2) box.addWidget(self.bar, 2) self.param_panel = ParamRuler(self, sim) box.addWidget(self.param_panel) self.setLayout(box)
class SimPanel(QtWidgets.QWidget): def __init__(self, parent, sim): super().__init__(parent) self.sim = sim box = QtWidgets.QHBoxLayout() if is_windows_platform(): self.solution = MatplotlibPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) box.addWidget(self.solution, 2) else: self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8) self.bar = ColorBarWidget(self, vmin=0., vmax=0.8) 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(f'Simtime {time.time()-tic}') tic = time.time() self.solution.set(U.to_numpy().ravel()) self.param_panel.enable(True) print(f'Drawtime {time.time()-tic}')