コード例 #1
0
    def __init__(self, data_file, workspace_name=None):
        self.errors = []
        if HAS_MANTID:
            try:
                if workspace_name is None:
                    self.data_ws = "__raw_data_file"
                else:
                    self.data_ws = str(workspace_name)
                reducer = SANSReducer()
                reducer.set_instrument(hfir_instrument.HFIRSANS())
                loader = LoadRun(str(data_file))
                loader.execute(reducer, self.data_ws)
                x = mtd[self.data_ws].dataX(0)
                self.wavelength = (x[0] + x[1]) / 2.0
                self.wavelength_spread = x[1] - x[0]
                self.sample_detector_distance = mtd[self.data_ws].getRun().getProperty("sample_detector_distance").value
                self.sample_thickness = mtd[self.data_ws].getRun().getProperty("sample-thickness").value
                self.beam_diameter = mtd[self.data_ws].getRun().getProperty("beam-diameter").value

                if False and HAS_NUMPY:
                    nx_pixels = int(mtd[self.data_ws].getInstrument().getNumberParameter("number-of-x-pixels")[0])
                    ny_pixels = int(mtd[self.data_ws].getInstrument().getNumberParameter("number-of-y-pixels")[0])
                    nMonitors = int(mtd[self.data_ws].getInstrument().getNumberParameter("number-of-monitors")[0])
                    raw_data = numpy.zeros(nx_pixels * ny_pixels)
                    for i in range(nMonitors - 1, nx_pixels * ny_pixels + nMonitors):
                        raw_data[i - nMonitors] = mtd[self.data_ws].readY(i)[0]

                    self.data = numpy.reshape(raw_data, (nx_pixels, ny_pixels), order="F")
                mtd.sendLogMessage("Loaded data file: %s" % data_file)
            except:
                mtd.sendLogMessage("DataProxy: Error loading data file:\n%s" % sys.exc_value)
                self.errors.append("Error loading data file:\n%s" % sys.exc_value)
コード例 #2
0
    def __init__(self):
        SANSReducer.__init__(self)
        self._dark_current_subtracter_class = None
        self._sample_run = Sample()
        self.output_wksp = None
        self.full_trans_wav = False
        self._monitor_set = False
        #workspaces that this reducer uses and will delete at the end
        self._temporys = {}
        #the output workspaces created by a data analysis
        self._outputs = {}
        #all workspaces created by this reducer
        self._workspace = [self._temporys, self._outputs] 

        self._init_steps()
        
        #process the background (can) run instead of the sample 
        self._process_can = False
        # Python 2.4 has a problem deep copying the _resolution_calculator in
        # the base class. ISIS don't need it so kill it off here
        self._resolution_calculator = None