def show(self, ctx): # Add a layer to the MLP bimpy.push_item_width(80) bimpy.input_int("nr neurons", self.ui.nr_neurons) bimpy.same_line() bimpy.combo("transfer", self.ui.transfer, self.ui.transfer_names) if (self.ui.nr_neurons.value > 0): bimpy.same_line() if (bimpy.button("add layer")): transfer = self.ui.transfer_names[self.ui.transfer.value] self.model.add_layer(transfer, self.ui.nr_neurons.value) bimpy.pop_item_width() self.model.show(ctx) show_io_plot(self.ui.input, self.model)
def render(self, is_lock): bimpy.set_next_tree_node_open(True, bimpy.Condition.FirstUseEver) if not bimpy.tree_node('trainning##train_component'): return flags = bimpy.InputTextFlags.EnterReturnsTrue if is_lock: flags |= bimpy.InputTextFlags.ReadOnly bimpy.push_item_width(120) if bimpy.input_int('epoch##train_component', self._epoch, 0, 0, flags=flags): self._epoch.value = max(1, self._epoch.value) if bimpy.input_int('batch_size##train_component', self._batch_size, 0, 0, flags=flags): self._batch_size.value = max(1, self._batch_size.value) if bimpy.input_int('batch_per_epoch##train_component', self._batch_per_epoch, 0, 0, flags=flags): self._batch_per_epoch.value = max(1, self._batch_per_epoch.value) if bimpy.input_int('valid_size##train_component', self._valid_size, 0, 0, flags=flags): self._valid_size.value = max(0, self._valid_size.value) bimpy.pop_item_width() bimpy.tree_pop()
def render(self, is_lock): bimpy.set_next_tree_node_open(True, bimpy.Condition.FirstUseEver) if not bimpy.tree_node('convex points##convex_component'): return bimpy.same_line() bimpy_tools.help_marker('Convex points should be presented in counter-clockwise order') flags = bimpy.InputTextFlags.EnterReturnsTrue if is_lock: flags |= bimpy.InputTextFlags.ReadOnly last_convex_number_value = self._convex_number.value if bimpy.input_int('number##convex_component', self._convex_number, 1, 1, flags): self._convex_number.value = max(3, self._convex_number.value) if last_convex_number_value > self._convex_number.value: self._convex_data = self._convex_data[:self._convex_number.value] # cut back points else: self._convex_data.extend([ [bimpy.Float(0), bimpy.Float(0)] for _ in range(last_convex_number_value, self._convex_number.value) ]) # show convex value setting bimpy.set_next_tree_node_open(self._convex_number.value < 10, bimpy.Condition.FirstUseEver) if bimpy.tree_node('convex value ({})##convex_component'.format(self._convex_number.value)): for index in range(self._convex_number.value): bimpy.push_item_width(210) bimpy.input_float2( '{:<3d}'.format(index), self._convex_data[index][0], self._convex_data[index][1], flags=flags ) bimpy.pop_item_width() bimpy.tree_pop() # draw part bimpy.new_line() if bimpy.button('draw convex##convex_component') and not is_lock: self._convex_data_backup = [[item[0].value, item[1].value] for item in self._convex_data] self._convex_draw_flag = True self._convex_data = [] self._convex_number.value = 0 bimpy.tree_pop()
def render_widget(self): if bimpy.input_int(self.bimpy_name, self._bimpy_value): self._value = int(self._bimpy_value.value)
bimpy.add_circle_filled(point * m + center, 5, 0xAF000000 + colors[i], 100) axis_ = np.matmul(axis, S * 2.0) axis_ = np.matmul(axis_, R) + P bimpy.add_line(center + bimpy.Vec2(axis_[0, 0], axis_[0, 1]) * m, center + bimpy.Vec2(axis_[1, 0], axis_[1, 1]) * m, 0xFFFF0000, 1) bimpy.add_line(center + bimpy.Vec2(axis_[2, 0], axis_[2, 1]) * m, center + bimpy.Vec2(axis_[3, 0], axis_[3, 1]) * m, 0xFFFF0000, 1) bimpy.end() bimpy.set_next_window_pos(bimpy.Vec2(20, 640), bimpy.Condition.Once) bimpy.set_next_window_size(bimpy.Vec2(800, 140), bimpy.Condition.Once) bimpy.begin("Controls") bimpy.input_int("Data points count", DATA_POINTS) bimpy.input_int("Clasters count", CLASTERS) bimpy.slider_float("std", std, 0.0, 3.0) if bimpy.button("Generate data"): generate_fake_data() bimpy.end() ctx.render()
acquisition = util.Iterator(currentBoard) acquisition.start() except: print('acquisition problem ! Please try again.') currentBoard.exit() time.sleep(3) ctx = bimpy.Context() ctx.init(470, 300, "") while(not ctx.should_close()): ctx.new_frame() if bimpy.begin("Arduino Controller", flags=(bimpy.WindowFlags.NoSavedSettings | bimpy.WindowFlags.NoMove | bimpy.WindowFlags.NoResize | bimpy.WindowFlags.AlwaysAutoResize | bimpy.WindowFlags.NoCollapse)): bimpy.push_style_var(bimpy.Style.WindowRounding, 0) bimpy.push_style_var(bimpy.Style.FrameRounding, 12) bimpy.push_style_var(bimpy.Style.Alpha, 255) bimpy.input_int("LED Pin (digital)",pinNumber,1) if (pinNumber.value < 2): pinNumber = bimpy.Int(2) if (pinNumber.value > 13): pinNumber = bimpy.Int(13) if (minPWM.value > 255): minPWM = bimpy.Int(255) if (minPWM.value < 0): minPWM = bimpy.Int(0) if (maxPWM.value > 255): maxPWM = bimpy.Int(255) if (maxPWM.value < 1): maxPWM = bimpy.Int(1) if (minPWM.value > maxPWM.value): minPWM = bimpy.Int(maxPWM.value) bimpy.input_float('Light interval (seconds)', maxInterval, 0.100000000000000)
nom3 = nom2 + ("%d" % i) capture_RealSense(nom3) i = i + 1 data = 55 ser.write([data]) out = ser.read() while not ctx.should_close(): ctx.new_frame() bimpy.set_next_window_pos(bimpy.Vec2(0, 0), bimpy.Condition.Once) bimpy.set_next_window_size(bimpy.Vec2(800, 400), bimpy.Condition.Once) bimpy.begin("Controls") bimpy.input_int("Hauteur de la cible en mm", taille_cible) bimpy.input_int("Largeur de la cible en mm", largeur_cible) bimpy.input_text("Nom du fichier", stri, 15) if bimpy.button("Visualisation"): print("La touche Q permet de quitter l'application de visualisation") print("La touche R permet une remise a zero de la visualisation") print( "La touche P permet de mettre en pause l'application de visualisation" ) print("La touche F permet d'activer ou de desactive le post-prcessing") print("La touche D permet de reduire la qualite de prise de la camera") pyglet.app.run()
def render(self, is_lock): bimpy.set_next_tree_node_open(True, bimpy.Condition.FirstUseEver) if not bimpy.tree_node('lines##lines_component'): return # number setting flags = bimpy.InputTextFlags.EnterReturnsTrue if is_lock: flags |= bimpy.InputTextFlags.ReadOnly if bimpy.input_int('number##lines_component', self._line_number, 1, 1, flags): self._line_number.value = max(3, self._line_number.value) if self._last_line_number_value > self._line_number.value: self._line_data = self._line_data[:self._line_number.value] # cut back points else: self._line_data.extend([ [bimpy.Float(0), bimpy.Float(0), bimpy.Float(0)] for _ in range(self._last_line_number_value, self._line_number.value) ]) self._last_line_number_value = self._line_number.value # print('line number change to {}'.format(self._line_number.value)) # show line value setting bimpy.set_next_tree_node_open(self._line_number.value < 10, bimpy.Condition.FirstUseEver) self._highlight_line_index = None if bimpy.tree_node('line value ({})'.format(self._line_number.value)): for index in range(self._line_number.value): bimpy.push_item_width(210) bimpy.input_float3( '{:<3d}'.format(index), self._line_data[index][0], self._line_data[index][1], self._line_data[index][2], flags=flags ) bimpy.pop_item_width() if bimpy.is_item_hovered(): self._highlight_line_index = index bimpy.same_line() if bimpy.button('rev##lines_component{}'.format(index)) and not is_lock: for j in range(3): self._line_data[index][j].value = -self._line_data[index][j].value if bimpy.is_item_hovered(): self._highlight_line_index = index bimpy.same_line() if bimpy.button('draw##lines_component{}'.format(index)) and not is_lock: self._waitting_draw_line_index = index bimpy.set_window_focus('canvas window##canvas') if bimpy.is_item_hovered(): self._highlight_line_index = index bimpy.tree_pop() # random setting bimpy.new_line() if bimpy.button('random##lines_component') and not is_lock: initializer = self.initializer_component.build_initializer() random_lines = initializer.random(self._line_number.value) for index in range(self._line_number.value): self._line_data[index][0].value = random_lines[index].a self._line_data[index][1].value = random_lines[index].b self._line_data[index][2].value = random_lines[index].c self.initializer_component.render(is_lock) bimpy.tree_pop()