def __init__(self, parent): super(MakeNicerWidget, self).__init__(parent) self.data = np.array([]) # array which holds data # Time domain plot self.tdWidget = DockablePlotWidget(self, CurveWidget) self.tdWidget.calcFun.addFun('fs', lambda x: x, lambda x: x) self.tdWidget.calcFun.addFun('µm', lambda x: x * fsDelay * 1e3, lambda x: x / fsDelay * 1e-3) self.tdWidget.calcFun.addFun('mm', lambda x: x * fsDelay, lambda x: x / fsDelay) tdPlot = self.tdWidget.get_plot() self.tdSignal = SignalFT(self, plot=tdPlot) self.tdFit = SignalFT(self, plot=tdPlot, col='r') # Frequency domain plot self.fdWidget = DockablePlotWidget(self, CurveWidget) self.fdWidget.calcFun.addFun('PHz', lambda x: x, lambda x: x) self.fdWidget.calcFun.addFun('THz', lambda x: x * 1e3, lambda x: x * 1e-3) self.fdWidget.calcFun.addFun('µm', lambda x: c0 / x * 1e-9, lambda x: c0 / x * 1e-9) self.fdWidget.calcFun.addFun('eV', lambda x: x, lambda x: x) fdplot = self.fdWidget.get_plot() self.fdSignal = SignalFT(self, plot=fdplot) self.fdFit = SignalFT(self, plot=fdplot, col='r') self.smoothNum = QSpinBox() # gives number of smoothin points self.smoothNum.setMinimum(1) self.smoothNum.setSingleStep(2) # Put things together in layouts buttonLayout = QGridLayout() plotLayout = QVBoxLayout() layout = QHBoxLayout() plotLayout.addWidget(self.tdWidget) plotLayout.addWidget(self.fdWidget) buttonLayout.addWidget(QLabel('Fitting function'), 0, 0) buttonLayout.addWidget( QLineEdit("lambda x,A,f,phi: np.sin(2*np.pi*f*x+phi)"), 1, 0, 1, 2) buttonLayout.addWidget(QLabel('Smooth'), 2, 0) buttonLayout.addWidget(self.smoothNum, 2, 1) buttonLayout.setRowStretch(3, 20) layout.addLayout(buttonLayout) layout.addLayout(plotLayout) self.setLayout(layout) # connect signals self.updateTdPlot.connect(self.tdSignal.updatePlot) self.updateTdFitPlot.connect(self.tdFit.updatePlot) self.updateFdPlot.connect(lambda data: self.fdSignal.updatePlot( self.fdSignal.computeFFT(data))) self.updateFdFitPlot.connect( lambda data: self.fdFit.updatePlot(self.fdFit.computeFFT(data))) self.smoothNum.valueChanged.connect(self.smoothData) self.setData()
def __init__(self, parent=None): super(ContrastAdjustment, self).__init__(parent) self.local_manager = None # local manager for the histogram plot self.manager = None # manager for the associated image plot # Storing min/max markers for each active image self.min_markers = {} self.max_markers = {} # Select point tools self.min_select_tool = None self.max_select_tool = None style = "<span style=\'color: #444444\'><b>%s</b></span>" layout, _label = get_image_layout(self.PANEL_ICON, style % self.PANEL_TITLE, alignment=Qt.AlignCenter) layout.setAlignment(Qt.AlignCenter) vlayout = QVBoxLayout() vlayout.addLayout(layout) self.local_manager = PlotManager(self) self.histogram = LevelsHistogram(parent) vlayout.addWidget(self.histogram) self.local_manager.add_plot(self.histogram) hlayout = QHBoxLayout() self.setLayout(hlayout) hlayout.addLayout(vlayout) self.toolbar = toolbar = QToolBar(self) toolbar.setOrientation(Qt.Vertical) # toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) hlayout.addWidget(toolbar) # Add standard plot-related tools to the local manager lman = self.local_manager lman.add_tool(SelectTool) lman.add_tool(BasePlotMenuTool, "item") lman.add_tool(BasePlotMenuTool, "axes") lman.add_tool(BasePlotMenuTool, "grid") lman.add_tool(AntiAliasingTool) lman.get_default_tool().activate() self.outliers_param = EliminateOutliersParam(self.PANEL_TITLE)
def __init__(self, parent): QWidget.__init__(self, parent) layout = QHBoxLayout() row_nb = 14 cindex = 0 for child in dir(QStyle): if child.startswith('SP_'): if cindex == 0: col_layout = QVBoxLayout() icon_layout = QHBoxLayout() icon = get_std_icon(child) label = QLabel() label.setPixmap(icon.pixmap(32, 32)) icon_layout.addWidget( label ) icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) ) col_layout.addLayout(icon_layout) cindex = (cindex+1) % row_nb if cindex == 0: layout.addLayout(col_layout) self.setLayout(layout) self.setWindowTitle('Standard Platform Icons') self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
def __init__(self, parent): QWidget.__init__(self, parent) layout = QHBoxLayout() row_nb = 14 cindex = 0 for child in dir(QStyle): if child.startswith('SP_'): if cindex == 0: col_layout = QVBoxLayout() icon_layout = QHBoxLayout() icon = get_std_icon(child) label = QLabel() label.setPixmap(icon.pixmap(32, 32)) icon_layout.addWidget(label) icon_layout.addWidget(QLineEdit(child.replace('SP_', ''))) col_layout.addLayout(icon_layout) cindex = (cindex + 1) % row_nb if cindex == 0: layout.addLayout(col_layout) self.setLayout(layout) self.setWindowTitle('Standard Platform Icons') self.setWindowIcon(get_std_icon('TitleBarMenuButton'))