Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()

        main_layout = QW.QVBoxLayout(self)

        figure = Figure()
        figure.set_frameon(False)
        self.canvas = FigureCanvas(figure)
        self.canvas.setStyleSheet("background-color:transparent;")
        self.axis = self.canvas.figure.add_axes([0, 0.05, 0.2, 0.9])

        self.upperTextBox = QW.QLineEdit()
        self.lowerTextBox = QW.QLineEdit()

        main_layout.addWidget(self.upperTextBox)
        main_layout.addWidget(self.canvas)
        main_layout.addWidget(self.lowerTextBox)

        self.upperTextBox.returnPressed.connect(self._update_bounds)
        self.lowerTextBox.returnPressed.connect(self._update_bounds)

        #: Colour bar limits
        self.bounds = [numpy.nan, numpy.nan]

        self.setFixedWidth(80)
Ejemplo n.º 2
0
    def get_dataselection_layout(self):
        self.dataselection = QtWidgets.QGroupBox('Data selection')

        # range
        self.r = []
        for idx, label in enumerate(['X: ', 'Y: ', 'Channel: ']):
            self.r.append(QtWidgets.QLabel(label, self))
            self.r.append(
                QtWidgets.QLineEdit('{:4d}'.format(self.range[idx][0]), self))
            self.r.append(QtWidgets.QLabel(' to ', self))
            self.r.append(
                QtWidgets.QLineEdit('{:4d}'.format(self.range[idx][1]), self))

        # go button
        self.slicebutton = QtWidgets.QPushButton('Slice', self)
        self.slicebutton.clicked.connect(self.update_dataselection)

        # create layout
        layout = QtWidgets.QGridLayout()
        for idx in np.arange(3):
            layout.addWidget(self.r[4 * idx], idx, 0)
            layout.addWidget(self.r[4 * idx + 1], idx, 1)
            layout.addWidget(self.r[4 * idx + 2], idx, 2)
            layout.addWidget(self.r[4 * idx + 3], idx, 3)
        layout.addWidget(self.slicebutton, 3, 0, 1, 4)
        self.dataselection.setLayout(layout)
Ejemplo n.º 3
0
    def get_Galtemplate_layout(self):
        self.Galtemplate = QtWidgets.QGroupBox('Galaxy Template')
        self.Galplot = QtWidgets.QCheckBox('Plot template', self)
        self.Galz_label = QtWidgets.QLabel('z = ', self)
        self.Galz = QtWidgets.QLineEdit('{:5.4f}'.format(self.z[1]), self)
        self.Galcolor_label = QtWidgets.QLabel('Color: ', self)
        self.Galcolor = QtWidgets.QLineEdit(self.linecolor[1], self)
        self.Galscale_label = QtWidgets.QLabel('Scale factor: ', self)
        self.Galscale = QtWidgets.QLineEdit('{:5.2f}'.format(
            self.linescale[1], self))
        self.Gallabels = QtWidgets.QCheckBox('Plot labels', self)

        self.Galplot.stateChanged.connect(self.update_figures)
        self.Galz.returnPressed.connect(self.update_redshifts)
        self.Galcolor.returnPressed.connect(self.update_linecolors)
        self.Galscale.returnPressed.connect(self.update_linescales)
        self.Gallabels.stateChanged.connect(self.update_figures)

        # the layout
        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.Galplot, 0, 0, 1, 2)
        layout.addWidget(self.Gallabels, 0, 2, 1, 2)
        layout.addWidget(self.Galz_label, 1, 0, 1, 1)
        layout.addWidget(self.Galz, 1, 1, 1, 1)
        layout.addWidget(self.Galscale_label, 1, 2, 1, 1)
        layout.addWidget(self.Galscale, 1, 3, 1, 1)
        layout.addWidget(self.Galcolor_label, 2, 0, 1, 1)
        layout.addWidget(self.Galcolor, 2, 1, 1, 1)
        self.Galtemplate.setLayout(layout)
Ejemplo n.º 4
0
    def get_canvas2_layout(self):
        self.canvas2 = QtWidgets.QGroupBox('Canvas 2')

        # canvas 2
        self.fig2 = FigureCanvas(Figure(figsize=(0.5, 1.5)))
        self._ax2 = self.fig2.figure.subplots()
        self.fig2.figure.subplots_adjust(0.15, 0.19, 0.95, 0.95)

        # range of canvas 2
        self.r2 = []
        for idx, label in enumerate(['X range: ', 'Y range: ']):
            self.r2.append(QtWidgets.QLabel(label, self))
            self.r2.append(
                QtWidgets.QLineEdit('{:4.3f}'.format(self.range2[idx][0]),
                                    self))
            self.r2.append(QtWidgets.QLabel(' to ', self))
            self.r2.append(
                QtWidgets.QLineEdit('{:4.3f}'.format(self.range2[idx][1]),
                                    self))
        for idx in np.arange(1, 9, 2):
            self.r2[idx].returnPressed.connect(self.update_range2)

        # go button
        self.updaterange2button = QtWidgets.QPushButton('Update Range', self)
        self.updaterange2button.clicked.connect(self.update_range2)

        # the layout
        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.fig2, 0, 0, 1, 9)
        for idx in np.arange(8):
            layout.addWidget(self.r2[idx], 1, idx)
        layout.addWidget(self.updaterange2button, 1, 8)
        self.canvas2.setLayout(layout)
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        super(Page3, self).__init__(parent)
        integerValidator = QtGui.QIntValidator(0, 10, self)

        coordLabel = QtWidgets.QLabel('Coordinate File:')
        self.coordLine = QtWidgets.QLineEdit()
        coordBtn = QtWidgets.QPushButton('File', self)
        coordBtn.clicked.connect(self.getCoordfile)
        self.registerField('coordFile*', self.coordLine)

        popLabel = QtWidgets.QLabel('Population File:')
        self.popLine = QtWidgets.QLineEdit()
        popBtn = QtWidgets.QPushButton('File', self)
        popBtn.clicked.connect(self.getPopfile)
        self.registerField('popFile*', self.popLine)

        grid = QtWidgets.QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(coordLabel, 1, 0)
        grid.addWidget(self.coordLine, 1, 1)
        grid.addWidget(coordBtn, 1, 2)
        grid.addWidget(popLabel, 2, 0)
        grid.addWidget(self.popLine, 2, 1)
        grid.addWidget(popBtn, 2, 2)
        self.setLayout(grid)
Ejemplo n.º 6
0
    def __init__(self, parent=None, line=None):
        super(CurvePropertiesDialog, self).__init__(parent)
        self.line = line
        #labels
        self._label_color = QtWidgets.QLabel('Color')
        self._label_symbol = QtWidgets.QLabel('Symbol')
        #text inputs
        self._edit_color = QtWidgets.QLineEdit()
        self._edit_symbol = QtWidgets.QLineEdit()
        #buttons
        self._btn_ok = QtWidgets.QPushButton('OK')
        self._btn_cancel = QtWidgets.QPushButton('Cancel')
        #layout
        grid = QtWidgets.QGridLayout()
        self.setLayout(grid)
        grid.addWidget(self._label_color, 0, 0)
        grid.addWidget(self._edit_color, 0, 1)
        grid.addWidget(self._label_symbol, 1, 0)
        grid.addWidget(self._edit_symbol, 1, 1)
        grid.addWidget(self._btn_ok, 2, 0)
        grid.addWidget(self._btn_cancel, 2, 1)
        #connections
        self._btn_ok.clicked.connect(self.process_inputs)
        self._btn_cancel.clicked.connect(self.close)

        self.update_from_line(self.line)
Ejemplo n.º 7
0
    def __init__(self, l, r, u, d, parent=None):
        """"""
        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowTitle('Set Heatmap Domain')
        self.setWindowIcon(QtGui.QIcon('kiwi.png'))
        self.setMinimumWidth(400)

        self.header = QtWidgets.QLabel("All distances are relative to the array center.")

        self.leftLabel = QtWidgets.QLabel("Left/West:")
        self.lledit = QtWidgets.QLineEdit(self)
        self.lledit.setText(str(l))

        self.rightLabel = QtWidgets.QLabel("Right/East:")
        self.rledit = QtWidgets.QLineEdit(self)
        self.rledit.setText(str(r))

        self.upLabel = QtWidgets.QLabel("Up/North:")
        self.uledit = QtWidgets.QLineEdit(self)
        self.uledit.setText(str(u))

        self.downLabel = QtWidgets.QLabel("Down/South:")
        self.dledit = QtWidgets.QLineEdit(self)
        self.dledit.setText(str(d))

        self.activate = QtWidgets.QPushButton("Set")

        Box = QtWidgets.QVBoxLayout()

        Box.addWidget(self.header)

        left = QtWidgets.QHBoxLayout()
        left.addWidget(self.leftLabel)
        left.addWidget(self.lledit)

        right = QtWidgets.QHBoxLayout()
        right.addWidget(self.rightLabel)
        right.addWidget(self.rledit)

        up = QtWidgets.QHBoxLayout()
        up.addWidget(self.upLabel)
        up.addWidget(self.uledit)

        down = QtWidgets.QHBoxLayout()
        down.addWidget(self.downLabel)
        down.addWidget(self.dledit)

        Box.addLayout(left)
        Box.addLayout(right)
        Box.addLayout(up)
        Box.addLayout(down)

        Box.addWidget(self.activate)

        # Now put everything into the frame
        self.setLayout(Box)
Ejemplo n.º 8
0
    def __init__(self, parent=None):
        super(Page1, self).__init__(parent)
        integerValidator = QtGui.QIntValidator(0, 100, self)

        coordLabel = QtWidgets.QLabel('Coordinate File:')
        self.coordLine = QtWidgets.QLineEdit()
        coordBtn = QtWidgets.QPushButton('File', self)
        coordBtn.clicked.connect(self.getCoordfile)
        self.registerField('coordFile*', self.coordLine)

        popLabel = QtWidgets.QLabel('Population File:')
        self.popLine = QtWidgets.QLineEdit()
        popBtn = QtWidgets.QPushButton('File', self)
        popBtn.clicked.connect(self.getPopfile)
        self.registerField('popFile*', self.popLine)

        dataLabel = QtWidgets.QLabel('Data Directory:')
        self.dataLine = QtWidgets.QLineEdit()
        dataBtn = QtWidgets.QPushButton('File', self)
        dataBtn.clicked.connect(self.getDir)
        self.registerField('dataDir*', self.dataLine)

        allelesLabel = QtWidgets.QLabel('Number of alleles:')
        self.allelesLine = QtWidgets.QLineEdit()
        self.allelesLine.setValidator(integerValidator)
        self.registerField('alleleCount*', self.allelesLine)

        groupsLabel = QtWidgets.QLabel('Number of Groups:')
        self.groupsLine = QtWidgets.QLineEdit()
        self.groupsLine.setValidator(integerValidator)
        self.registerField('groupCount*', self.groupsLine)

        grid = QtWidgets.QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(coordLabel, 1, 0)
        grid.addWidget(self.coordLine, 1, 1)
        grid.addWidget(coordBtn, 1, 2)
        grid.addWidget(popLabel, 2, 0)
        grid.addWidget(self.popLine, 2, 1)
        grid.addWidget(popBtn, 2, 2)
        grid.addWidget(dataLabel, 3, 0)
        grid.addWidget(self.dataLine, 3, 1)
        grid.addWidget(dataBtn, 3, 2)
        grid.addWidget(allelesLabel, 4, 0)
        grid.addWidget(self.allelesLine, 4, 1)
        grid.addWidget(groupsLabel, 5, 0)
        grid.addWidget(self.groupsLine, 5, 1)

        self.setLayout(grid)
Ejemplo n.º 9
0
    def __init__(self, dimension):
        """
        Construct the widget

        Args:
            dimension: xarray.DataArray
        """
        super().__init__()

        main_layout = QW.QHBoxLayout(self)

        #: The dimension represented by this widget
        self.dimension = dimension

        self.title = QW.QLabel(dimension.name)
        self.textbox = QW.QLineEdit()
        self.slider = QW.QSlider(orientation=QtCore.Qt.Horizontal)

        self.slider.setMinimum(0)
        self.slider.setMaximum(dimension.size - 1)

        self.slider.valueChanged.connect(self._update_from_slider)
        self.textbox.returnPressed.connect(self._update_from_value)

        self.slider.setValue(0)
        self.textbox.setText(str(self.dimension[0].values))

        main_layout.addWidget(self.title)
        main_layout.addWidget(self.textbox)
        main_layout.addWidget(self.slider)
Ejemplo n.º 10
0
    def __init__(self,
                 db,
                 fig_dispatch,
                 text_dispatch,
                 result_dispatch,
                 *,
                 max_results=100):
        self.db = db
        self._hvw = HeaderViewerWidget(fig_dispatch, text_dispatch)
        self.fig_dispatch = fig_dispatch
        self.text_dispatch = text_dispatch
        self.result_dispatch = result_dispatch
        self.max_results = max_results
        self._results_summary = QtWidgets.QLabel()
        self._results = QtWidgets.QListWidget()
        self._results.currentItemChanged.connect(
            self._on_results_selection_changed)
        self._search_bar = QtWidgets.QLineEdit()
        self._search_bar.textChanged.connect(self._on_search_text_changed)
        self.widget = QtWidgets.QWidget()

        layout = QtWidgets.QVBoxLayout()
        sublayout = QtWidgets.QHBoxLayout()
        results_pane = QtWidgets.QVBoxLayout()
        results_pane.addWidget(self._results_summary)
        results_pane.addWidget(self._results)
        layout.addWidget(self._search_bar)
        layout.addLayout(sublayout)
        sublayout.addLayout(results_pane)
        sublayout.addWidget(self._hvw.widget)
        self.widget.setLayout(layout)
        self.search()
Ejemplo n.º 11
0
    def get_chanselect_layout(self):
        self.chanselect = QtWidgets.QGroupBox('Channel Select Controls')

        # create the channel slider
        self.channelslider = QtWidgets.QScrollBar(QtCore.Qt.Horizontal, self)
        self.channelslider.setRange(0, self.nchannels - 1)
        self.channelslider.valueChanged.connect(self.channelslider_changed)

        # define the channel text box
        self.channeltext_label = QtWidgets.QLabel(self)
        self.channeltext_label.setText('Channel: ')
        self.channeltext = QtWidgets.QLineEdit(str(self.channel), self)
        self.channeltext.setToolTip('The channel number you want to display')
        self.channeltext.returnPressed.connect(self.channeltext_changed)

        # RMS value
        self.rms = QtWidgets.QLabel(self)
        self.rms.setText('RMS value: {:10.7f}'.format(self.rmsval))

        # layout
        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.channeltext_label, 0, 0)
        layout.addWidget(self.channeltext, 0, 1)
        layout.addWidget(self.channelslider, 1, 0, 1, 2)
        layout.addWidget(self.rms, 2, 0, 1, 2)
        self.chanselect.setLayout(layout)
Ejemplo n.º 12
0
 def __init__(self, name, props, default=None):
     super(TextParam, self).__init__(name, props)
     self.setLayout( QtWidgets.QHBoxLayout() )
     self.lineedit = QtWidgets.QLineEdit()
     self.layout().addWidget(self.lineedit)
     self.set_value(default or props['default'])
     self.lineedit.editingFinished.connect(self.update)
Ejemplo n.º 13
0
    def __init__(self, name, props):
        super(SliderParam, self).__init__(name, props)
        self.setLayout( QtWidgets.QHBoxLayout() )
        self.slider = QtWidgets.QSlider()
        self.slider.setMouseTracking(False)
        self.slider.setProperty("value", 0)
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setInvertedAppearance(False)
        self.slider.setInvertedControls(False)
        self.slider.setTickPosition(QtWidgets.QSlider.TicksAbove)
        self.slider.setTickInterval(5)

        self.value_edit = QtWidgets.QLineEdit('0')
        self.value_edit.setMinimumSize(QtCore.QSize(20, 0))
        self.value_edit.setMaximumWidth(100)
        self.value_edit.setAlignment(
            QtCore.Qt.AlignRight |
            QtCore.Qt.AlignTrailing |
            QtCore.Qt.AlignVCenter)

        self.layout().addWidget(self.slider, stretch=4)
        self.layout().addWidget(self.value_edit, stretch=1)

        self.slider.valueChanged.connect(self.on_slider_changed)
        self.value_edit.editingFinished.connect(self.on_box_changed)
        start_value = self.props['default']
        limits = get_reasonable_range_limits(start_value)
        self.set_minimum(limits[0])
        self.set_maximum(limits[1])
        self.set_value(start_value)
Ejemplo n.º 14
0
    def get_moment_layout(self):
        self.moment = QtWidgets.QGroupBox('Moment')

        # The moment range boxes
        self.mr = []
        self.mr.append(QtWidgets.QLabel('Channel:', self))
        self.mr.append(
            QtWidgets.QLineEdit('{:4d}'.format(self.range[2][0]), self))
        self.mr.append(QtWidgets.QLabel(' to ', self))
        self.mr.append(
            QtWidgets.QLineEdit('{:4d}'.format(self.range[2][1]), self))

        # The mask buttons
        self.momentmask = []
        masklabel = [
            'Use mask for moment-0 with values above RMS of: ',
            'Use mask for moment-1 with values above RMS of: ',
            'Use mask for moment-2 with values above RMS of: '
        ]
        for label in masklabel:
            self.momentmask.append(QtWidgets.QCheckBox(label))
        self.momentmaskvalue = []
        for mmval in self.mmaskval:
            self.momentmaskvalue.append(
                QtWidgets.QLineEdit('{:10.7f}'.format(mmval), self))

        # Gaussian moment plot
        self.gaussianmoment = QtWidgets.QCheckBox('Gaussian moment')
        self.gaussianmoment.setChecked(False)

        # update moment button
        self.momentbutton = QtWidgets.QPushButton('Calculate Moments', self)
        self.momentbutton.clicked.connect(self.get_moments)

        # create layout
        layout = QtWidgets.QGridLayout()
        for idx in np.arange(4):
            layout.addWidget(self.mr[idx], 0, idx)
        for idx in np.arange(3):
            layout.addWidget(self.momentmask[idx], idx + 1, 0, 1, 3)
            layout.addWidget(self.momentmaskvalue[idx], idx + 1, 3)
        layout.addWidget(self.gaussianmoment, 4, 0, 1, 4)
        layout.addWidget(self.momentbutton, 5, 0, 1, 4)

        self.moment.setLayout(layout)
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        super(StartP, self).__init__(parent)
        integerValidator = QtGui.QIntValidator(0, 300, self)

        dataLabel = QtWidgets.QLabel('Data Directory:')
        self.dataLine = QtWidgets.QLineEdit()
        dataBtn = QtWidgets.QPushButton('File', self)
        dataBtn.clicked.connect(self.getDir)
        self.registerField('dataDir*', self.dataLine)

        allelesLabel = QtWidgets.QLabel('Number of alleles:')
        self.allelesLine = QtWidgets.QLineEdit()
        self.allelesLine.setValidator(integerValidator)
        self.registerField('alleleCount*', self.allelesLine)

        groupsLabel = QtWidgets.QLabel('Number of Groups:')
        self.groupsLine = QtWidgets.QLineEdit()
        self.groupsLine.setValidator(integerValidator)
        self.registerField('groupCount*', self.groupsLine)

        self.b1 = QtWidgets.QCheckBox("Females")
        self.b1.setChecked(False)
        self.registerField('females', self.b1)

        comboLabel = QtWidgets.QLabel('Graphic Type:')
        self.combo = QtWidgets.QComboBox(self)
        self.combo.addItem('Allele Counts')
        self.combo.addItem('Allele Heatmap')
        self.combo.addItem('Allele Stack')
        self.combo.addItem('Allele Geo-Map')
        self.registerField('graphic', self.combo)

        grid = QtWidgets.QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(dataLabel, 1, 0)
        grid.addWidget(self.dataLine, 1, 1)
        grid.addWidget(dataBtn, 1, 2)
        grid.addWidget(allelesLabel, 2, 0)
        grid.addWidget(self.allelesLine, 2, 1)
        grid.addWidget(groupsLabel, 3, 0)
        grid.addWidget(self.groupsLine, 3, 1)
        grid.addWidget(self.b1, 5, 1)
        grid.addWidget(comboLabel, 4, 0)
        grid.addWidget(self.combo, 4, 1)
        self.setLayout(grid)
Ejemplo n.º 16
0
 def __controls(self):
     #Quit Button
     self.btnQuit = QtWidgets.QPushButton('Quit', self)
     self.btnQuit.setToolTip('Quit from PyTrack')
     self.btnQuit.clicked.connect(self.parent.close)
     #Label stupida
     self.lblinfo = QtWidgets.QLabel(' ',self)
     self.lblinfo.setToolTip('http://esss.se')
     self.lblinfo.setPixmap(QtGui.QPixmap('ESS_Logo.png'))
     #Take a measurement
     self.btnStart = QtWidgets.QPushButton('Start',self)
     self.btnStart.clicked.connect(self.Start)
     self.btnStop = QtWidgets.QPushButton('Stop',self)
     self.btnStop.clicked.connect(self.Stop)
     #Label for Messages
     self.lblMessages=QtWidgets.QLabel('Press button to start',self)
     self.lblAuthors=QtWidgets.QLabel('MuYuan 2019\nSRF Section\nLinac Group\nAcceleration Division')
     self.lblAuthors.setAlignment(QtCore.Qt.AlignCenter)
     self.lblAuthors.setFont(QtGui.QFont('',10))
     #puts a canvas object here
     self.PSensorPlot=PSensorCanvas(self, width=5, height=3.5, dpi=144)
     self.PSensorPlot.setToolTip('IOC Measurement')
     #time message
     self.lblTimeMessages=QtWidgets.QLabel(time.strftime("%d-%m-%Y %H:%M:%S",time.localtime(time.time())),self)
     #other controls
     self.lblOperator=QtWidgets.QLabel('Operator',self)
     self.txtOperator=QtWidgets.QLineEdit(self)
     self.txtOperator.setText('SRF Team')
     self.txtOperator.setFixedWidth(100)
     self.lblLocation=QtWidgets.QLabel('Location',self)
     self.txtLocation=QtWidgets.QLineEdit(self)
     self.txtLocation.setText('SRF Laboratory')
     self.lblComments=QtWidgets.QLabel('Comments',self)
     self.txtComments=QtWidgets.QLineEdit(self)
     self.txtComments.setText('IOC waveform measurement')
     self.txtComments.setFixedWidth(300)
     self.lblScanInterval=QtWidgets.QLabel('Interval:',self)
     self.txtScanInterval=QtWidgets.QLineEdit(self)
     self.txtScanInterval.setText('1')
     self.txtScanInterval.setFixedWidth(40)
     self.lblUnit=QtWidgets.QLabel('s',self)
     self.btnInterval=QtWidgets.QPushButton('Apply',self)
     self.btnInterval.setEnabled(True)
     self.btnInterval.clicked.connect(self.setInterval)
Ejemplo n.º 17
0
 def __init__(self,parent=None,selected=None,raw_adc=False,raw_time=False,pedestal=None,distribute=None,fft=False,**ignored):
     super().__init__(parent)
     
     self._layout = QtWidgets.QVBoxLayout(self)
     
     self.set_selected(selected)
     
     self.fft_checkbox = QtWidgets.QCheckBox('Plot FFT')
     self.fft_checkbox.setCheckState(QtCore.Qt.Checked if fft else QtCore.Qt.Unchecked)
     self._layout.addWidget(self.fft_checkbox)
     
     self.raw_checkbox = QtWidgets.QCheckBox('Plot raw ADC counts')
     self.raw_checkbox.setCheckState(QtCore.Qt.Checked if raw_adc else QtCore.Qt.Unchecked)
     self._layout.addWidget(self.raw_checkbox)
     
     self.raw_time_checkbox = QtWidgets.QCheckBox('Plot sample index')
     self.raw_time_checkbox.setCheckState(QtCore.Qt.Checked if raw_time else QtCore.Qt.Unchecked)
     self._layout.addWidget(self.raw_time_checkbox)
     
     redist_layout = QtWidgets.QHBoxLayout()
     self.redist_checkbox = QtWidgets.QCheckBox('Redistribute signals')
     self.redist_checkbox.setCheckState(QtCore.Qt.Checked if distribute else QtCore.Qt.Unchecked)
     redist_layout.addWidget(self.redist_checkbox)
     self.redist_amount = QtWidgets.QLineEdit('0' if distribute is None else str(distribute))
     redist_layout.addWidget(self.redist_amount)
     self._layout.addLayout(redist_layout)
     
     ped_layout = QtWidgets.QHBoxLayout()
     self.baseline_checkbox = QtWidgets.QCheckBox('Correct baselines')
     self.baseline_checkbox.setCheckState(QtCore.Qt.Checked if pedestal else QtCore.Qt.Unchecked)
     ped_layout.addWidget(self.baseline_checkbox)
     self.ped_min = QtWidgets.QLineEdit('0' if pedestal is None else str(pedestal[0]))
     self.ped_min.setFixedWidth(100)
     ped_layout.addWidget(self.ped_min)
     self.ped_max = QtWidgets.QLineEdit('50' if pedestal is None else str(pedestal[1]))
     self.ped_max.setFixedWidth(100)
     ped_layout.addWidget(self.ped_max)
     self._layout.addLayout(ped_layout)
     
     buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
     buttons.accepted.connect(self.accept)
     buttons.rejected.connect(self.reject)
     self._layout.addWidget(buttons)
Ejemplo n.º 18
0
 def reshape_prompt(self):
     dialog = QtWidgets.QDialog()
     layout = QtWidgets.QFormLayout()
     layout.addRow(QtWidgets.QLabel("Choose Plot Grid Shape"))
     rowbox,colbox = QtWidgets.QLineEdit(str(self.rows)),QtWidgets.QLineEdit(str(self.cols))
     layout.addRow(QtWidgets.QLabel("Rows"),rowbox)
     layout.addRow(QtWidgets.QLabel("Cols"),colbox)
     buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, dialog)
     buttons.accepted.connect(dialog.accept)
     buttons.rejected.connect(dialog.reject)
     layout.addWidget(buttons)
     dialog.setLayout(layout)
     if dialog.exec_() == QtWidgets.QDialog.Accepted:
         try:
             r = int(rowbox.text())
             c = int(colbox.text())
             self.reshape(r,c)
         except:
             print('Invalid input to reshape dialog')
Ejemplo n.º 19
0
 def __init__(self, color, parent=None):
     QtWidgets.QHBoxLayout.__init__(self)
     assert isinstance(color, QtGui.QColor)
     self.lineedit = QtWidgets.QLineEdit(color.name(), parent)
     self.lineedit.editingFinished.connect(self.update_color)
     self.addWidget(self.lineedit)
     self.colorbtn = ColorButton(parent)
     self.colorbtn.color = color
     self.colorbtn.colorChanged.connect(self.update_text)
     self.addWidget(self.colorbtn)
Ejemplo n.º 20
0
    def __init__(self, tsne, cell_clusters, colors, out_dir, pr_res=None, trends_win=None):
        super().__init__()
        self._main = QtWidgets.QWidget()
        self.setCentralWidget(self._main)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        layout = QtWidgets.QVBoxLayout(self._main)

        self.tsne = tsne
        self.pr_res = pr_res
        self.cell_clusters = cell_clusters
        self.colors = colors
        self.out_dir = out_dir
        self.pseudotime = 0
        self.trends_win = trends_win

        self.done_button = QtWidgets.QPushButton("Done")
        self.done_button.clicked.connect(self.on_click_done)
        layout.addWidget(self.done_button)

        if pr_res:
            self.setWindowTitle("tSNE -- pseudotime")

            self.set_pseudotime = QtWidgets.QLineEdit(self)
            layout.addWidget(self.set_pseudotime)
            self.set_pseudotime_button = QtWidgets.QPushButton('set pseudotime')
            self.set_pseudotime_button.clicked.connect(self._update_pseudotime)
            layout.addWidget(self.set_pseudotime_button)

            self.slider = QtWidgets.QSlider(Qt.Horizontal)
            self.slider.setFocusPolicy(Qt.StrongFocus)
            self.slider.setTickPosition(QtWidgets.QSlider.TicksBothSides)
            self.slider.setMinimum(0)
            self.slider.setMaximum(10000)
            self.slider.setTickInterval(1)
            self.slider.setSingleStep(1)
            self.slider.valueChanged.connect(self._update_tsne)
            layout.addWidget(self.slider)

            self.pseudotime_cluster_button = QtWidgets.QPushButton('Set pseudotime cluster as cluster')
            self.pseudotime_cluster_button.clicked.connect(self._on_pseudotime_cluster_click)
            layout.addWidget(self.pseudotime_cluster_button)
        else:
            self.setWindowTitle("tSNE -- define custom clusters")

        tsne_canvas = FigureCanvas(Figure(figsize=(5, 5)))
        layout.addWidget(tsne_canvas)
        self.addToolBar(QtCore.Qt.BottomToolBarArea,
                        NavigationToolbar(tsne_canvas, self))
        self._tsne_fig = tsne_canvas.figure
        self._tsne_ax = tsne_canvas.figure.subplots()

        tsne_canvas.mpl_connect('button_release_event', self.on_mouse_click)

        fig, self._tsne_ax = palantir.plot.plot_tsne(self.tsne, fig=self._tsne_fig, ax=self._tsne_ax)
        self._tsne_ax.figure.canvas.draw()
Ejemplo n.º 21
0
 def __init__(self, color, parent=None):
     super().__init__()
     assert isinstance(color, QtGui.QColor)
     self.lineedit = QtWidgets.QLineEdit(
         mcolors.to_hex(color.getRgbF(), keep_alpha=True), parent)
     self.lineedit.editingFinished.connect(self.update_color)
     self.addWidget(self.lineedit)
     self.colorbtn = ColorButton(parent)
     self.colorbtn.color = color
     self.colorbtn.colorChanged.connect(self.update_text)
     self.addWidget(self.colorbtn)
Ejemplo n.º 22
0
 def add_QLineEdit(self, spec):
     widget = QtWidgets.QLineEdit()
     self.fields[spec['name']] = widget
     label_text = spec.get('label', spec['name'])
     self.layout.addWidget(QtWidgets.QLabel(label_text))
     self.layout.addWidget(widget)
     if 'default' in spec:
         widget.setText(spec['default'])
     if 'autocomplete-list' in spec:
         widget.setCompleter(QtWidgets.QCompleter(
             spec['autocomplete-list']))
Ejemplo n.º 23
0
    def get_controls_layout(self):
        self.controls = QtWidgets.QGroupBox('Image controls')

        # min and max values
        self.min_label = QtWidgets.QLabel(self)
        self.min_label.setText('Min: ')
        self.min = QtWidgets.QLineEdit('{:10.7f}'.format(self.vmin), self)
        self.min.setToolTip('The minimum value to display')
        self.min.returnPressed.connect(self.update_min)
        self.max_label = QtWidgets.QLabel(self)
        self.max_label.setText('Max: ')
        self.max = QtWidgets.QLineEdit('{:10.7f}'.format(self.vmax), self)
        self.max.setToolTip('The maxmimum value to display.')
        self.max.returnPressed.connect(self.update_max)

        # Contour value for scaling
        self.contval_label = QtWidgets.QLabel(self)
        self.contval_label.setText('Contour value: ')
        self.contval = QtWidgets.QLineEdit('{:10.7f}'.format(self.cval), self)
        self.contval.setToolTip('Value used to calculate the contour levels.')
        self.contval.returnPressed.connect(self.update_contourvalue)

        # Contour levels
        self.levels_label = QtWidgets.QLabel(self)
        self.levels_label.setText('Contour levels: ')
        self.levels = QtWidgets.QLineEdit(__arrtostr__(self.contours), self)
        self.levels.setToolTip('Contours levels to display ' +
                               '(in terms of RMS). Should be a list of ' +
                               'floats separated by commas.')
        self.levels.returnPressed.connect(self.update_contourlevels)

        # color map
        self.colormap_label = QtWidgets.QLabel(self)
        self.colormap_label.setText('Colormap: ')
        self.colormap = QtWidgets.QLineEdit('{}'.format(self.cmap), self)
        self.colormap.setToolTip('The color map to use for the display')
        self.colormap.returnPressed.connect(self.update_colormap)

        # Contour colors
        self.levelcolor_label = QtWidgets.QLabel(self)
        self.levelcolor_label.setText('Contour Color: ')
        self.levelcolor = QtWidgets.QLineEdit('{}'.format(self.ccolor), self)
        self.levelcolor.setToolTip('The color of the contours')
        self.levelcolor.returnPressed.connect(self.update_contourcolor)

        # create layout
        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.min_label, 0, 0)
        layout.addWidget(self.min, 0, 1)
        layout.addWidget(self.max_label, 1, 0)
        layout.addWidget(self.max, 1, 1)
        layout.addWidget(self.contval_label, 0, 2)
        layout.addWidget(self.contval, 0, 3)
        layout.addWidget(self.levels_label, 1, 2)
        layout.addWidget(self.levels, 1, 3)
        layout.addWidget(self.colormap_label, 0, 4)
        layout.addWidget(self.colormap, 0, 5)
        layout.addWidget(self.levelcolor_label, 1, 4)
        layout.addWidget(self.levelcolor, 1, 5)
        self.controls.setLayout(layout)
Ejemplo n.º 24
0
    def __init__(self, coords=(0., 0.), EPSG=4326, pEPSG=2193, tEPSG=3857, parent=None):
        """"""
        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowTitle('Set GPS Array Information')
        self.setWindowIcon(QtGui.QIcon('kiwi.png'))
        self.setMinimumWidth(400)

        self.coordsLabel = QtWidgets.QLabel("Coordinates")
        self.name1 = QtWidgets.QLineEdit(self)
        self.name1.setText(str(coords)[1:-1])

        self.EPSGLabel = QtWidgets.QLabel("EPSG")
        self.name2 = QtWidgets.QLineEdit(self)
        self.name2.setText(str(EPSG))

        self.EPSGLabel2 = QtWidgets.QLabel("Local Projected EPSG")
        self.name3 = QtWidgets.QLineEdit(self)
        self.name3.setText(str(pEPSG))

        self.EPSGLabel3 = QtWidgets.QLabel("Target EPSG")
        self.name4 = QtWidgets.QLineEdit(self)
        self.name4.setText(str(tEPSG))
        self.name4.setStatusTip("Save the current display to a PNG file.")

        self.activate = QtWidgets.QPushButton("Set")

        Box = QtWidgets.QVBoxLayout()
        Box.addWidget(self.coordsLabel)
        Box.addWidget(self.name1)
        Box.addWidget(self.EPSGLabel)
        Box.addWidget(self.name2)
        Box.addWidget(self.EPSGLabel2)
        Box.addWidget(self.name3)
        Box.addWidget(self.EPSGLabel3)
        Box.addWidget(self.name4)
        Box.addWidget(self.activate)

        # Now put everything into the frame
        self.setLayout(Box)
Ejemplo n.º 25
0
    def __init__(self, parent=None):
        super(Page4, self).__init__(parent)
        integerValidator = QtGui.QIntValidator(0, 10, self)

        comboLabel = QtWidgets.QLabel('Graphic Type:')
        dataLabel = QtWidgets.QLabel('Data Directory:')
        self.dataLine = QtWidgets.QLineEdit()
        dataBtn = QtWidgets.QPushButton('File', self)
        dataBtn.clicked.connect(self.getDir)
        self.registerField('popDir*', self.dataLine)

        allelesLabel = QtWidgets.QLabel('Number of alleles:')
        self.allelesLine = QtWidgets.QLineEdit()
        self.allelesLine.setValidator(integerValidator)
        self.registerField('alleleCount2*', self.allelesLine)

        groupsLabel = QtWidgets.QLabel('Number of Groups:')
        self.groupsLine = QtWidgets.QLineEdit()
        self.groupsLine.setValidator(integerValidator)
        self.registerField('groupCount2*', self.groupsLine)

        self.b1 = QtWidgets.QCheckBox("Females")
        self.b1.setChecked(False)
        self.registerField('females', self.b1)

        grid = QtWidgets.QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(dataLabel, 1, 0)
        grid.addWidget(self.dataLine, 1, 1)
        grid.addWidget(dataBtn, 1, 2)
        grid.addWidget(allelesLabel, 2, 0)
        grid.addWidget(self.allelesLine, 2, 1)
        grid.addWidget(groupsLabel, 3, 0)
        grid.addWidget(self.groupsLine, 3, 1)
        grid.addWidget(self.b1, 4, 1)

        self.setLayout(grid)
Ejemplo n.º 26
0
 def initializePage(self):
     groups = int(self.field('groupCount2'))
     alleles = int(self.field('alleleCount2'))
     integerValidator = QtGui.QIntValidator(0, 10, self)
     vbox = self.layout()
     for i in range(groups):
         hbox1 = QtWidgets.QHBoxLayout()
         hbox2 = QtWidgets.QHBoxLayout()
         glabel = QtWidgets.QLabel("group " + str(i + 1) + ":")
         gname = QtWidgets.QLineEdit()
         gname.setText('0')
         self.registerField('group' + str(i), gname)
         hbox1.addWidget(glabel)
         hbox1.addWidget(gname)
         for j in range(alleles):
             label = QtWidgets.QLabel(str(j + 1) + ":")
             line = QtWidgets.QLineEdit()
             line.setValidator(integerValidator)
             line.setText('0')
             self.registerField(str(i) + '-' + str(j), line)
             hbox2.addWidget(label)
             hbox2.addWidget(line)
         vbox.addLayout(hbox1)
         vbox.addLayout(hbox2)
Ejemplo n.º 27
0
    def get_print_layout(self):
        self.print = QtWidgets.QGroupBox('Save figure')
        self.savefile_label = QtWidgets.QLabel('File:', self)
        self.savefile = QtWidgets.QLineEdit('./JWSTfilter.pdf', self)
        self.savec1 = QtWidgets.QCheckBox('Canvas 1', self)
        self.savec2 = QtWidgets.QCheckBox('Canvas 2', self)
        self.save = QtWidgets.QPushButton('Save', self)
        self.save.clicked.connect(self.save_figures)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.savefile_label, 0, 0)
        layout.addWidget(self.savefile, 0, 1, 1, 2)
        layout.addWidget(self.savec1, 1, 0, 1, 1)
        layout.addWidget(self.savec2, 1, 1, 1, 1)
        layout.addWidget(self.save, 1, 2, 1, 1)
        self.print.setLayout(layout)
Ejemplo n.º 28
0
    def get_NIRSpec_layout(self):
        self.NIRSpec = QtWidgets.QGroupBox('NIRSpec spectral ranges')
        self.Nspec = []
        for idx, filt in enumerate(self.Nsmodes):
            self.Nspec.append(QtWidgets.QCheckBox(filt, self))
            self.Nspec.append(QtWidgets.QLabel('Color: ', self))
            self.Nspec.append(
                QtWidgets.QLineEdit('{:6.4f}'.format(self.Nscolors[idx]),
                                    self))
        for idx in np.arange(len(self.Nsmodes)):
            self.Nspec[3 * idx].stateChanged.connect(self.update_figures)
            self.Nspec[3 * idx + 2].returnPressed.connect(
                self.update_Nspeccolor)
        self.Nsselectall = QtWidgets.QPushButton('Select all', self)
        self.Nsselectall.clicked.connect(self.update_Nsselectall)

        # the layout
        layout = QtWidgets.QGridLayout()
        for idx in np.arange(len(self.Nsmodes)):
            for idx2 in np.arange(3):
                layout.addWidget(self.Nspec[3 * idx + idx2], idx, idx2)
        layout.addWidget(self.Nsselectall, 3 * idx + 1, 0, 1, 2)
        self.NIRSpec.setLayout(layout)
Ejemplo n.º 29
0
    def get_MIRIfilters_layout(self):
        self.MIRIfilter = QtWidgets.QGroupBox('MIRI filters')
        self.Mfilter = []
        for idx, filt in enumerate(self.Mfilters):
            self.Mfilter.append(QtWidgets.QCheckBox(filt, self))
            self.Mfilter.append(QtWidgets.QLabel('Color: ', self))
            self.Mfilter.append(
                QtWidgets.QLineEdit('{:6.4f}'.format(self.Mfcolors[idx]),
                                    self))
        for idx in np.arange(len(self.Mfilters)):
            self.Mfilter[3 * idx].stateChanged.connect(self.update_figures)
            self.Mfilter[3 * idx + 2].returnPressed.connect(
                self.update_Mfiltercolor)
        self.Mfselectall = QtWidgets.QPushButton('Select all', self)
        self.Mfselectall.clicked.connect(self.update_Mfselectall)

        # the layout
        layout = QtWidgets.QGridLayout()
        for idx in np.arange(len(self.Mfilters)):
            for idx2 in np.arange(3):
                layout.addWidget(self.Mfilter[3 * idx + idx2], idx, idx2)
        layout.addWidget(self.Mfselectall, 3 * idx + 1, 0, 1, 2)
        self.MIRIfilter.setLayout(layout)
Ejemplo n.º 30
0
    def get_parameter_layout(self):
        self.parameter = QtWidgets.QGroupBox('Model Parameters')

        # line edits for all of the parameters
        self.nparameters = len(self.qube.initpar)
        self.lepar_label = []
        self.lepar = []
        for idx, key in enumerate(self.qube.initpar.keys()):
            self.lepar_label.append(QtWidgets.QLabel(self))
            self.lepar_label[idx].setText(key + ': ')
            strval = str(self.qube.initpar[key]['Value'])
            self.lepar.append(QtWidgets.QLineEdit(strval, self))

        # the GO button
        self.gobutton = QtWidgets.QPushButton('OK', self)
        self.gobutton.clicked.connect(self.update_model)

        # layout
        layout = QtWidgets.QGridLayout()
        for idx in np.arange(self.nparameters):
            layout.addWidget(self.lepar_label[idx], idx, 0)
            layout.addWidget(self.lepar[idx], idx, 1)
        layout.addWidget(self.gobutton, idx + 1, 0, 1, 2)
        self.parameter.setLayout(layout)