Esempio n. 1
0
    def _integrated_plot(self, is_high_res, file_ctrl, min_ctrl, max_ctrl):
        """
            Plot counts as a function of:

            Low-resolution pixels
                For REFM, this is Y
                For REFL, this is X

            High-resolution pixels
                For REFM, this is X
                For REFL, this is Y

            @param is_high_res: True if we are plotting the high-res pixel distribution
            @param file_ctrl: control widget containing the data file name
            @param min_ctrl: control widget containing the range minimum
            @param max_ctrl: control widget containing the range maximum
        """
        if not IS_IN_MANTIDPLOT:
            return

        f = []
        try:
            f = FileFinder.findRuns("%s%s" % (self.instrument_name, str(file_ctrl.text())))
        except:
            try:
                f = FileFinder.findRuns(str(file_ctrl.text()))
            except:
                print "Could not find file for %s" % str(file_ctrl.text())
                return

        range_min = int(min_ctrl.text())
        range_max = int(max_ctrl.text())

        if len(f)>0 and os.path.isfile(f[0]):
            def call_back(xmin, xmax):
                min_ctrl.setText("%-d" % int(xmin))
                max_ctrl.setText("%-d" % int(xmax))

            # For REFL, Y is high-res
            is_pixel_y = is_high_res
            # For REFM it's the other way around
            if self.short_name == "REFM":
                is_pixel_y = not is_pixel_y

            tof_min = int(self._summary.data_from_tof.text())
            tof_max = int(self._summary.data_to_tof.text())

            print 'file requested is: ' , f[0]

            min, max = data_manipulation.counts_vs_pixel_distribution(f[0], is_pixel_y=is_pixel_y,
                                                                      callback=call_back,
                                                                      range_min=range_min,
                                                                      range_max=range_max,
                                                                      high_res=is_high_res,
                                                                      instrument=self.short_name,
                                                                      tof_min=tof_min,
                                                                      tof_max=tof_max)
            return min, max
Esempio n. 2
0
    def _integrated_plot(self, is_high_res, file_ctrl, min_ctrl, max_ctrl):
        """
            Plot counts as a function of:

            Low-resolution pixels
                For REFM, this is Y
                For REFL, this is X

            High-resolution pixels
                For REFM, this is X
                For REFL, this is Y

            @param is_high_res: True if we are plotting the high-res pixel distribution
            @param file_ctrl: control widget containing the data file name
            @param min_ctrl: control widget containing the range minimum
            @param max_ctrl: control widget containing the range maximum
        """
        if not IS_IN_MANTIDPLOT:
            return

        f = []
        try:
            f = FileFinder.findRuns("%s%s" % (self.instrument_name, str(file_ctrl.text())))
        except:
            try:
                f = FileFinder.findRuns(str(file_ctrl.text()))
            except:
                print "Could not find file for %s" % str(file_ctrl.text())
                return

        range_min = int(min_ctrl.text())
        range_max = int(max_ctrl.text())

        if len(f)>0 and os.path.isfile(f[0]):
            def call_back(xmin, xmax):
                min_ctrl.setText("%-d" % int(xmin))
                max_ctrl.setText("%-d" % int(xmax))

            # For REFL, Y is high-res
            is_pixel_y = is_high_res
            # For REFM it's the other way around
            if self.short_name == "REFM":
                is_pixel_y = not is_pixel_y

            tof_min = int(self._summary.data_from_tof.text())
            tof_max = int(self._summary.data_to_tof.text())

            print 'file requested is: ', f[0]

            min, max = data_manipulation.counts_vs_pixel_distribution(f[0], is_pixel_y=is_pixel_y,
                                                                      callback=call_back,
                                                                      range_min=range_min,
                                                                      range_max=range_max,
                                                                      high_res=is_high_res,
                                                                      instrument=self.short_name,
                                                                      tof_min=tof_min,
                                                                      tof_max=tof_max)
            return min, max
Esempio n. 3
0
    def _integrated_plot(self, is_high_res, file_ctrl, min_ctrl, max_ctrl):
        """
            Plot counts as a function of:

            Low-resolution pixels
                For REFM, this is Y
                For REFL, this is X

            High-resolution pixels
                For REFM, this is X
                For REFL, this is Y

            @param is_high_res: True if we are plotting the high-res pixel distribution
            @param file_ctrl: control widget containing the data file name
            @param min_ctrl: control widget containing the range minimum
            @param max_ctrl: control widget containing the range maximum
        """
        if not IS_IN_MANTIDPLOT:
            return

        try:
            f = FileFinder.findRuns(
                "%s%s" % (self.instrument_name, str(file_ctrl.text())))[0]

            range_min = int(min_ctrl.text())
            range_max = int(max_ctrl.text())

            def call_back(xmin, xmax):
                min_ctrl.setText("%-d" % int(xmin))
                max_ctrl.setText("%-d" % int(xmax))

            # For REFL, Y is high-res
            is_pixel_y = is_high_res
            # For REFM it's the other way around
            if self.short_name == "REFM":
                is_pixel_y = not is_pixel_y

            min, max = data_manipulation.counts_vs_pixel_distribution(
                f,
                is_pixel_y=is_pixel_y,
                callback=call_back,
                range_min=range_min,
                range_max=range_max,
                high_res=is_high_res,
                instrument=self.short_name)
            return min, max
        except:
            pass
Esempio n. 4
0
    def _integrated_plot(self, is_high_res, file_ctrl, min_ctrl, max_ctrl):
        """
            Plot counts as a function of:
            
            Low-resolution pixels
                For REFM, this is Y
                For REFL, this is X
                
            High-resolution pixels
                For REFM, this is X
                For REFL, this is Y  
                
            @param is_high_res: True if we are plotting the high-res pixel distribution
            @param file_ctrl: control widget containing the data file name
            @param min_ctrl: control widget containing the range minimum
            @param max_ctrl: control widget containing the range maximum
        """
        if not IS_IN_MANTIDPLOT:
            return

        try:
            f = FileFinder.findRuns("%s%s" % (self.instrument_name, str(file_ctrl.text())))[0]

            range_min = int(min_ctrl.text())
            range_max = int(max_ctrl.text())

            def call_back(xmin, xmax):
                min_ctrl.setText("%-d" % int(xmin))
                max_ctrl.setText("%-d" % int(xmax))

            # For REFL, Y is high-res
            is_pixel_y = is_high_res
            # For REFM it's the other way around
            if self.short_name == "REFM":
                is_pixel_y = not is_pixel_y

            min, max = data_manipulation.counts_vs_pixel_distribution(
                f,
                is_pixel_y=is_pixel_y,
                callback=call_back,
                range_min=range_min,
                range_max=range_max,
                high_res=is_high_res,
                instrument=self.short_name,
            )
            return min, max
        except:
            pass
Esempio n. 5
0
    def _plot_data_count_vs_tof_2d(self):
        #Bring to life the RefDetectorViewer and display counts(X) vs TOF
        #integrated over Y

         #retrieve name of workspace first
        run_number =  self._summary.data_run_number_edit.text()
        file_path = FileFinder.findRuns("%s%s" % (self.instrument_name, str(run_number)))[0]

        basename = os.path.basename(file_path)
        ws_base = "__%s" % basename

        ws_output_base_ff = "Counts vs X pixel - " + basename + " Off_Off"
        if AnalysisDataService.doesExist(ws_output_base_ff):
            AnalysisDataService.remove(ws_output_base_ff)
            ws_output_base_1 = ws_output_base_ff + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - Off_Off"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_nf = "Counts vs X pixel - " + basename + " On_Off"
        if AnalysisDataService.doesExist(ws_output_base_nf):
            AnalysisDataService.remove(ws_output_base_nf)
            ws_output_base_1 = ws_output_base_nf + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - On_Off"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_fn = "Counts vs X pixel - " + basename + " Off_On"
        if AnalysisDataService.doesExist(ws_output_base_fn):
            AnalysisDataService.remove(ws_output_base_fn)
            ws_output_base_1 = ws_output_base_fn + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - Off_On"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_nn = "Counts vs X pixel - " + basename + " On_On"
        if AnalysisDataService.doesExist(ws_output_base_nn):
            AnalysisDataService.remove(ws_output_base_nn)
            ws_output_base_1 = ws_output_base_nn + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - On_On"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_all = ws_base + '_all'
        if AnalysisDataService.doesExist(ws_output_base_all):
            AnalysisDataService.remove(ws_output_base_all)

        data_manipulation.counts_vs_pixel_distribution(file_path,
                                                       is_pixel_y=False,
                                                       callback=None,
                                                       instrument='REFM')


#        def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
#            print 'Inside the call_back on the python side'
#            self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
#            self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
#            self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
#            self._summary.data_background_to_pixel1.setText("%-d" % int(backmax))
#            self._summary.x_min_edit.setText("%-d" % int(tofmin))
#            self._summary.x_max_edit.setText("%-d" % int(tofmax))

        # mantidplot.app should be used instead of _qti.app (it's just an alias)
        #mantidplot.app.connect(mantidplot.app.mantidUI, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)
        #mantidplot.app.connect(mantidplot.app.RefDetectorViewer, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

        peak_min = int(self._summary.data_peak_from_pixel.text())
        peak_max = int(self._summary.data_peak_to_pixel.text())
        back_min = int(self._summary.data_background_from_pixel1.text())
        back_max = int(self._summary.data_background_to_pixel1.text())
        tof_min = int(self._summary.data_from_tof.text())
        tof_max = int(self._summary.data_to_tof.text())

        import mantidqtpython
        self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base_ff+'_2D', peak_min, peak_max, back_min, back_max, tof_min, tof_max)
        QtCore.QObject.connect(self.ref_det_view.getConnections(), QtCore.SIGNAL("peakBackTofRangeUpdate(double,double,double,double,double,double)"), self.call_back)
Esempio n. 6
0
    def _plot_data_count_vs_tof_2d(self):
        #Bring to life the RefDetectorViewer and display counts(X) vs TOF
        #integrated over Y

         #retrieve name of workspace first
        run_number =  self._summary.data_run_number_edit.text()
        file_path = FileFinder.findRuns("%s%s" % (self.instrument_name, str(run_number)))[0]

        basename = os.path.basename(file_path)
        ws_base = "__%s" % basename

        ws_output_base_ff = "Counts vs X pixel - " + basename + " Off_Off"
        if AnalysisDataService.doesExist(ws_output_base_ff):
            AnalysisDataService.remove(ws_output_base_ff)
            ws_output_base_1 = ws_output_base_ff + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - Off_Off"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_nf = "Counts vs X pixel - " + basename + " On_Off"
        if AnalysisDataService.doesExist(ws_output_base_nf):
            AnalysisDataService.remove(ws_output_base_nf)
            ws_output_base_1 = ws_output_base_nf + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - On_Off"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_fn = "Counts vs X pixel - " + basename + " Off_On"
        if AnalysisDataService.doesExist(ws_output_base_fn):
            AnalysisDataService.remove(ws_output_base_fn)
            ws_output_base_1 = ws_output_base_fn + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - Off_On"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_nn = "Counts vs X pixel - " + basename + " On_On"
        if AnalysisDataService.doesExist(ws_output_base_nn):
            AnalysisDataService.remove(ws_output_base_nn)
            ws_output_base_1 = ws_output_base_nn + "_2D"
            AnalysisDataService.remove(ws_output_base_1)
            ws_output_base_2 = ws_base + " - On_On"
            AnalysisDataService.remove(ws_output_base_2)

        ws_output_base_all = ws_base + '_all'
        if AnalysisDataService.doesExist(ws_output_base_all):
            AnalysisDataService.remove(ws_output_base_all)

        data_manipulation.counts_vs_pixel_distribution(file_path,
                                                       is_pixel_y=False,
                                                       callback=None,
                                                       instrument='REFM')


#        def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
#            print 'Inside the call_back on the python side'
#            self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
#            self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
#            self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
#            self._summary.data_background_to_pixel1.setText("%-d" % int(backmax))
#            self._summary.x_min_edit.setText("%-d" % int(tofmin))
#            self._summary.x_max_edit.setText("%-d" % int(tofmax))

        # mantidplot.app should be used instead of _qti.app (it's just an alias)

        # mantidplot.app.connect(mantidplot.app.mantidUI,
        # QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

        # mantidplot.app.connect(mantidplot.app.RefDetectorViewer,
        # QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

        peak_min = int(self._summary.data_peak_from_pixel.text())
        peak_max = int(self._summary.data_peak_to_pixel.text())
        back_min = int(self._summary.data_background_from_pixel1.text())
        back_max = int(self._summary.data_background_to_pixel1.text())
        tof_min = int(self._summary.data_from_tof.text())
        tof_max = int(self._summary.data_to_tof.text())

        import mantidqtpython
        self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base_ff+'_2D',
                                                                                           peak_min, peak_max, back_min,
                                                                                           back_max, tof_min, tof_max)
        QtCore.QObject.connect(self.ref_det_view.getConnections(),
                               QtCore.SIGNAL("peakBackTofRangeUpdate(double,double,double,double,double,double)"),
                               self.call_back)