Example #1
0
        def connect(self,
                    ws,
                    call_back,
                    xmin=None,
                    xmax=None,
                    range_min=None,
                    range_max=None,
                    x_title=None,
                    log_scale=False,
                    ws_output_base=None):
            if not IS_IN_MANTIDPLOT:
                print "RangeSelector cannot be used output MantidPlot"
                return

            self._call_back = call_back
            self._ws_output_base = ws_output_base

            mantidplot.app.connect(
                mantidplot.app.mantidUI,
                QtCore.SIGNAL("x_range_update(double,double)"),
                self._call_back)
            g = mantidplot.graph(self._graph)

            if g is not None:
                g.close()

            g = mantidplot.plotSpectrum(ws, [0], True)
            g.setName(self._graph)
            l = g.activeLayer()
            try:
                title = ws[0].replace("_", " ")
                title.strip()
            except:
                title = " "
            l.setTitle(" ")
            l.setCurveTitle(0, title)
            if log_scale:
                l.logYlinX()
            if x_title is not None:
                l.setXTitle(x_title)
            if xmin is not None and xmax is not None:
                l.setScale(2, xmin, xmax)

            if range_min is not None and range_max is not None:
                mantidplot.selectMultiPeak(g, False, range_min, range_max)
            else:
                mantidplot.selectMultiPeak(g, False)
Example #2
0
        def connect(self, ws, call_back, xmin=None, xmax=None, 
                    range_min=None, range_max=None, x_title=None,
                    log_scale=False,
                    ws_output_base=None):
            if not IS_IN_MANTIDPLOT:
                print "RangeSelector cannot be used output MantidPlot"
                return
            
            self._call_back = call_back
            self._ws_output_base = ws_output_base
            
            mantidplot.app.connect(mantidplot.app.mantidUI,
                             QtCore.SIGNAL("x_range_update(double,double)"),
                             self._call_back)
            g = mantidplot.graph(self._graph)

            if g is not None:
                g.close()
                
            g = mantidplot.plotSpectrum(ws, [0], True)
            g.setName(self._graph)        
            l=g.activeLayer()
            try:
                title = ws[0].replace("_"," ")
                title.strip()
            except:
                title = " "
            l.setTitle(" ")
            l.setCurveTitle(0, title)
            if log_scale:
                l.logYlinX()
            if x_title is not None:
                l.setXTitle(x_title)
            if xmin is not None and xmax is not None:
                l.setScale(2,xmin,xmax)
                
            if range_min is not None and range_max is not None:
                mantidplot.selectMultiPeak(g, False, range_min, range_max)
            else:
                mantidplot.selectMultiPeak(g, False)