def init_UI(self): self.setWindowTitle("PDS CAMERA") # self.dot_graph_shown = True # Information showers self.camera_feed = LiveSteamLabel(self) self.number_dispay = NumberLabel(self) self.image_still = CapturedPhotoLabel(self) self.line_graph = LineGraph(self) # self.dot_graph = DotGraph(self) # Buttons self.capture_button = QPushButton("Capture current image", self) self.capture_button.clicked.connect(self._update_labels) self.toggle_button = QPushButton("Toggle other graph", self) self.toggle_button.clicked.connect(self._switch_graphs) self._create_layout()
def plot(self, print_error, algorithms): down = self.range_wdg.spin_box_1.value() high = self.range_wdg.spin_box_2.value() step = round(self.range_wdg.spin_box_3.value(), 2) if (down >= high) or (step <= 0) or (step >= (high - down)): error = "Параметры итерирования заданы некорректно" print_error(error) print(error) else: range_param = [down, high, step] self.line_graph_obj.add_param_range( [self.line_graph_obj.get_parameters_obj(), range_param]) line_graph = LineGraph.LineGraph( "title", algorithms, self.line_graph_obj.get_parameters_obj(), high, down, step) line_graph.plot(print_error=print_error)
class MainWindow(QWidget): def __init__(self, parent=None): self.dump = open("hashdump.txt", "w") super().__init__(parent) self.init_UI() self.show() def init_UI(self): self.setWindowTitle("PDS CAMERA") # self.dot_graph_shown = True # Information showers self.camera_feed = LiveSteamLabel(self) self.number_dispay = NumberLabel(self) self.image_still = CapturedPhotoLabel(self) self.line_graph = LineGraph(self) # self.dot_graph = DotGraph(self) # Buttons self.capture_button = QPushButton("Capture current image", self) self.capture_button.clicked.connect(self._update_labels) self.toggle_button = QPushButton("Toggle other graph", self) self.toggle_button.clicked.connect(self._switch_graphs) self._create_layout() def _switch_graphs(self): return # # if self.dot_graph_shown: # # self.dot_graph_shown = False # # self.dot_graph.hide() # self.line_graph.show() # else: # # self.dot_graph_shown = True # self.line_graph.hide() # # self.dot_graph.show() def _update_labels(self): try: img = self.camera_feed.get_current_image() new_string = crunch_image(img) self.dump.write(new_string + "\n") self.image_still.update(img) for i in range(0, len(new_string), 2): new_num = int(new_string[i:i + 2], 16) % 128 if new_num < 100: self.line_graph.addvalue(new_num) finally: QtCore.QTimer.singleShot(10, self._update_labels) def _create_layout(self): self.setGeometry(0, 0, *SCREEN_RESOLUTION) main_grid = QGridLayout() self.setLayout(main_grid) main_grid.setGeometry(QtCore.QRect(0, 0, *SCREEN_RESOLUTION)) main_grid.setSpacing(10) main_grid.addWidget(self.camera_feed, 1, 1) main_grid.addWidget(self.line_graph, 1, 2) # main_grid.addWidget(self.dot_graph, 1, 2) main_grid.addWidget(self.image_still, 3, 1) main_grid.addWidget(self.number_dispay, 3, 2) # self.line_graph.hide() self._create_button_grid(main_grid) def _create_button_grid(self, main_grid): button_grid = QGridLayout() main_grid.addLayout(button_grid, 2, 2) button_grid.addWidget(self.capture_button, 1, 1) button_grid.addWidget(self.toggle_button, 1, 2)
import math from graph import LineGraph from scatter import ScatterPlot gg = LineGraph() gg.graph(color="red", fun="sin(x)", dict={"sin": math.sin}, intery=0.005, interx=0.02, height=1000, width=1000, thk=3, stx=0, sty=-1.5) gg.graph(color="blue", fun="sin(x)", dict={"sin": math.sin}, intery=0.005, interx=0.02, height=1000, width=1000, thk=3, stx=3.14, sty=-1.5) gg.graph(color="black", fun="sin(x)", dict={"sin": math.sin}, intery=0.005, interx=0.02, height=1000,
from import_data import import_data, RelationDataExtraction import sys from scipy.cluster.hierarchy import dendrogram, linkage, fcluster from clustering import hierarchical_clustering as hc from graph import LineGraph if __name__ == '__main__': line_data = import_data.read_relation_data() line_relation_data = import_data.transform_to_array(line_data) line_graph = LineGraph.LineGraph(line_relation_data) # line_data_map = import_data.generate_line_data(line_data) # # data = import_data.transform_to_array(line_data) # # sys.setrecursionlimit(100000) # linkage_data = hc.hierarchical_cluster_test(data) # # plot_dendrogram(linkage_data) # # flat_cluster = fcluster(linkage_data, 1) # number_of_clusters = len(set(flat_cluster)) # print("Number of clusters:", number_of_clusters)