def energyscan(start, end, npoints): mstart = energy.controller.calc_to_real(start) mend = energy.controller.calc_to_real(end) delta = abs(mend - mstart) / float(npoints) * mono.encoder.steps_per_unit mdelta = int(delta / mono.encoder.steps_per_unit) npoints = (delta * npoints / int(delta)) - 1 chain = AcquisitionChain() musst_acq_dev = MusstAcquisitionDevice( musst, program="monoscan.mprg", store_list=["timer", "ch2", "ch3"], vars={ "e1": mstart * mono.encoder.steps_per_unit, "e2": mend * mono.encoder.steps_per_unit, "de": mdelta, "monoangle": mono.position() * mono.encoder.steps_per_unit, "npoints": npoints }) master = MotorMaster(mono, start, end) # in this case, prepare can be done in parallel, is it always the case? # if yes, the code can be optimized chain.add(master, musst_acq_dev) cscan = Scan(DataManager()) cscan.set_acquisition_chain(chain) cscan.prepare() return cscan.start()
def __init__(self, *args): BlissWidget.__init__(self, *args) self.defineSignal("newScan", ()) self.scanObject = None self.xdata = [] self.ylable = "" self.mylog = 0 self.canAddPoint = True self.dm = DataManager() event.connect(self.dm, "scan_new", self.newScan) event.connect(self.dm, "scan_data", self.newScanPoint) self.addProperty("backgroundColor", "combo", ("white", "default"), "white") self.addProperty("graphColor", "combo", ("white", "default"), "white") self.lblTitle = QLabel(self) self.graphPanel = QFrame(self) buttonBox = QHBox(self) self.lblPosition = QLabel(buttonBox) self.graph = QtBlissGraph(self.graphPanel) QObject.connect(self.graph, PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal) QObject.disconnect( self.graph, SIGNAL("plotMousePressed(const QMouseEvent&)"), self.graph.onMousePressed, ) QObject.disconnect( self.graph, SIGNAL("plotMouseReleased(const QMouseEvent&)"), self.graph.onMouseReleased, ) self.graph.canvas().setMouseTracking(True) self.graph.enableLegend(False) self.graph.enableZoom(False) self.graph.setAutoLegend(False) self.lblPosition.setAlignment(Qt.AlignRight) self.lblTitle.setAlignment(Qt.AlignHCenter) self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) QVBoxLayout(self.graphPanel) self.graphPanel.layout().addWidget(self.graph) QVBoxLayout(self) self.layout().addWidget(self.lblTitle) self.layout().addWidget(buttonBox) self.layout().addWidget(self.graphPanel)