def _prepare_workspace(workspace, data=None):
        """
        Creates a test monitor workspace with 4 bins
        """
        workspace = Rebin(InputWorkspace=workspace, Params="5000, 5000, 25000", OutputWorkspace=workspace)

        # Now set specified monitors to specified values
        if data is not None:
            for key, value in list(data.items()):
                data_y = workspace.dataY(key)
                for index in range(len(data_y)):
                    data_y[index] = value[index]
        return workspace
示例#2
0
 def _create_flat_background_test_workspace(workspace_name):
     LoadNexusProcessed(Filename="LOQ48127", OutputWorkspace=workspace_name)
     workspace = AnalysisDataService.retrieve(workspace_name)
     # Rebin to only have four values at 11, 31, 51, 70.5
     workspace = Rebin(workspace, "1,20,80")
     # For each spectrum we set the first two entries to 2 and the other two entries to 4.
     for index in range(workspace.getNumberHistograms()):
         data_y = workspace.dataY(index)
         data_y[0] = 2.
         data_y[1] = 2.
         data_y[2] = 4.
         data_y[3] = 4.
     return workspace
 def _prepare_trans_data(self, ws, value):
     rebin_string = "{0}, {1}, {2}".format(self.test_tof_min,
                                           self.test_tof_width,
                                           self.test_tof_max)
     ws = Rebin(InputWorkspace=ws, Params=rebin_string, StoreInADS=False)
     # Set all entries to value
     for hist in range(ws.getNumberHistograms()):
         data_y = ws.dataY(hist)
         for index in range(len(data_y)):
             data_y[index] = value
         # This will be the background bin
         data_y[0] = 0.1
     return ws
 def _create_flat_background_test_workspace(workspace_name):
     LoadNexusProcessed(Filename="LOQ48127", OutputWorkspace=workspace_name)
     workspace = AnalysisDataService.retrieve(workspace_name)
     # Rebin to only have four values at 11, 31, 51, 70.5
     workspace = Rebin(workspace, "1,20,80")
     # For each spectrum we set the first two entries to 2 and the other two entries to 4.
     for index in range(workspace.getNumberHistograms()):
         data_y = workspace.dataY(index)
         data_y[0] = 2.
         data_y[1] = 2.
         data_y[2] = 4.
         data_y[3] = 4.
     return workspace