def _process_network(self, file): logger.info(f"Creating Network object ...") start = time.time() reader = self.reader.choosen_reader(file) self.network = reader.get_network() end = time.time() logger.info(f"Done [{end - start:.4f} s]")
def select_trip(self): trip_selector = TripSelector() if trip_selector.exec_() == QDialog.Accepted: vehid = trip_selector.vehid.value() if vehid != "": logger.info(f"Looking for trip {vehid} and plotting it ...") self.routes.addTrip(vehid)
def _process_path(self, vehid): logger.info(f"Looking for path {vehid} and plotting it ...") start = time.time() path = self.reader.get_path(vehid) if path is not None: self.append({vehid: path.links}) end = time.time() logger.info(f"Done [{end - start:.4f} s]")
def export_csv(self): name = QFileDialog.getSaveFileName(parent=None, caption="Export Routes to csv", filter="csv files (*.csv)") if name[0] != "": logger.info(f"Exporting routes in file: {name[0]}") with open(name[0], "w") as f: for ind, links in self.dict.items(): f.write(str(ind) + ";" + "/".join(links) + "\n")
def choose_reader(self, file): self.reader_widget.set_file(file) if self.reader_widget.exec_() == QDialog.Accepted: logger.debug(f"Choose reader {self.reader_widget.choosen_reader}") logger.info(f"Loading file {file.split('/')[-1]} ...") start = time.time() self.reader = self.reader_widget.choosen_reader(file) end = time.time() logger.info(f"Done [{end - start:.4f} s]")
def _plot_network(self): self.renderer = NetworkRenderer( self.network, self.mpl_widget.figure, callbackpicking=self._showlink ) logger.info(f"Rendering Network object ...") start = time.time() self.mpl_widget.figure.clf() self.renderer.draw_network() plt.axis("off") plt.axis("tight") self.mpl_widget.figure.gca().set_aspect("equal") end = time.time() logger.info(f"Done [{end - start:.4f} s]")
def _process_OD(self, args): logger.info(f"Looking for ODs withs args: {args}") start = time.time() od_list = self.reader.get_OD(*args) od_list = list(dict.fromkeys([tuple(path.links) for path in od_list])) logger.info(f"Found {len(od_list)} unique ODs ...") self.append({ind: path for ind, path in enumerate(od_list)}) end = time.time() logger.info(f"Done [{end - start:.4f} s]")
def clear(self): if self.renderer is not None: logger.info("Clearing Renderer routes") self.renderer.clear()