def __on_ok(self, _event): self.isExporting = True extent = Extent(self.spectrum) dlgProgress = wx.ProgressDialog('Exporting', '', len(self.sweeps), style=wx.PD_AUTO_HIDE | wx.PD_CAN_ABORT | wx.PD_REMAINING_TIME) try: count = 1 for timeStamp, sweep in self.sweeps.items(): name = '{0:.0f}.png'.format(timeStamp) directory = self.editDir.GetValue() filename = os.path.join(directory, name) thread = self.plot.set_plot({timeStamp: sweep}, extent, False) thread.join() filename = os.path.join(directory, '{}.png'.format(timeStamp)) export_image(filename, File.ImageType.PNG, self.figure, self.settings) cont, _skip = dlgProgress.Update(count, name) if not cont: break count += 1 except IOError as error: wx.MessageBox(error.strerror, 'Error', wx.OK | wx.ICON_WARNING) finally: dlgProgress.Destroy() self.EndModal(wx.ID_OK)
def __set_plot(self, spectrum, annotate): if len(spectrum) > 0: total = count_points(spectrum) if total > 0: spectrum = sort_spectrum(spectrum) extent = Extent(spectrum) self.graph.set_plot(spectrum, self.settings.pointsLimit, self.settings.pointsMax, extent, annotate) else: self.graph.clear_plots()
def __draw_plot(self): start, end = self.__get_range() self.__spectrum_range(start, end) self.textSweeps.SetLabel(str(len(self.sweeps))) if len(self.sweeps) > 0: total = count_points(self.sweeps) if total > 0: extent = Extent(self.spectrum) self.plot.set_plot(self.sweeps, extent, False) else: self.plot.clear_plots()
def __plot_diff(self): data = diff_spectrum(self.data) self.extent = Extent(data) self.parent.extent = self.extent return self.__plot_all(data)
def __plot_smooth(self): data = smooth_spectrum(self.data, self.settings.smoothFunc, self.settings.smoothRatio) self.extent = Extent(data) return self.__plot_all(data)
def __draw_plot(self, spectrum): extent = Extent(spectrum) self.plot.set_plot(spectrum, extent, False)