def on_python_connect(self): self.sourceWindow.hide() self.dataAnalyser = DataAnalyser(udp_port=int( self.sourceWindow.ui.pySocket.text()), use_thread=True) self.start_timers() self.show()
def __init__(self, data, data_label, sec_per_cyc=945.6, maxLag=360000): DataAnalyser.__init__(self, data, data_label, sec_per_cyc) self.threshold = 0.0 self.row_max = 0 self.maxLag = maxLag self.lag = maxLag self.max_index = 0 self.time_to_max = maxLag self.time_to_threshold = None self.time_threshold_to_max = None self.gradient = None self.isRepPos = None
def main(): # 1 fetch data # takes some time importData = ImportData.ImportData() csv_link = importData.get_records() # 2 populate the database dataset = pd.read_csv(csv_link) # populateDatabase = DatabasePopulator.PopulateDatabase(dataset) # populateDatabase.add_records_to_database() # 3 specify the instrument instruments = Instruments.Instruments(csv_link) anthropometry = instruments.get_anthropometric_measurements() health_diet = instruments.get_c_general_health_diet() # 4 merge instruments merge_data = MergeHandler(anthropometry, health_diet) data = merge_data.join_data_frames() # 5 data analysis dataAnalyser = DataAnalyser(anthropometry) # 6 add columns to plot pairwise relationships in a dataset pair_plot = dataAnalyser.set_pair_plot( 'anth_standing_height', 'anth_weight', 'anth_waist_circumf_1', 'anth_waist_circumf_2', 'anth_waist_circumf', 'anth_hip_circumf_1', 'anth_hip_circumf_2', 'anth_hip_circumf') # 7 list of email addresses. Appended more contacts contacts = ['*****@*****.**', '*****@*****.**'] # 8 list of attachments initialized with the report attachments = [dataAnalyser.get_report(), pair_plot] # 9 add all the jpeg files to the list for plot in dataAnalyser.get_visualizations(): attachments.append(plot) # 10 write general report.csv file # add report to attachments branchingLogicHandler = BranchingLogicHandler(csv_link) report_link = branchingLogicHandler.write_report() branchingLogicHandler.get_report_summary() attachments.append(report_link) # 11 sending the email emailHandler = EmailHandler.EmailHandler(contacts, attachments) emailHandler.send_email()
def on_use_cpp(self): self.sourceWindow.hide() self.dataAnalyser = CppReader( udp_port=int(self.sourceWindow.ui.cppSocket.text()), concat_samples=int(self.sourceWindow.ui.nrOfSamples.text())) self.start_timers() self.show()
async def main(): workload_actions = readWorkloadFile() num_commands = len(workload_actions) user_workloads, dumplog = parseUserCommands(workload_actions) logger.info(user_workloads.keys()) logger.info(dumplog) assert len(user_workloads.keys()) == NUM_USERS loop = asyncio.get_event_loop() users = createUsers(user_workloads, loop) start = time.time() times = await runUsers(users) await generateDumplog(dumplog) end = time.time() execution_time = end - start command_times = combineUserTimes(times) analyser = DataAnalyser(NUM_USERS, num_commands, execution_time, command_times) analyser.saveCommandTimes() analyser.logSummary() return
def on_use_pcap(self): self.sourceWindow.hide() options = QFileDialog.Options() fileName, _ = QFileDialog.getOpenFileName( self, "Select PCAP file", "", "Pcap file (*.pcap *.pcapng)", options=options) if (len(fileName) == 0): self.close() return self.dataAnalyser = PcapReader(fileName) self.start_timers() self.show()
#func = linear.function(columnNames=['D','E', 'F', 'G', 'P','W','X','Y','AA', 'AB', 'AD'], featureStartIndex = 3) linear.function(columnNames=[ feature_columns[letter - ord('A')] for letter in range(ord('A'), ord('A') + features) ], featureStartIndex=2) #linear.function(columnNames=[chr(letter) for letter in range(ord('A'), ord('A') + features)], featureStartIndex = 2); #func = linear.function(columnNames=['A','B','C','D','E','F','G'], featureStartIndex = 2) #func = linear.function(columnNames=['D', 'E', 'F', 'G', 'H','I','J','K', 'L','M','N','O', 'P', 'U','W','X','Y', 'AA', 'AB', 'AD'], featureStartIndex = 3) y_pred_linear, -1.0 * cross_score_poly = data.predict(linear) linear_analyser = DataAnalyser(R.LinearRegression(), feature_columns) linear_analyser.run(data, startPercentage=10, repeats=3, verbose=True) linear_analyser.plotMse(axis=(25, 140, 0, 0.2)) linear_analyser.plotMseStd(axis=(25, 140, 0, 0.2)) linear_analyser.plotParameterCount() linear_analyser.plotParameterProbabilities() #l = linear_model.LinearRegression() #l.fit(X_train, y_train) #l.coef_ #l.intercept_ #y_pred = l.predict(X_test) ######################### # Polynomial Regression #########################
data1.merge(data2) print(data1.size()) Analyser = DatasetAnalyser(data1) Analyser.plot2D_sol_fct_of_RHS() if False: a = 4.9682e-06 b = -0.00822419 c = 2.47186 dev = 39152400 avg = 7538330000 path = sys.argv[1] bound_file_name = sys.argv[2] sol_file_name = sys.argv[3] data = load_csv(bound_file_name, sol_file_name, path=path) new_data = data.copy() processor = BoundProcessorSecondDeg(a, b, c, dev, avg) processor.pre_process(data) for_plot = OutputData(data.get_solutions(), data.get_RHS()) analyser = DataAnalyser(new_data, for_plot) analyser.performance_plot_2D(save=True, name="quadratic_interpolation.pdf")
class AdcViewerApp(QtWidgets.QMainWindow): def __init__(self): #Parent constructor super(AdcViewerApp, self).__init__() self.ui = None self.setup() def setup(self): import adc_view self.ui = adc_view.Ui_MainWindow() self.ui.setupUi(self) self.ui.channelsSelector.addItems( ["All in one", "0 & 1 and 2 & 3", "0, 1, 2, 3"]) self.ui.channelsSelector.currentIndexChanged.connect( self.on_channels_select) self.ui.rateComboBox.addItems(["0.5 Hz", "1 Hz", "10 Hz"]) self.ui.rateComboBox.setCurrentIndex(2) self.ui.rateComboBox.currentIndexChanged.connect(self.on_rate_select) self.ui.startButton.clicked.connect(self.on_start_button) self.ui.stopButton.clicked.connect(self.on_stop_button) self.ui.stopOnErrorCheckBox.clicked.connect(self.on_stop_select) self.setUpTable() self.plotCtrl = PlotCtrl(self.ui.plotFrame) # set the layout self.queryTimer = QtCore.QTimer() self.queryTimer.setSingleShot(False) self.queryTimer.timeout.connect(self.on_query_for_packet) self.requestTimer = QtCore.QTimer() self.requestTimer.setSingleShot(False) self.requestTimer.timeout.connect(self.on_request_timer) self.request_delay = 100 self.ui.startButton.setEnabled(False) self.stop_on_error = False self.sourceWindow = SourceWindow() self.sourceWindow.show() self.sourceWindow.ui.openPcapButton.clicked.connect(self.on_use_pcap) self.sourceWindow.ui.pythonInterpButton.clicked.connect( self.on_python_connect) self.sourceWindow.ui.cppInterpButton.clicked.connect(self.on_use_cpp) #self.dataAnalyser = DataAnalyser(udp_port = 65535, use_thread = True) def start_timers(self): self.queryTimer.start(50) self.requestTimer.start(self.request_delay) def on_use_pcap(self): self.sourceWindow.hide() options = QFileDialog.Options() fileName, _ = QFileDialog.getOpenFileName( self, "Select PCAP file", "", "Pcap file (*.pcap *.pcapng)", options=options) if (len(fileName) == 0): self.close() return self.dataAnalyser = PcapReader(fileName) self.start_timers() self.show() def on_use_cpp(self): self.sourceWindow.hide() self.dataAnalyser = CppReader( udp_port=int(self.sourceWindow.ui.cppSocket.text()), concat_samples=int(self.sourceWindow.ui.nrOfSamples.text())) self.start_timers() self.show() def on_python_connect(self): self.sourceWindow.hide() self.dataAnalyser = DataAnalyser(udp_port=int( self.sourceWindow.ui.pySocket.text()), use_thread=True) self.start_timers() self.show() def on_cpp_connect(self): self.sourceWindow.hide() self.show() def on_channels_select(self, index): select_list = [ self.plotCtrl.setup_all, self.plotCtrl.setup_12_and_34, self.plotCtrl.setup_1_2_3_4 ] select_list[index]() def on_rate_select(self, index): rate_list = [2000, 1000, 100] self.request_delay = rate_list[index] self.requestTimer.setInterval(self.request_delay) def on_stop_select(self, index): self.stop_on_error = bool(index) def on_stop_button(self): self.stop_it() def stop_it(self): self.requestTimer.stop() self.queryTimer.stop() self.ui.startButton.setEnabled(True) self.ui.stopButton.setEnabled(False) self.plotCtrl.enable_toolbar(True) def on_start_button(self): self.queryTimer.start(50) self.requestTimer.start(self.request_delay) self.ui.startButton.setEnabled(False) self.ui.stopButton.setEnabled(True) self.plotCtrl.enable_toolbar(False) def setUpTable(self): self.tableCtrl = StatsTableCtrl(["Stat", "Value", "Errors"], self.ui.statsTable) #---------------------------------------------------------------------- def on_request_timer(self): self.dataAnalyser.request_packet() #---------------------------------------------------------------------- def on_query_for_packet(self): data = self.dataAnalyser.get_packet() if data == None: return if (len(data["data"]) > 0): self.plotCtrl.plot(data["data"]) self.tableCtrl.setStatsDict(data) if (self.stop_on_error): for key in data: if ("status" in data[key]): if (not data[key]["status"]): self.stop_it() def closeEvent(self, event): self.requestTimer.stop() self.queryTimer.stop() del self.dataAnalyser event.accept()