def __init__(self, *args, **kwargs): FigureWindow.__init__(self, *args, **kwargs) self.current_data = None # algorithm dict and current data self.algorithms = AlgorithmDict() self.lock_attribute('algorithms') # # The toolbar tool_tabs = self._tool_tabs figure_book = self.figure_book frmAlgo = Frame(tool_tabs) algorithm_selection_group = AlgoSelGroup(frmAlgo, topwin=self) algorithm_selection_group.pack(side=LEFT, fill=Y) parameter_group = ParamsGroup(frmAlgo, topwin=self) parameter_group.pack(side=LEFT, fill=Y) solve_group = OptimizeGroup(frmAlgo, topwin=self) solve_group.pack(side=LEFT, fill=Y) tool_tabs.add(frmAlgo, text='Algorithm') with self.attribute_lock: set_attributes(self, algorithm_selection_group = algorithm_selection_group, parameter_group = parameter_group, solve_group = solve_group ) self._make_view_tab() self._make_marker_tab() self._make_export_tab() self._make_window_manager_tab() # End toolbar figure_book.make_figures( figure_meta = [ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ] ) with open(Application.instance.config_file_path) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.load_algorithm(module_name=algo['ModuleName'], class_name=algo['ClassName']) self.algorithm_selection_group.algorithm_list.current(len(algorithms)-1) envelope_figure = figure_book[0] envelope_figure.plot_function = lambda current_data, *args, **kwargs:\ envelope_figure.plot(abs(current_data), *args, **kwargs) phase_figure = figure_book[1] phase_figure.plot_function = lambda current_data, *args, **kwargs:\ phase_figure.plot(angle(current_data), *args, **kwargs) def plot_acdb(current_data, *args, **kwargs): s = current_data if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20*log10(abs(ac)) acdb = acdb - max(acdb) autocorrelatino_figure.plot(r_[(-N+1):N], acdb, *args, **kwargs) autocorrelatino_figure = figure_book[2] autocorrelatino_figure.plot_function = plot_acdb psd_figure = figure_book[3] psd_figure.plot_function = lambda current_data, *args, **kwargs:\ psd_figure.plot(abs(fft.fft(current_data)), *args, **kwargs)
class SingleWindow(FigureWindow, DataContainer): window_name = 'WaveSyn-SingleSyn' _xmlrpcexport_ = ['load_algorithm'] def __init__(self, *args, **kwargs): FigureWindow.__init__(self, *args, **kwargs) self.current_data = None def on_connect(self): # algorithm dict and current data self.algorithms = AlgorithmDict() self.lock_attribute('algorithms') # # The toolbar tool_tabs = self._tool_tabs figure_book = self.figure_book frmAlgo = Frame(tool_tabs) algorithm_selection_group = AlgoSelGroup(frmAlgo, topwin=self) algorithm_selection_group.pack(side='left', fill='y') parameter_group = ParamsGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) parameter_group.pack(side='left', fill='y') solve_group = OptimizeGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) solve_group.pack(side='left', fill='y') tool_tabs.add(frmAlgo, text='Algorithm') with self.attribute_lock: set_attributes(self, algorithm_selection_group = algorithm_selection_group, parameter_group = parameter_group, solve_group = solve_group ) self._make_view_tab() self._make_marker_tab() self._make_export_tab() self._make_window_manager_tab() # End toolbar figure_book.make_figures( figure_meta = [ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ] ) with open(self.root_node.config_file_path) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.load_algorithm(module_name=algo['ModuleName'], class_name=algo['ClassName']) self.algorithm_selection_group.algorithm_list.current(len(algorithms)-1) envelope_figure = figure_book[0] envelope_figure.plot_function = lambda current_data, *args, **kwargs:\ envelope_figure.plot(abs(current_data), *args, **kwargs) phase_figure = figure_book[1] phase_figure.plot_function = lambda current_data, *args, **kwargs:\ phase_figure.plot(angle(current_data), *args, **kwargs) def plot_acdb(current_data, *args, **kwargs): s = current_data if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20*log10(abs(ac)) acdb = acdb - max(acdb) autocorrelatino_figure.plot(r_[(-N+1):N], acdb, *args, **kwargs) autocorrelatino_figure = figure_book[2] autocorrelatino_figure.plot_function = plot_acdb psd_figure = figure_book[3] psd_figure.plot_function = lambda current_data, *args, **kwargs:\ psd_figure.plot(abs(fft.fft(current_data)), *args, **kwargs) @Scripting.printable def load_algorithm(self, module_name, class_name): node = AlgorithmNode(module_name, class_name) self.algorithms.add(node) values = self.algorithm_selection_group.algorithm_list['values'] if values == '': values = [] if isinstance(values, tuple): values = list(values) values.append(node['name']) self.algorithm_selection_group.algorithm_list['values'] = values self.algorithm_selection_group.algorithm_list.current(len(values)-1) self.parameter_group.append_algorithm(node) self.solve_group._cancel_parallel() return node.meta.name def change_algorithm(self, algorithmName): self.parameter_group.change_algorithm(algorithmName) self.solve_group._cancel_parallel() @property def current_algorithm(self): return self.algorithms[self.algorithm_selection_group.algorithm_list.get()]
def __init__(self, *args, **kwargs): FigureWindow.__init__(self, *args, **kwargs) self.currentData = None # algorithm dict and current data self.algorithms = AlgorithmDict() self.lockAttribute('algorithms') # # The toolbar toolTabs = self.toolTabs figureBook = self.figureBook frmAlgo = Frame(toolTabs) grpAlgoSel = AlgoSelGroup(frmAlgo, topwin=self) grpAlgoSel.pack(side=LEFT, fill=Y) grpParams = ParamsGroup(frmAlgo, topwin=self) grpParams.pack(side=LEFT, fill=Y) grpSolve = OptimizeGroup(frmAlgo, topwin=self) grpSolve.pack(side=LEFT, fill=Y) toolTabs.add(frmAlgo, text='Algorithm') with self.attributeLock: setMultiAttr(self, grpAlgoSel = grpAlgoSel, grpParams = grpParams, grpSolve = grpSolve ) self.makeViewTab() self.makeMarkerTab() self.makeExportTab() # End toolbar figureBook.makeFigures( figureMeta = [ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ] ) with open(Application.instance.configFileName) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.loadAlgorithm(moduleName=algo['ModuleName'], className=algo['ClassName']) self.grpAlgoSel.algoList.current(len(algorithms)-1) figEnvelope = figureBook[0] figEnvelope.plotFunction = lambda currentData, *args, **kwargs:\ figEnvelope.plot(abs(currentData), *args, **kwargs) figPhase = figureBook[1] figPhase.plotFunction = lambda currentData, *args, **kwargs:\ figPhase.plot(angle(currentData), *args, **kwargs) def plot_acdb(currentData, *args, **kwargs): s = currentData if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20*log10(abs(ac)) acdb = acdb - max(acdb) figAuto.plot(r_[(-N+1):N], acdb, *args, **kwargs) figAuto = figureBook[2] figAuto.plotFunction = plot_acdb figPSD = figureBook[3] figPSD.plotFunction = lambda currentData, *args, **kwargs:\ figPSD.plot(abs(fft.fft(currentData)), *args, **kwargs)
class SingleWindow(FigureWindow): windowName = 'WaveSyn-SingleSyn' _xmlrpcexport_ = ['loadAlgorithm'] def __init__(self, *args, **kwargs): FigureWindow.__init__(self, *args, **kwargs) self.currentData = None # algorithm dict and current data self.algorithms = AlgorithmDict() self.lockAttribute('algorithms') # # The toolbar toolTabs = self.toolTabs figureBook = self.figureBook frmAlgo = Frame(toolTabs) grpAlgoSel = AlgoSelGroup(frmAlgo, topwin=self) grpAlgoSel.pack(side=LEFT, fill=Y) grpParams = ParamsGroup(frmAlgo, topwin=self) grpParams.pack(side=LEFT, fill=Y) grpSolve = OptimizeGroup(frmAlgo, topwin=self) grpSolve.pack(side=LEFT, fill=Y) toolTabs.add(frmAlgo, text='Algorithm') with self.attributeLock: setMultiAttr(self, grpAlgoSel = grpAlgoSel, grpParams = grpParams, grpSolve = grpSolve ) self.makeViewTab() self.makeMarkerTab() self.makeExportTab() # End toolbar figureBook.makeFigures( figureMeta = [ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ] ) with open(Application.instance.configFileName) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.loadAlgorithm(moduleName=algo['ModuleName'], className=algo['ClassName']) self.grpAlgoSel.algoList.current(len(algorithms)-1) figEnvelope = figureBook[0] figEnvelope.plotFunction = lambda currentData, *args, **kwargs:\ figEnvelope.plot(abs(currentData), *args, **kwargs) figPhase = figureBook[1] figPhase.plotFunction = lambda currentData, *args, **kwargs:\ figPhase.plot(angle(currentData), *args, **kwargs) def plot_acdb(currentData, *args, **kwargs): s = currentData if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20*log10(abs(ac)) acdb = acdb - max(acdb) figAuto.plot(r_[(-N+1):N], acdb, *args, **kwargs) figAuto = figureBook[2] figAuto.plotFunction = plot_acdb figPSD = figureBook[3] figPSD.plotFunction = lambda currentData, *args, **kwargs:\ figPSD.plot(abs(fft.fft(currentData)), *args, **kwargs) @Scripting.printable def loadAlgorithm(self, moduleName, className): node = AlgorithmNode(moduleName, className) self.algorithms.add(node) values = self.grpAlgoSel.algoList['values'] if values == '': values = [] if isinstance(values, tuple): values = list(values) values.append(node['name']) self.grpAlgoSel.algoList['values'] = values self.grpAlgoSel.algoList.current(len(values)-1) self.grpParams.appendAlgorithm(node) def changeAlgorithm(self, algorithmName): self.grpParams.changeAlgorithm(algorithmName) @property def currentAlgorithm(self): return self.algorithms[self.grpAlgoSel.algoList.get()]
def on_connect(self): # algorithm dict and current data self.algorithms = AlgorithmDict() self.lock_attribute('algorithms') # # The toolbar tool_tabs = self._tool_tabs figure_book = self.figure_book frmAlgo = Frame(tool_tabs) algorithm_selection_group = AlgoSelGroup(frmAlgo, topwin=self) algorithm_selection_group.pack(side='left', fill='y') parameter_group = ParamsGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) parameter_group.pack(side='left', fill='y') solve_group = OptimizeGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) solve_group.pack(side='left', fill='y') tool_tabs.add(frmAlgo, text='Algorithm') with self.attribute_lock: set_attributes(self, algorithm_selection_group=algorithm_selection_group, parameter_group=parameter_group, solve_group=solve_group) self._make_view_tab() self._make_marker_tab() self._make_export_tab() self._make_window_manager_tab() # End toolbar figure_book.make_figures(figure_meta=[ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ]) with open(self.root_node.config_file_path) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.load_algorithm(module_name=algo['ModuleName'], class_name=algo['ClassName']) self.algorithm_selection_group.algorithm_list.current( len(algorithms) - 1) envelope_figure = figure_book[0] envelope_figure.plot_function = lambda current_data, *args, **kwargs:\ envelope_figure.plot(abs(current_data), *args, **kwargs) phase_figure = figure_book[1] phase_figure.plot_function = lambda current_data, *args, **kwargs:\ phase_figure.plot(angle(current_data), *args, **kwargs) def plot_acdb(current_data, *args, **kwargs): s = current_data if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20 * log10(abs(ac)) acdb = acdb - max(acdb) autocorrelatino_figure.plot(r_[(-N + 1):N], acdb, *args, **kwargs) autocorrelatino_figure = figure_book[2] autocorrelatino_figure.plot_function = plot_acdb psd_figure = figure_book[3] psd_figure.plot_function = lambda current_data, *args, **kwargs:\ psd_figure.plot(abs(fft.fft(current_data)), *args, **kwargs)
class SingleWindow(FigureWindow, DataContainer): window_name = 'WaveSyn-SingleSyn' _xmlrpcexport_ = ['load_algorithm'] def __init__(self, *args, **kwargs): FigureWindow.__init__(self, *args, **kwargs) self.current_data = None def on_connect(self): # algorithm dict and current data self.algorithms = AlgorithmDict() self.lock_attribute('algorithms') # # The toolbar tool_tabs = self._tool_tabs figure_book = self.figure_book frmAlgo = Frame(tool_tabs) algorithm_selection_group = AlgoSelGroup(frmAlgo, topwin=self) algorithm_selection_group.pack(side='left', fill='y') parameter_group = ParamsGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) parameter_group.pack(side='left', fill='y') solve_group = OptimizeGroup(frmAlgo, topwin=self, wavesyn_root=self.root_node) solve_group.pack(side='left', fill='y') tool_tabs.add(frmAlgo, text='Algorithm') with self.attribute_lock: set_attributes(self, algorithm_selection_group=algorithm_selection_group, parameter_group=parameter_group, solve_group=solve_group) self._make_view_tab() self._make_marker_tab() self._make_export_tab() self._make_window_manager_tab() # End toolbar figure_book.make_figures(figure_meta=[ dict(name='Envelope', polar=False), dict(name='Phase', polar=False), dict(name='AutoCorrelation', polar=False), dict(name='PSD', polar=False) ]) with open(self.root_node.config_file_path) as f: config = json.load(f) algorithms = config['SingleWaveformAlgorithms'] for algo in algorithms: self.load_algorithm(module_name=algo['ModuleName'], class_name=algo['ClassName']) self.algorithm_selection_group.algorithm_list.current( len(algorithms) - 1) envelope_figure = figure_book[0] envelope_figure.plot_function = lambda current_data, *args, **kwargs:\ envelope_figure.plot(abs(current_data), *args, **kwargs) phase_figure = figure_book[1] phase_figure.plot_function = lambda current_data, *args, **kwargs:\ phase_figure.plot(angle(current_data), *args, **kwargs) def plot_acdb(current_data, *args, **kwargs): s = current_data if not isinstance(s, ndarray): s = array(s) N = len(s) ac = convolve(s, conj(s[::-1])) acdb = 20 * log10(abs(ac)) acdb = acdb - max(acdb) autocorrelatino_figure.plot(r_[(-N + 1):N], acdb, *args, **kwargs) autocorrelatino_figure = figure_book[2] autocorrelatino_figure.plot_function = plot_acdb psd_figure = figure_book[3] psd_figure.plot_function = lambda current_data, *args, **kwargs:\ psd_figure.plot(abs(fft.fft(current_data)), *args, **kwargs) @WaveSynScriptAPI def load_algorithm(self, module_name, class_name): node = AlgorithmNode(module_name, class_name) self.algorithms.add(node) values = self.algorithm_selection_group.algorithm_list['values'] if values == '': values = [] if isinstance(values, tuple): values = list(values) values.append(node['name']) self.algorithm_selection_group.algorithm_list['values'] = values self.algorithm_selection_group.algorithm_list.current(len(values) - 1) self.parameter_group.append_algorithm(node) self.solve_group._cancel_parallel() return node.meta.name def change_algorithm(self, algorithmName): self.parameter_group.change_algorithm(algorithmName) self.solve_group._cancel_parallel() @property def current_algorithm(self): return self.algorithms[ self.algorithm_selection_group.algorithm_list.get()]