def __init__(self): QtGui.QMainWindow.__init__(self) self.multimeter = lakeshore370.Lakeshore370(pad=13) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle("application main window") self.file_menu = QtGui.QMenu('&File', self) self.file_menu.addAction('&Quit', self.fileQuit, QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.menuBar().addMenu(self.file_menu) self.help_menu = QtGui.QMenu('&Help', self) self.menuBar().addSeparator() self.menuBar().addMenu(self.help_menu) self.help_menu.addAction('&About', self.about) self.main_widget = QtGui.QWidget(self) l = QtGui.QVBoxLayout(self.main_widget) sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) dc.set_multimeter(self.multimeter) l.addWidget(sc) l.addWidget(dc) self.main_widget.setFocus() self.setCentralWidget(self.main_widget) self.statusBar().showMessage("All hail matplotlib!", 2000)
def __init__(self, tempcontrolpad=13, app=None): '''Provides control of ADR Systems ''' if app is None: self.app = Qt.QApplication(sys.argv) #setup plot window else: self.app = app self.logfolder = '/home/pcuser/data/ADRLogs/' self.tccheckfolder = '/home/pcuser/data/' self.maguptime = 1.0 self.magdowntime = 0.5 self.pausetime = 5.0 #This is the value to change to try and get 9 A # self.vmax = 0.60 # Velma #self.vmax = 0.77 # Horton with filter self.vmax = 0.89 # Mystery Machine self.rshunt = 100 self.iupend = self.vmax / self.rshunt / 0.01 * 100 self.idownend = 0.0 self.tempcontrol = lakeshore370.Lakeshore370(pad=tempcontrolpad) self.heatswitch = zaber.Zaber() self.bridge = lr700.LR700(pad=17) print( 'WARNING: this is deprecated, please use adrcontrol_mpl.py instead' )
def __init__(self, pad = 4): ''' Constructor ''' # Make an instance of the Keithley 2700 Multimeter with primary gpib address (default of 4) self.multimeter = lakeshore370.Lakeshore370(pad=13) self.raw_data = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.] self.x_data = arange(len(self.raw_data)) app = Qt.QApplication(sys.argv) demo = self.make() sys.exit(app.exec_())
def __init__(self, *args): QMainWindow.__init__(self, *args) self.lakeshore = lakeshore370.Lakeshore370(pad=13) self.bridge = lr700.LR700(pad=17) self.hpm = hp34401a.HP34401a(pad=22) self.time0 = time() self.timerstep = 250 self.plot = DataPlot(self) self.plot.setMargin(5) self.setContextMenuPolicy(Qt.NoContextMenu) self.zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection, QwtPicker.AlwaysOff, self.plot.canvas()) self.zoomer.setRubberBandPen(QPen(Qt.green)) self.picker = QwtPlotPicker( QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.PointSelection | QwtPicker.DragSelection, QwtPlotPicker.CrossRubberBand, QwtPicker.AlwaysOn, self.plot.canvas()) self.picker.setRubberBandPen(QPen(Qt.green)) self.picker.setTrackerPen(QPen(Qt.red)) self.central_widget = QWidget(self) self.setCentralWidget(self.central_widget) #self.setCentralWidget(self.plot) # Create the vertical layout widget self.layout_widget = QWidget(self.central_widget) self.layout = QVBoxLayout(self.central_widget) # Create the plot layout widget self.plot_layout_widget = QGroupBox("Plot", self.layout_widget) self.plot_layout = QHBoxLayout(self.plot_layout_widget) self.plot_layout_widget.setLayout(self.plot_layout) # Put the plot in the plot layout widget self.plot_layout.addWidget(self.plot) # Put plot layout widget in overall layout widget self.layout.addWidget(self.plot_layout_widget) #Buttons #Create the layout widget for the buttons self.buttons_layout_widget = QGroupBox("Buttons", self.layout_widget) self.buttons_layout = QHBoxLayout(self.buttons_layout_widget) self.buttons_layout_widget.setLayout(self.buttons_layout) #Create the buttons self.start_button = QPushButton('Start') self.stop_button = QPushButton('Stop') self.save_button = QPushButton('Save Data') #Connect buttons to button events self.connect(self.start_button, SIGNAL("clicked()"), self.start_event) self.connect(self.stop_button, SIGNAL("clicked()"), self.stop_event) self.connect(self.save_button, SIGNAL("clicked()"), self.save_event) #Add buttons to button layout self.buttons_layout.addWidget(self.start_button) self.buttons_layout.addWidget(self.stop_button) self.buttons_layout.addWidget(self.save_button) # Add button layout to overall layout self.layout.addWidget(self.buttons_layout_widget) # Add GUI Actions # Exit Action exit = QtGui.QAction(QtGui.QIcon('icons/exit.png'), 'Exit', self) exit.setShortcut('Ctrl+Q') exit.setStatusTip('Exit application') self.connect(exit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()')) # Print Action printdata = QtGui.QAction(QtGui.QIcon('icons/exit.png'), 'Print', self) printdata.setShortcut('Ctrl+P') printdata.setStatusTip('Print data') self.connect(printdata, QtCore.SIGNAL('triggered()'), self.print_) # Export PDF Action exportpdfaction = QtGui.QAction(QtGui.QIcon('icons/exit.png'), 'Export PDF', self) exportpdfaction.setStatusTip('Export Plot as PDF') self.connect(exportpdfaction, QtCore.SIGNAL('triggered()'), self.exportPDF) # Add menubar menubar = self.menuBar() file = menubar.addMenu('&File') #Add File Item file.addAction(printdata) file.addAction(exportpdfaction) file.addSeparator() file.addAction(exit) #Add Exit # Toolbar # Create toolbar toolBar = QToolBar(self) # Add toolbar to main window self.addToolBar(toolBar) # Create button to toggle zoom on and off self.btnZoom = QToolButton(toolBar) self.btnZoom.setText("Zoom") self.btnZoom.setIcon(QIcon(QPixmap(zoom_xpm))) self.btnZoom.setCheckable(True) self.btnZoom.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(self.btnZoom) # Create e to autoscale btnautoscale = QToolButton(toolBar) btnautoscale.setText("Autoscale") btnautoscale.setIcon(QIcon(QPixmap(zoom_xpm))) btnautoscale.setCheckable(True) btnautoscale.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnautoscale) self.connect(btnautoscale, SIGNAL('toggled(bool)'), self.autoscale) btnautoscale.toggle() self.autoScaleOn = True #self.autoscale(True) toolBar.addSeparator() #Create box for the timer button timerBox = QWidget(toolBar) #Create a loyout widget for the box timerBoxLayout = QHBoxLayout(timerBox) timerBoxLayout.setSpacing(0) timerBoxLayout.addWidget(QWidget(timerBox), 10) # spacer timerBoxLayout.addWidget(QLabel("Timer Value", timerBox), 0) timerBoxLayout.addSpacing(10) # Counter for Timing self.cntTimer = QwtCounter(timerBox) self.cntTimer.setRange(1, 10000, 1) self.cntTimer.setValue(self.timerstep) timerBoxLayout.addWidget(self.cntTimer, 10) # Add the box to timerBox to the toolbar toolBar.addWidget(timerBox) self.statusBar() self.zoom(False) self.showInfo() self.connect(self.cntTimer, SIGNAL('valueChanged(double)'), self.setTimer) self.connect(self.btnZoom, SIGNAL('toggled(bool)'), self.zoom) self.connect(self.picker, SIGNAL('moved(const QPoint &)'), self.moved) self.connect(self.picker, SIGNAL('selected(const QaPolygon &)'), self.selected) self.x = np.zeros(0, float) self.y = np.zeros(0, float) self.z = np.zeros(0, float) self.counter = 0.0 self.phase = 0.0
def __init__(self, lakeshore_pad): import lakeshore370 self.lakeshore = lakeshore370.Lakeshore370(pad=lakeshore_pad)