def gui(self):
     self.gui_reset()
     nSteps = pg.SpinBox(int=True, step=1)
     first_volume = pg.SpinBox(int=True, step=1)
     nVolumes = pg.SpinBox(int=True, step=1)
     nVolumes.setMinimum(1)
     ratio_type = ComboBox()
     ratio_type.addItem('average')
     ratio_type.addItem('standard deviation')
     self.items.append({
         'name': 'nSteps',
         'string': 'Number of steps per volume',
         'object': nSteps
     })
     self.items.append({
         'name': 'first_volume',
         'string': 'First Volume',
         'object': first_volume
     })
     self.items.append({
         'name': 'nVolumes',
         'string': 'Number of Volumes',
         'object': nVolumes
     })
     self.items.append({
         'name': 'ratio_type',
         'string': 'Ratio Type',
         'object': ratio_type
     })
     super().gui()
예제 #2
0
 def __init__(self):
   pg.LayoutWidget.__init__(self)
   
   currRow = 0
   
   img = renderTeX('$\\Phi(\\vec{k}) \\propto \\frac{\\mathrm{exp}\\left(-(L_{\\mathrm{min}} k)^2\\right)}{\\left(1/{L_0}^2 + k^2\\right)^{-11/6}}$')
   eqnLabel = QtGui.QLabel(alignment=QtCore.Qt.AlignHCenter)
   eqnLabel.setPixmap(QtGui.QPixmap.fromImage(img))
   self.addWidget(eqnLabel,row=currRow,col=0,colspan=2)
   currRow += 1
   
   self.addWidget(QtGui.QLabel('L0:'), row=currRow, col=0)
   self.L0SpinBox = pg.SpinBox(value=2.,bounds=[0,None],suffix='m',
                         siPrefix=True, dec=True, step=1.0, minStep=0.1)
   self.addWidget(self.L0SpinBox,row=currRow,col=1)
   currRow += 1
   
   self.addWidget(QtGui.QLabel('Lmin:'), row=currRow, col=0)
   self.LminSpinBox = pg.SpinBox(value=0.1,bounds=[0,None],suffix='m',
                       siPrefix=True, dec=True, step=0.1, minStep=0.1)
   self.addWidget(self.LminSpinBox, row=currRow,col=1)
   currRow += 1
   
   genButton = QtGui.QPushButton('Generate field')
   self.addWidget(genButton, row=currRow, colspan=2)
   genButton.clicked.connect(self.generate)
   
   self.setHidden(True)
예제 #3
0
    def create_optimizer_toolbox(self, tb):
        optimizer_combo = self.init_combo_param(
            ['SGD', 'Adagrad', 'Adadelta', 'Adam', 'Nadam'])

        self.optimizer_form_dict = {
            'optimizer combo':
            optimizer_combo,
            'activation unit':
            self.init_combo_param(['relu']),
            'lr':
            pg.SpinBox(value=self.learner.optimizer_params['lr'],
                       step=0.00001),
            'beta_1':
            pg.SpinBox(value=self.learner.optimizer_params['beta_1'],
                       step=0.1),
            'beta_2':
            pg.SpinBox(value=self.learner.optimizer_params['beta_2'],
                       step=0.0001),
            'epsilon':
            pg.SpinBox(value=self.learner.optimizer_params['epsilon'],
                       step=1e-09),
            'decay':
            pg.SpinBox(value=self.learner.optimizer_params['decay'], step=0.1)
        }
        self.create_toolbox(tb, 'Optimizer', self.optimizer_form_dict)
예제 #4
0
파일: slider.py 프로젝트: wsonv/Wonjun
    def __init__(self, minimum, maximum, label, tick=0, parent=None):
        super(Slider, self).__init__(parent=parent)
        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.label = QtGui.QLabel(self)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.font = QtGui.QFont("?", 18)
        self.label.setFont(self.font)

        if label == "\u2113":
            self.spin = pg.SpinBox(value=glo_var.l,
                                   bounds=[1, 20],
                                   parent=self)
            self.spin.setRange(1, 20)
            self.intspinargs = {"int": True, "step": 1}
            self.spin.setOpts(**self.intspinargs)
        elif label == "\u03b1":
            self.spin = pg.SpinBox(value=glo_var.alpha,
                                   bounds=[0, 1],
                                   parent=self)
        else:
            self.spin = pg.SpinBox(value=glo_var.beta,
                                   bounds=[0, 1],
                                   parent=self)

        self.verticalLayout.addWidget(self.label)

        self.verticalLayout.addWidget(self.spin)

        self.horizontalLayout = QtGui.QHBoxLayout()
        spacerItem = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.slider = QtGui.QSlider(self)
        self.slider.setOrientation(QtCore.Qt.Vertical)

        # check!
        self.text_label = label
        self.label.setText(self.text_label)

        self.horizontalLayout.addWidget(self.slider)

        spacerItem1 = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.resize(self.sizeHint())
        self.minimum = minimum
        self.maximum = maximum
        self.x = None

        if label == "\u2113":
            self.x = 1
            # self.slider.setSingleStep(1)
            self.spin.sigValueChanging.connect(self.Intspinvalue)

        else:
            self.spin.sigValueChanging.connect(self.spinvalue)

        self.slider.minimumSizeHint()
        self.slider.setTickPosition(3)
예제 #5
0
    def gui(self):
        s=g.settings['light_sheet_analyzer']
        self.gui_reset()
        self.nSteps = pg.SpinBox(int=True, step=1)
        self.nSteps.setMinimum(1)
        self.nSteps.setValue(s['nSteps'])
        
        self.shift_factor = pg.SpinBox(int=False, step=.1)
        self.shift_factor.setValue(s['shift_factor'])

        self.theta = pg.SpinBox(int=True, step=1)
        self.theta.setValue(s['theta'])

        self.triangle_scan = CheckBox()
        self.triangle_scan.setValue(s['triangle_scan'])

        self.interpolate = CheckBox()
        self.interpolate.setValue(s['interpolate'])

        self.trim_last_frame = CheckBox()
        self.trim_last_frame.setValue(s['trim_last_frame'])

        self.zscan = CheckBox()
        self.zscan.setValue(s['trim_last_frame'])

        
        self.items.append({'name': 'nSteps', 'string': 'Number of steps per volume', 'object': self.nSteps})
        self.items.append({'name': 'shift_factor', 'string': 'Shift Factor', 'object': self.shift_factor})
        self.items.append({'name': 'theta', 'string': 'Theta', 'object': self.theta})
        self.items.append({'name': 'triangle_scan', 'string': 'Trangle Scan', 'object': self.triangle_scan})
        self.items.append({'name': 'interpolate', 'string': 'Interpolate', 'object': self.interpolate})
        self.items.append({'name': 'trim_last_frame', 'string': 'Trim Last Frame', 'object': self.trim_last_frame})
        self.items.append({'name': 'zscan', 'string': 'Z scan', 'object': self.zscan})
        super().gui()
예제 #6
0
    def __init__(self):
        super().__init__()
        self.setTitle("Phase Pattern")
        self.layout = QGridLayout()

        self.amplitude = pg.SpinBox(value=1.0)
        self.l_value = pg.SpinBox(int=True, step=1)
        self.phase = pg.SpinBox()
        self.k = XYController("K")
        self.pos = XYController("Centre")

        self.amplitude.sigValueChanged.connect(self.value_changed.emit)
        self.l_value.sigValueChanged.connect(self.value_changed.emit)
        self.phase.sigValueChanged.connect(self.value_changed.emit)
        self.k.value_changed.connect(self.value_changed.emit)
        self.pos.value_changed.connect(self.value_changed.emit)

        self.layout.addWidget(QLabel("Amplitude:"), 0, 0, 1, 1)
        self.layout.addWidget(self.amplitude, 0, 1, 1, 1)
        self.layout.addWidget(QLabel("L:"), 0, 2, 1, 1)
        self.layout.addWidget(self.l_value, 0, 3, 1, 1)
        self.layout.addWidget(QLabel("Phase:"), 0, 4, 1, 1)
        self.layout.addWidget(self.phase, 0, 5, 1, 1)
        self.layout.addWidget(self.k, 1, 0, 1, 3)
        self.layout.addWidget(self.pos, 1, 3, 1, 3)
        self.setLayout(self.layout)
예제 #7
0
 def __init__(self, device, parent=None):
     super().__init__()
     vbox = QVBoxLayout()
     self.measurement_time = pg.SpinBox(value=0.01,
                                        suffix='s',
                                        bounds=(0.001, None))
     self.coincidence_window = pg.SpinBox(value=0.01,
                                          suffix='s',
                                          bounds=(0, None))
     self.long_button = QPushButton("Measure")
     self.long_button.setCheckable(True)
     self.measurement_thread = QThread()
     self.measurement_thread.finished.connect(self.run_measurement)
     self.long_button.clicked.connect(self.run_measurement)
     self.graph = pg.PlotWidget()
     self.setLayout(vbox)
     self.channel_1_data = np.zeros((300))
     self.channel_2_data = np.zeros((300))
     self.coincidences_data = np.zeros((300))
     self.channel_1 = self.graph.plot([], pen=pg.mkPen('b'))
     self.channel_2 = self.graph.plot([], pen=pg.mkPen('r'))
     self.coincidences = self.graph.plot([], pen=pg.mkPen('w'))
     self.device = device
     vbox.addWidget(self.measurement_time)
     vbox.addWidget(self.coincidence_window)
     vbox.addWidget(self.long_button)
     vbox.addWidget(self.graph)
     vbox.addWidget(SLMControllerWidget())
예제 #8
0
파일: App.py 프로젝트: sgaobnl/Cold_ADC
 def ViewControl(self):
     self.ViewControlgroupBox = QGroupBox("View Control")
     
     #Integer with bounds
     label1 = QLabel("Freq")
     label2 = QLabel("DAC")
     self.freqsp = pg.SpinBox(value=10, suffix='Hz',siPrefix=True, bounds=[10,20], minStep=1,step=1,wrapping=False)
     self.dacsp  = pg.SpinBox(value=10,step=1,int=True,bounds=[0,None],format='0x{value:X}',
                              regex='(0x)?(?P<number>[0-9a-fA-F]+)$',evalFunc=lambda s: ast.literal_eval('0x'+s))
     
     self.DacSelectbtn = QPushButton("External")
     self.DacSelectbtn.setCheckable(True) 
     
     self.Alignbtn = QPushButton("Align")
     layout1 = QHBoxLayout()
     layout1.addWidget(label1)
     layout1.addWidget(self.freqsp)
     layout1.addWidget(label2)
     layout1.addWidget(self.dacsp)
     
     layout2 = QHBoxLayout()
     layout2.addWidget(self.DacSelectbtn)
     layout2.addWidget(self.Alignbtn)
     
     layout = QVBoxLayout()
     layout.addLayout(layout1)
     layout.addLayout(layout2)
     #Set Layout
     self.ViewControlgroupBox.setLayout(layout)   
예제 #9
0
파일: main.py 프로젝트: krisfris/python-dsp
 def __init__(self, settings):
     super().__init__()
     self.settings = settings
     vbox = QVBoxLayout()
     hbox = QHBoxLayout()
     hbox.addWidget(QLabel('Interval (s):'))
     self.spin_interval = pg.SpinBox(compactHeight=False, bounds=(0.01, 10.0))
     self.spin_interval.setValue(self.settings.interval)
     self.spin_interval.valueChanged.connect(self.interval_changed)
     hbox.addWidget(self.spin_interval)
     vbox.addLayout(hbox)
     hbox = QHBoxLayout()
     hbox.addWidget(QLabel('lowcut:'))
     self.spin_lowcut = pg.SpinBox(compactHeight=False, bounds=(0, 10000), step=10)
     self.spin_lowcut.setValue(self.settings.lowcut)
     self.spin_lowcut.valueChanged.connect(self.lowcut_changed)
     hbox.addWidget(self.spin_lowcut)
     hbox.addWidget(QLabel('highcut:'))
     self.spin_highcut = pg.SpinBox(compactHeight=False, bounds=(0, 10000), step=10)
     self.spin_highcut.setValue(self.settings.highcut)
     self.spin_highcut.valueChanged.connect(self.highcut_changed)
     hbox.addWidget(self.spin_highcut)
     vbox.addLayout(hbox)
     vbox.addStretch()
     self.setLayout(vbox)
예제 #10
0
    def gui(self):
        self.gui_reset()
        s = g.settings['scaledAverageSubtract']

        #buttons
        self.analysisWin = WindowSelector()

        #spinboxes
        self.windowSize_Box = pg.SpinBox(int=True, step=1)
        self.windowSize_Box.setMinimum(1)
        self.windowSize_Box.setMaximum(100000)
        self.windowSize_Box.setValue(s['windowSize'])

        self.averageSize_Box = pg.SpinBox(int=True, step=1)
        self.averageSize_Box.setMinimum(1)
        self.averageSize_Box.setMaximum(100000)
        self.averageSize_Box.setValue(s['averageSize'])

        self.items.append({
            'name': 'windowSize',
            'string': '# of frames for rolling average:',
            'object': self.windowSize_Box
        })
        self.items.append({
            'name': 'averageSize',
            'string': '# of frames for peak average:',
            'object': self.averageSize_Box
        })
        self.items.append({
            'name': 'analysisWindow',
            'string': 'Choose window (with ROI) to analyse',
            'object': self.analysisWin
        })

        super().gui()
예제 #11
0
 def create_training_toolbox(self, tb):
     model_type_combo = self.init_combo_param(['svm'])
     self.model_form = {
         'Kernel': model_type_combo,
         'Gamma': pg.SpinBox(value=self.learner.gamma, step=1),
         'C': pg.SpinBox(value=self.learner.C, step=1)
     }
     self.create_toolbox(tb, 'Training', self.model_form)
예제 #12
0
 def create_neural_network_layer_toolbox(self, tb):
     self.nn_form_dict = {
         'n filter': pg.SpinBox(value=self.learner.n_filters[0], step=1),
         'n pool': pg.SpinBox(value=self.learner.n_pool, step=1),
         'n conv': pg.SpinBox(value=self.learner.n_conv[0], step=1),
         'droupout rate': pg.SpinBox(value=self.learner.dropout[0],
                                     step=0.05)
     }
     self.create_toolbox(tb, 'Layer #1', self.nn_form_dict)
예제 #13
0
def affichage(name, shareddic):
    """ Ploting and Display """
    pg.mkQApp()
    pg.setConfigOptions(antialias=True)  ## this will be expensive for the local plot
    force = pg.SpinBox(value=0, int=True, minStep=1, step=10, bounds=(-128, 128))#QtGui.QLineEdit()
    phase = pg.SpinBox(value=1, minStep=0.1, step=0.1, bounds=(0, 2))#QtGui.QLineEdit()
    freq = pg.SpinBox(value=55, minStep=1, step=1, dec=True, bounds=(0, 900))#QtGui.QLineEdit()
    label = QtGui.QLabel()
    #self.data = data
    #self.fps = fps
    labelf = QtGui.QLabel()
    labelf.setText('Force')
    labelp = QtGui.QLabel()
    labelp.setText('Phase')
    labelfr = QtGui.QLabel()
    labelfr.setText('Frequence')
    lcheck = QtGui.QCheckBox('plot local')
    lcheck.setChecked(True)
    lplt = pg.PlotWidget()
    lplt.setYRange(-45, 45)
    lplt.setTitle('Position')
    fplt = pg.PlotWidget()
    fplt.setYRange(-150, 150)
    fplt.setTitle('Forces')
    fplt.getAxis('bottom').setScale(1.0/RESANG)
    layout = pg.LayoutWidget()
    layout.addWidget(labelf)
    layout.addWidget(labelp)
    layout.addWidget(labelfr)
    layout.addWidget(force, row=2, col=0)
    layout.addWidget(phase, row=2, col=1)
    layout.addWidget(freq, row=2, col=2)
    layout.addWidget(lcheck, row=3, col=0)
    layout.addWidget(label, row=3, col=1)
    layout.addWidget(lplt, row=4, col=0, colspan=3)
    layout.addWidget(fplt, row=5, col=0, colspan=3)
    layout.resize(800, 800)
    layout.setWindowTitle('Timon 12: Demo')
    layout.show()
    def update(shareddic):
        """ Every refresh of the display """
        localdata = [0]*1000
        taille = shareddic['taille']
        localdata = shareddic['data']
        lplt.plot(localdata, clear=True)
        fps = shareddic['fps']
        label.setText("Communication %0.2f Hz Taille buffer: %0.2f" % (fps, taille/3.0))
        force = shareddic['force']
        degre = shareddic['degre']
        forcenow = shareddic['forcenow']
        fplt.plot(range(-ANGLEMAX*RESANG, ANGLEMAX*RESANG), force, clear=True)
        fplt.plot([degre*RESANG], [forcenow], pen=(0, 0, 255), symbolBrush=(255, 0, 0), symbolPen='r')
    timer = QtCore.QTimer()
    timer.timeout.connect(lambda: update(shareddic))
    timer.start(50)
    QtGui.QApplication.instance().exec_()
예제 #14
0
 def addEnvelope(self,etype='Coulomb',name='Env'):
     item = pg.TreeWidgetItem([name])
     self.envelopes.addChild(item)
     self.eNames.append(name)
     self.eTypes[name] = etype
     typeLabel = QtGui.QLabel(etype)
     item.setWidget(2,typeLabel)
     colorButton = ColorButton()
     self.eCButtons[name] = colorButton
     color = get_color()
     colorButton.setColor(color)
     item.setExpanded(True)
     self.eBoxes[name] = {}
     colorItem = pg.TreeWidgetItem(['Color'])
     if etype == 'Coulomb':
         item1 = pg.TreeWidgetItem(['Friction Angle'])
         item2 = pg.TreeWidgetItem(['Cohesion'])
         step1 = 1
         step2 = 50
     elif etype == 'Brown':
         item1 = pg.TreeWidgetItem(['m'])
         item2 = pg.TreeWidgetItem(['UCS'])
         step1 = 1
         step2 = 1
     else:
         print etype
         return 0
     item.addChild(colorItem)
     item.addChild(item1)
     item.addChild(item2)
     frictionBox = pg.SpinBox(value=50, step=step1)
     cohesionBox = pg.SpinBox(value=1e3, step=step2)
     frictionBox.sigValueChanged.connect(self.plot)
     cohesionBox.sigValueChanged.connect(self.plot)
     colorItem.setWidget(2,colorButton)
     item1.setWidget(2,frictionBox)
     item2.setWidget(2,cohesionBox)
     self.fBoxes[name] = frictionBox
     self.cBoxes[name] = cohesionBox
     for dname in self.dNames:
         child = pg.TreeWidgetItem([dname])
         item.addChild(child)
         box = CheckBox()
         child.setWidget(2,box)
         self.eBoxes[name][dname] = box
         box.click()
         box.clicked.connect(lambda:self.getEnvelope(name))
     removeEnvelopeItem = pg.TreeWidgetItem([''])
     item.addChild(removeEnvelopeItem)
     removeButton = QtGui.QPushButton('Remove')
     removeEnvelopeItem.setWidget(2,removeButton)
     removeButton.clicked.connect(lambda:self.removeEnvelope(item))
     colorButton.sigColorChanged.connect(self.plot)
     self.nEnvelopes += 1
     self.getEnvelope(eName=name)
예제 #15
0
    def setup_data_analysis_box(self):
        ''' '''
        self.DataAnalysisBox_layout = QW.QGridLayout()
        self.DataAnalysisBox.setLayout(self.DataAnalysisBox_layout)

        self.DataModification_label = QW.QLabel('Modifications:', self)
        self.DataModification_label.setFont(self.subtitle_font)
        self.DataAnalysisBox_layout.addWidget(self.DataModification_label, 0,
                                              0)

        self.flipX_cb = QW.QCheckBox(self.DataAnalysisBox)
        self.flipX_cb.setText('Flip x')
        self.flipX_cb.setChecked(True)
        #        self.flipX_checkBox.clicked.connect(self.flip_time_scale)
        self.DataAnalysisBox_layout.addWidget(self.flipX_cb, 1, 0)

        self.removeDC_cb = QW.QCheckBox(self.DataAnalysisBox)
        self.removeDC_cb.setText('Remove DC Offset')
        # self.removeDC_cb.clicked.connect(self.remove_DC_offset)
        self.removeDC_cb.setChecked(True)
        self.DataAnalysisBox_layout.addWidget(self.removeDC_cb, 2, 0)

        self.setTimeZero_cb = QW.QCheckBox(self.DataAnalysisBox)
        self.setTimeZero_cb.setText('Set time Zero')
        # self.setTimeZero_cb.clicked.connect(self.set_time_zero)
        self.setTimeZero_cb.setChecked(True)
        self.DataAnalysisBox_layout.addWidget(self.setTimeZero_cb, 3, 0)

        self.setTimeZero_sb = pg.SpinBox(self.DataAnalysisBox)
        self.setTimeZero_sb.setMinimumSize(1, 25)
        # self.shiftTimeZero_input.valueChanged.connect(self.set_time_zero)
        self.DataAnalysisBox_layout.addWidget(self.setTimeZero_sb, 2, 1)
        # self.shiftTimeZero_input.setValidator(QtGui.QDoubleValidator())
        # self.shiftTimeZero_input.textChanged.connect(self.setShiftTimeZero)

        # Filter
        # self.timeZero = 0
        self.filter_label = QW.QLabel('Filter [THz]', self.DataAnalysisBox)
        self.filter_label.setFont(self.subtitle_font)
        #        self.filterBox_name.setFont(font)
        self.DataAnalysisBox_layout.addWidget(self.filter_label, 0, 2)

        #        self.filterLowPass_label = qw.QLabel('Low Pass', self.DataAnalysisBox)

        self.filterLowPass_cb = QW.QCheckBox(self.DataAnalysisBox)
        self.filterLowPass_cb.setText('Low Pass Frequency')
        # self.setTimeZero_cb.clicked.connect(self.set_time_zero)
        self.filterLowPass_cb.setChecked(True)
        self.DataAnalysisBox_layout.addWidget(self.filterLowPass_cb, 1, 2)

        self.filterLowPass_sb = pg.SpinBox(self, dec=True)
        self.filterLowPass_sb.setMinimumSize(1, 25)
        # self.filterLowPassFreq.setPlaceholderText('freq')
        self.filterLowPass_sb.valueChanged.connect(self.filter_data_lowpass)
        self.DataAnalysisBox_layout.addWidget(self.filterLowPass_sb, 1, 3)
예제 #16
0
    def __init__(self, **kwd):
        super(AIWindow, self).__init__(**kwd)
        self.main_layout = main_layout = QtGui.QHBoxLayout()
        self.setLayout(main_layout)
        btn_layout = QtGui.QVBoxLayout()
        main_layout.addLayout(btn_layout)

        start_stop_save_layout = QtGui.QHBoxLayout()
        btn_layout.addLayout(start_stop_save_layout)

        self.start_stop_buttons = PlotterStartStopPauseSave(
            layout=start_stop_save_layout, parent=self)

        self.sample_rate = pg.SpinBox(value=1000,
                                      step=1,
                                      dec=True,
                                      int=True,
                                      siPrefix=True,
                                      bounds=[1, 100000],
                                      suffix='S/s')
        tmp = pg.LayoutWidget()
        tmp.addWidget(pg.QtGui.QLabel('Sample rate'), col=0)
        tmp.addWidget(self.sample_rate, col=1)
        btn_layout.addWidget(tmp)

        self.duration = pg.SpinBox(value=10,
                                   dec=True,
                                   step=1,
                                   bounds=[1, 10000],
                                   suffix=' s')
        tmp = pg.LayoutWidget()
        tmp.addWidget(pg.QtGui.QLabel('Acquisition duration'), col=0)
        tmp.addWidget(self.duration, col=1)
        btn_layout.addWidget(tmp)

        ai = AIConnection(with_enable_button=False)
        btn_layout.addWidget(ai.make_layout())
        self.ai = ai

        self.channels = []
        self.channel_items = ["off", "0", "1", "2", "3"]
        for i in range(4):
            chan = pg.ComboBox(
                items=self.channel_items,
                default=self.channel_items[1] if i == 0 else None)
            self.channels.append(chan)
            btn_layout.addWidget(chan)

        btn_layout.addStretch(1)

        self.add_plot_widgets()
        if self.parent():
            self.start_stop_buttons.connect(self.parent().new_tab_state)
    def __init__(self,
                 parent=None,
                 show_region=True,
                 show_crosshair=True,
                 show_label=True,
                 *args,
                 **kwargs):
        self.parent = parent

        super().__init__(parent)

        layout = QVBoxLayout(self)

        # # Set up the PlotWidget
        self.PlotWidget = CustomPlotWidget(self,
                                           show_region=show_region,
                                           show_crosshair=show_crosshair,
                                           show_label=show_label,
                                           *args,
                                           **kwargs)

        self.PlotWidget.region.sigRegionChanged.connect(
            self.updateBoxFromRegion)

        self.PlotItem = self.PlotWidget.PlotItem
        self.ViewBox = self.PlotWidget.ViewBox

        layout.addWidget(self.PlotWidget)

        # # Set up the region controls
        control_layout = QHBoxLayout()
        self.lower_box = pg.SpinBox(self, bounds=(None, None))
        self.lower_box.valueChanged.connect(self.updateRegionFromBox)
        self.lower_box_proxy = pg.SignalProxy(self.lower_box.valueChanged,
                                              rateLimit=30,
                                              slot=self.on_region_changed)
        self.upper_box = pg.SpinBox(self, bounds=(None, None))
        self.upper_box_proxy = pg.SignalProxy(self.upper_box.valueChanged,
                                              rateLimit=30,
                                              slot=self.on_region_changed)
        self.upper_box.valueChanged.connect(self.updateRegionFromBox)

        self.zoom_btn = QPushButton('Zoom', self)
        self.zoom_btn.clicked.connect(self.zoomToRegion)

        control_layout.addWidget(QLabel('Lower', self))
        control_layout.addWidget(self.lower_box)
        control_layout.addWidget(QLabel('Upper', self))
        control_layout.addWidget(self.upper_box)
        control_layout.addWidget(self.zoom_btn)
        layout.addLayout(control_layout)

        self.clear()
예제 #18
0
    def gui(self):
        s = g.settings['frame_remover']
        self.gui_reset()
        self.window = WindowSelector()
        self.removeFrames_button = QPushButton('Remove Frames')
        self.removeFrames_button.pressed.connect(self.removeFrames)

        self.start_slider = pg.SpinBox(int=True, step=1)
        self.start_slider.setValue(s['start'])

        self.end_slider = pg.SpinBox(int=True, step=1)
        self.end_slider.setValue(s['end'])

        self.frames_slider = pg.SpinBox(int=True, step=1)
        self.frames_slider.setValue(s['length'])

        self.interval_slider = pg.SpinBox(int=True, step=1)
        self.interval_slider.setValue(s['interval'])

        self.items.append({
            'name': 'window',
            'string': 'Select Window',
            'object': self.window
        })

        self.items.append({
            'name': 'start',
            'string': 'Start frame',
            'object': self.start_slider
        })
        self.items.append({
            'name': 'end',
            'string': 'End frame',
            'object': self.end_slider
        })
        self.items.append({
            'name': 'length',
            'string': 'Number of frames to remove',
            'object': self.frames_slider
        })
        self.items.append({
            'name': 'interval',
            'string': 'Interval',
            'object': self.interval_slider
        })

        self.items.append({
            'name': 'removeFrames_button',
            'string': '',
            'object': self.removeFrames_button
        })

        super().gui()
예제 #19
0
    def gui(self):
        self.gui_reset()
        red_window=WindowSelector()
        self.green_window=WindowSelector()
        self.x_shift_spin = pg.SpinBox(int=True, step=1)
        self.y_shift_spin = pg.SpinBox(int=True, step=1)

        self.items.append({'name': 'red_window', 'string': 'Overlay Red Window', 'object': red_window})
        self.items.append({'name': 'green_window', 'string': 'With Green Window', 'object': self.green_window})
        self.items.append({'name': 'x_shift', 'string': 'X Pixel Shift', 'object': self.x_shift_spin})
        self.items.append({'name': 'y_shift', 'string': 'Y Pixel Shift', 'object': self.y_shift_spin})
        super().gui()
예제 #20
0
    def __init__(self, **kwd):
        super(PlotterWindow, self).__init__(**kwd)
        self.main_layout = main_layout = QtGui.QHBoxLayout()
        self.setLayout(main_layout)
        btn_layout = QtGui.QVBoxLayout()
        main_layout.addLayout(btn_layout)

        start_stop_save_layout = QtGui.QHBoxLayout()
        btn_layout.addLayout(start_stop_save_layout)

        self.start_stop_buttons = PlotterStartStopPauseSave(
            layout=start_stop_save_layout, parent=self)

        self.sample_rate = pg.SpinBox(value=10,
                                      dec=True,
                                      step=1,
                                      bounds=[0.01, 100],
                                      suffix=' S/s')
        tmp = pg.LayoutWidget()
        tmp.addWidget(pg.QtGui.QLabel('Sample rate'), col=0)
        tmp.addWidget(self.sample_rate, col=1)
        btn_layout.addWidget(tmp)

        self.duration = pg.SpinBox(value=10,
                                   dec=True,
                                   step=1,
                                   bounds=[1, 10000],
                                   suffix=' s')
        tmp = pg.LayoutWidget()
        tmp.addWidget(pg.QtGui.QLabel('Acquisition duration'), col=0)
        tmp.addWidget(self.duration, col=1)
        btn_layout.addWidget(tmp)

        n = 4
        self.voltmeters = []
        for i in range(n):
            voltmeter = VoltmeterConnection(with_enable_button=True)
            if i < 1:
                voltmeter.enable_button.setCheckState(2)


#                voltmeter.set_state('Unconnected')
#                print([elm for elm in dir(type(voltmeter.enable_button)) if 'eck' in elm])
#                print(voltmeter.enable_button.setChecked(True))
#                voltmeter.enable_button.setState(True)
            btn_layout.addWidget(voltmeter.make_layout())
            self.voltmeters.append(voltmeter)
        btn_layout.addStretch(1)

        self.add_plot_widgets()
        if self.parent():
            self.start_stop_buttons.connect(self.parent().new_tab_state)
예제 #21
0
 def __init__(self, name):
     super().__init__()
     self.setTitle(name)
     self.layout = QGridLayout()
     self.x = pg.SpinBox()
     self.y = pg.SpinBox()
     self.x.sigValueChanged.connect(self.value_changed.emit)
     self.y.sigValueChanged.connect(self.value_changed.emit)
     self.layout.addWidget(QLabel("x:"), 0, 0)
     self.layout.addWidget(QLabel("y:"), 0, 5)
     self.layout.addWidget(self.x, 0, 1, 1, 4)
     self.layout.addWidget(self.y, 0, 6, 1, 4)
     self.setLayout(self.layout)
예제 #22
0
    def add_params_to_ui(self, params):
        """Add parameters to user interface.

        When the model function is changed and certain parameters are now part
        of the expression, they need to be added to the user interface.

        Args:
            params: a list of parameter names to add to the user interface.
        """
        for p in params:
            layout = QtWidgets.QHBoxLayout()
            layout.addWidget(QtWidgets.QLabel(f"{p}: ", minimumWidth=30))
            min_box = pg.SpinBox(value=-np.inf,
                                 finite=False,
                                 compactHeight=False)
            min_box.setMaximumWidth(75)
            layout.addWidget(min_box)
            self._idx_min_value_box = layout.count() - 1
            layout.addWidget(
                QtWidgets.QLabel("≤",
                                 alignment=QtCore.Qt.AlignHCenter
                                 | QtCore.Qt.AlignVCenter))
            value_box = pg.SpinBox(
                value=1.0,
                dec=True,
                step=0.1,
                minStep=0,
                finite=True,
                compactHeight=False,
            )
            value_box.sigValueChanging.connect(
                lambda: self.ui.show_initial_fit.setChecked(True))
            value_box.sigValueChanging.connect(self.plot_initial_model)
            value_box.setMaximumWidth(75)
            layout.addWidget(value_box)
            self._idx_value_box = layout.count() - 1
            layout.addWidget(
                QtWidgets.QLabel("≤",
                                 alignment=QtCore.Qt.AlignHCenter
                                 | QtCore.Qt.AlignVCenter))
            max_box = pg.SpinBox(value=+np.inf,
                                 finite=False,
                                 compactHeight=False)
            max_box.setMaximumWidth(75)
            layout.addWidget(max_box)
            self._idx_max_value_box = layout.count() - 1
            layout.addWidget(QtWidgets.QCheckBox("Fixed"))
            self._idx_fixed_checkbox = layout.count() - 1

            self._params[p] = layout
            self.ui.param_layout.addLayout(layout)
예제 #23
0
    def __init__(
        self,
        parent=None,
        value=1.,
        limits=[0.001, 1000],
        orientation=Qt.Horizontal,
    ):
        QWidget.__init__(self, parent)

        self._val = None
        self.limits = limits

        if orientation == Qt.Horizontal:
            self.mainlayout = QHBoxLayout()
        else:
            self.mainlayout = QVBoxLayout()
        self.setLayout(self.mainlayout)

        #~ self.spinbox = QDoubleSpinBox(decimals = 4, singleStep = .1,
        #~ minimum = self.limits[0], maximum = self.limits[1])
        self.spinbox = pg.SpinBox(decimals=4, step=.1, bounds=self.limits)

        self.mainlayout.addWidget(self.spinbox)
        self.slider = QSlider(Qt.Horizontal, minimum=0, maximum=100)
        self.mainlayout.addWidget(self.slider)
        self.slider.setMinimumWidth(20)

        self.spinbox.valueChanged.connect(self.spinbox_changed)
        self.slider.valueChanged.connect(self.slider_changed)
        self.setValue(value)
예제 #24
0
    def makeWidget(self):
        '''Extended SimpleParameter widget - float values only, additionally displaying 
        corresponding channel's color.

        Returns:
            widget with a color button and a spinbox for setting threshold value
        '''

        opts = self.param.opts
        t = opts['type']

        defs = {
            'value': 0,
            'min': None,
            'max': None,
            'step': 1.0,
            'dec': False,
            'siPrefix': False,
            'suffix': '',
            'decimals': 3,
        }
        for k in defs:
            if k in opts:
                defs[k] = opts[k]
        if 'limits' in opts:
            defs['bounds'] = opts['limits']
        w = pg.SpinBox()
        w.setOpts(**defs)
        w.sigChanged = w.sigValueChanged
        w.sigChanging = w.sigValueChanging

        return w
예제 #25
0
    def make_group(
            d,
            name: str = ''
    ):
        g = QtWidgets.QGroupBox()
        g.setTitle(str(name))
        layout = QtWidgets.QFormLayout()
        g.setLayout(layout)

        for row, key in enumerate(d):
            label = QtWidgets.QLabel(str(key))
            value = d[key]
            if isinstance(value, dict):
                wd = make_group(value, '')
                layout.addRow(str(key), wd)
            else:
                if isinstance(value, bool):
                    wd = QtWidgets.QCheckBox()
                    wd.setChecked(value)
                elif isinstance(value, numbers.Real):
                    wd = pg.SpinBox(value=value)
                else:
                    wd = QtWidgets.QLineEdit()
                    wd.setText(str(value))
                layout.addRow(label, wd)
        return g
예제 #26
0
    def __init__(self, parent=None, show_slider=True, show_spinbox=True):
        QT.QWidget.__init__(self, parent)

        self.layout = QT.QHBoxLayout()
        self.setLayout(self.layout)

        if show_slider:
            self.slider = QT.QSlider(orientation=QT.Qt.Horizontal,
                                     minimum=0,
                                     maximum=999)
            self.layout.addWidget(self.slider)
            self.slider.valueChanged.connect(self.slider_changed)
        else:
            self.slider = None

        if show_spinbox:
            self.spinbox = pg.SpinBox(decimals=4,
                                      bounds=[-np.inf, np.inf],
                                      suffix='s',
                                      siPrefix=True,
                                      step=0.1,
                                      dec=True,
                                      minStep=0.001)
            self.layout.addWidget(self.spinbox)
            self.spinbox.valueChanged.connect(self.spinbox_changed)
        else:
            self.spinbox = None

        self.t = 0  #  s
        self.set_start_stop(0., 10.)
예제 #27
0
    def gui(self):
        s=g.settings['annotator']
        self.gui_reset()
        #windows
        self.window_button = WindowSelector()

        #buttons         
        self.addIndex_button = QPushButton('Add Index')
        self.addIndex_button.pressed.connect(self.addIndex)  
        
        #boxes
        self.fontSize_slider = pg.SpinBox(int=True, step=1)
        self.fontSize_slider.setValue(s['fontSize'])
        
        self.fontColour_combobox = pg.ComboBox()
        self.fontColours = {'white': 1, 'black': 2}
        self.fontColour_combobox.setItems(self.fontColours)  
        
        self.textPosition_combobox = pg.ComboBox()
        self.textPosition = {'ms': 1, 'ma': 2, 'ls': 3, 'mb': 4, 'mt': 5, 'mm': 6, 'md': 7, 'rs': 8}
        self.textPosition_combobox.setItems(self.textPosition)         

        
        #self.exportFolder = FolderSelector('*.txt')
        self.items.append({'name': 'window', 'string': 'Select Window', 'object': self.window_button})
        self.items.append({'name': 'fontSize', 'string': 'Font Size', 'object': self.fontSize_slider})  
        self.items.append({'name': 'fontColour', 'string': 'Font Colour', 'object': self.fontColour_combobox}) 
        self.items.append({'name': 'textPosition', 'string': 'Anchor Position', 'object': self.textPosition_combobox})         
        self.items.append({'name': 'addIndex', 'string': 'Add Numbers to Image Stack ', 'object': self.addIndex_button})       
        super().gui()
예제 #28
0
    def __init__(self):
        pg.LayoutWidget.__init__(self)

        currRow = 0

        img = renderTeX(
            '$D(\\vec{r}) \\propto \\frac{r^{2/3}}{L^{2/3} + r^{2/3}}$')
        eqnLabel = QtGui.QLabel(alignment=QtCore.Qt.AlignHCenter)
        eqnLabel.setPixmap(QtGui.QPixmap.fromImage(img))
        self.addWidget(eqnLabel, row=currRow, col=0, colspan=2)
        currRow += 1

        self.addWidget(QtGui.QLabel('L:'), row=currRow, col=0)
        self.LSpinBox = pg.SpinBox(value=2.,
                                   bounds=[0, None],
                                   suffix='m',
                                   siPrefix=True,
                                   dec=True,
                                   step=1.0,
                                   minStep=0.1)
        self.addWidget(self.LSpinBox, row=currRow, col=1)
        currRow += 1

        genButton = QtGui.QPushButton('Generate field')
        self.addWidget(genButton, row=currRow, colspan=2)
        genButton.clicked.connect(self.generate)

        self.setHidden(True)
예제 #29
0
 def __init__(self):
   pg.LayoutWidget.__init__(self)
   
   currRow = 0
   img = renderTeX('$C(\\vec{r})\\propto \\mathrm{exp}(-r^2/a^2)' +
                   '$\n$' +
                   '\\Phi(\\vec{k}) \\propto \\mathrm{exp}(-a^2 k^2/4)$')
   eqnLabel = QtGui.QLabel(alignment=QtCore.Qt.AlignHCenter)
   eqnLabel.setPixmap(QtGui.QPixmap.fromImage(img))
   self.addWidget(eqnLabel,row=currRow,col=0,colspan=2)
   currRow += 1
   
   self.addWidget(QtGui.QLabel('a:'), row=currRow, col=0)
   self.aSpinBox = pg.SpinBox(value=1.,bounds=[0,None],suffix='m',
                         siPrefix=True, dec=True, step=0.5, minStep=0.1)
   self.addWidget(self.aSpinBox, row=currRow, col=1)
   currRow += 1
   
   self.covRB = QtGui.QRadioButton('Covariance')
   self.specRB = QtGui.QRadioButton('Spectrum')
   csButtonGroup = QtGui.QButtonGroup()
   csButtonGroup.addButton(self.covRB)
   csButtonGroup.addButton(self.specRB)
   csButtonGroup.setExclusive(True)
   self.csButtonGroup = csButtonGroup
   self.addWidget(self.covRB, row=currRow, col=0)
   self.addWidget(self.specRB, row=currRow, col=1)
   currRow += 1
   
   genButton = QtGui.QPushButton('Generate field')
   genButton.clicked.connect(self.generate)
   self.addWidget(genButton, row=currRow, colspan=2)
예제 #30
0
 def __init__(self):
   pg.LayoutWidget.__init__(self)
 
   # Title row
   currRow = 0
   for i,txt in enumerate(['x','y','z']):
     self.addWidget(QtGui.QLabel(txt,
         alignment=QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom),
         row=currRow, col=i+1)
   currRow += 1
   
   # Resolution row
   self.addWidget(QtGui.QLabel('N:',
       alignment=QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter),
       row=currRow, col=0)
   global NspinBoxes
   NspinBoxes = [QtGui.QSpinBox(value=64, minimum=1,maximum=1024) 
                 for _ in range(3)]
   for i,sb in enumerate(NspinBoxes):
     self.addWidget(sb,row=currRow,col=i+1)
   currRow += 1
   
   # Physical size row
   self.addWidget(QtGui.QLabel('L:',
       alignment=QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter),
       row=currRow, col=0)
   global LspinBoxes
   LspinBoxes = [pg.SpinBox(value=16.,bounds=[0,None],suffix='m',
                 siPrefix=True, dec=True, step=0.5, minStep=0.1)
                for _ in range(3) ]
   for i,sb in enumerate(LspinBoxes):
     self.addWidget(sb,row=currRow,col=i+1)
   currRow += 1