def runsequence(sram, cor): with labrad.connection() as cxn: fpga = cxn.ghz_dacs fpga.select_device(cor.board) if hasattr(cor, 'channel') and cor.channel == 1: sram = sram << 14 sram[0:4] |= 0xF << 28 fpga.run_sram(sram, True)
def initialize_layout(self): lcc = self.d_control global global_address global password with (labrad.connection(global_address, password=password, tls_mode="off")) as cxn: try: server = cxn.sd_tracker_global except: logger.error("SD tracker not initially connected") self.setDisabled(True) return transitions = server.get_transition_names() lcc.entry_table.fill_out(transitions) duration_B, duration_line_center = server.history_duration_local(cl.client_name) lcc.track_B_duration.blockSignals(True) lcc.track_line_center_duration.blockSignals(True) lcc.track_B_duration.setValue(duration_B["min"]) lcc.track_line_center_duration.setValue(duration_line_center["min"]) lcc.track_B_duration.blockSignals(False) lcc.track_line_center_duration.blockSignals(False) duration_line_center_global = server.history_duration_global_line_center(cl.client_name) lcc.track_global_line_center_duration.blockSignals(True) lcc.track_global_line_center_duration.setValue(duration_line_center_global["min"]) lcc.track_global_line_center_duration.blockSignals(False) bool_keep_last_point = server.bool_keep_last_point(cl.client_name) lcc.bool_keep_last_button.set_value_no_signal(bool_keep_last_point) global_or_local = server.bool_global(cl.client_name) global_fit_list = server.get_global_fit_list(cl.client_name) lcc.global_checkbox.set_value_no_signal(self.global_or_local) lcc.global_checkbox.setChecked(False) if global_or_local: lcc.track_global_line_center_duration.blockSignals(True) lcc.track_global_line_center_duration.setEnabled(True) lcc.track_global_line_center_duration.blockSignals(False) for name in global_fit_list: lcc.client_checkbox[name].blockSignals(True) lcc.client_checkbox[name].setChecked(True) lcc.client_checkbox[name].blockSignals(False) else: lcc.track_global_line_center_duration.blockSignals(True) lcc.track_global_line_center_duration.setEnabled(False) lcc.track_global_line_center_duration.blockSignals(False) for client in cl.client_list: if client == cl.client_name: lcc.client_checkbox[client].blockSignals(True) lcc.client_checkbox[client].setChecked(True) lcc.client_checkbox[client].setEnabled(False) lcc.client_checkbox[client].blockSignals(False) else: lcc.client_checkbox[client].blockSignals(True) lcc.client_checkbox[client].setEnabled(False) lcc.client_checkbox[client].setChecked(False) lcc.client_checkbox[client].blockSignals(False) self.on_new_fit(None, None)
import labrad cxn = labrad.connection() ps = cxn.keithley_2220_30_1() ps.select_device() a = ps.voltage()
import traceback import time import warnings import h5py from bokeh.plotting import figure, output_file, show, reset_output from bokeh.models import DatetimeTickFormatter, ColumnDataSource from bokeh.layouts import gridplot, widgetbox, layout, row from bokeh.models.widgets import Toggle, TextInput, Select, Div, Panel, Tabs from bokeh.models.annotations import Legend from bokeh.io import curdoc, push_session, push from bokeh.document import without_document_lock from concurrent.futures import ThreadPoolExecutor from tornado import gen #global stuff cxn = labrad.connection() scope = cxn.dsox3034a doc = curdoc() executor = ThreadPoolExecutor(max_workers=2) executor_pc = ThreadPoolExecutor(max_workers=2) channel_flag = [False, False, False, False] PC_flag = [False] res = [[], [], [], []] res_PC = [None] single_plot = [[], [], [], []] multi = [[], [], [], []] tab = [[], [], [], [], []] number_points_select_value = [100] channel_select_value = ["Channel 1", "Channel 1"]
def create_pmt_frame(self): pmtLabel = boldLabel("PMT") self.onButton = QtWidgets.QPushButton("On") self.onButton.setCheckable(True) self.onButton.clicked[bool].connect(self.set_state) self.setDCButton = QtWidgets.QPushButton("set") self.setDCButton.clicked.connect(self.set_dc_and_state_readout) self.clearPMTPlotButton = QtWidgets.QPushButton("clear") self.clearPMTPlotButton.clicked.connect(self.clear_pmt_plot) self.autoLoadButton = QtWidgets.QPushButton("On") self.autoLoadButton.setCheckable(True) self.autoLoadButton.clicked[bool].connect(self.toggle_autoload) self.autoLoadSpin = customIntSpinBox(0, (0, 1000000)) self.autoLoadCurrentSpin = customSpinBox(0, (0, 10), " A") self.countDisplay = QtWidgets.QLCDNumber() self.countDisplay.setSegmentStyle(2) self.countDisplay.display(0) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.updateLCD) self.timer.start(250) self.countDisplay.setStyleSheet("background-color: lightGray;" "color: green;") self.unitsLabel = QtWidgets.QLabel("kcounts / s") self.durationLabel = QtWidgets.QLabel("Duration (ms): ") self.duration = QtWidgets.QLineEdit("100") try: with labrad.connection() as cxn: p = cxn.parametervault p.set_parameter(["PmtReadout", "duration", U(100, "ms")]) except: logger.error("Failed to initially connect to labrad.") self.duration.setDisabled(True) validator = QtGui.QDoubleValidator() self.duration.setValidator(validator) self.duration.returnPressed.connect(self.duration_changed) self.duration.setStyleSheet("QLineEdit { background-color: #c4df9b}" ) self.modeLabel = QtWidgets.QLabel("Mode: ") self.setMode = customComboBox(["continuous", "pulsed"]) self.setMode.currentIndexChanged.connect(self.set_mode) layout = QtWidgets.QGridLayout() frame = QtWidgets.QFrame() frame.setFrameStyle(QtWidgets.QFrame.Panel | QtWidgets.QFrame.Sunken) frame.setLineWidth(2) frame.setMidLineWidth(3) layout.addWidget(pmtLabel, 0, 0, 1, 3) layout.addWidget(self.onButton, 1, 0) layout.addWidget(self.countDisplay, 1, 1) layout.addWidget(self.unitsLabel, 1, 2) layout.addWidget(self.durationLabel, 2, 0) layout.addWidget(self.duration, 2, 1, 1, 2) layout.addWidget(self.modeLabel, 3, 0) layout.addWidget(self.setMode, 3, 1, 1, 2) layout.addWidget(QtWidgets.QLabel("Autoload: "), 4, 0) layout.addWidget(self.autoLoadButton, 4, 1) layout.addWidget(self.autoLoadSpin, 4, 2) layout.addWidget(QtWidgets.QLabel("Current: "), 5, 0) layout.addWidget(self.autoLoadCurrentSpin, 5, 1) dcLabel = QtWidgets.QLabel("Set Doppler cooling and state readout: ") layout.addWidget(dcLabel, 6, 0, 1, 2) layout.addWidget(self.setDCButton, 6, 2) # clearLabel = QtWidgets.QLabel("Reset PMT plot: ") # layout.addWidget(clearLabel, 7, 0) # layout.addWidget(self.clearPMTPlotButton, 7, 1, 1, 2) frame.setLayout(layout) return frame