Exemple #1
0
    def _run_test(state,
                  sample_data,
                  sample_monitor_data,
                  transmission_data,
                  direct_data,
                  is_lab=True,
                  is_sample=True):
        data_type = DataType.SAMPLE.value if is_sample else DataType.CAN.value
        component = DetectorType.LAB.value if is_lab else DetectorType.HAB.value

        alg = CreateSANSAdjustmentWorkspaces(state_adjustment=state.adjustment,
                                             component=component,
                                             data_type=data_type)
        returned = alg.create_sans_adjustment_workspaces(
            direct_ws=direct_data,
            monitor_ws=sample_monitor_data,
            transmission_ws=transmission_data,
            sample_data=sample_data)

        wavelength_adjustment = returned["wavelength_adj"]
        pixel_adjustment = returned["pixel_adj"]
        wavelength_and_pixel_adjustment = returned["wavelength_pixel_adj"]
        calculated_transmission = returned["calculated_trans_ws"]
        unfitted_transmission = returned["unfitted_trans_ws"]

        return wavelength_adjustment, pixel_adjustment, wavelength_and_pixel_adjustment, \
            calculated_transmission, unfitted_transmission
Exemple #2
0
    def _adjustment(self, state, workspace, monitor_workspace,
                    component_as_string, data_type):
        transmission_workspace = self._get_transmission_workspace()
        direct_workspace = self._get_direct_workspace()

        if transmission_workspace:
            transmission_workspace = self._move(
                state=state,
                workspace=transmission_workspace,
                component=component_as_string,
                is_transmission=True)

        if direct_workspace:
            direct_workspace = self._move(state=state,
                                          workspace=direct_workspace,
                                          component=component_as_string,
                                          is_transmission=True)

        alg = CreateSANSAdjustmentWorkspaces(state=state,
                                             data_type=data_type,
                                             component=component_as_string)
        wav_range = state.wavelength.wavelength_interval.wavelength_full_range
        returned_dict = alg.create_sans_adjustment_workspaces(
            direct_ws=direct_workspace,
            monitor_ws=monitor_workspace,
            sample_data=workspace,
            wav_range=wav_range,
            transmission_ws=transmission_workspace)
        wavelength_adjustment = returned_dict["wavelength_adj"]
        pixel_adjustment = returned_dict["pixel_adj"]
        wavelength_and_pixel_adjustment = returned_dict["wavelength_pixel_adj"]

        return wavelength_adjustment, pixel_adjustment, wavelength_and_pixel_adjustment
    def _adjustment(self, state, workspace, monitor_workspace, component_as_string, data_type):
        transmission_workspace = self._get_transmission_workspace()
        direct_workspace = self._get_direct_workspace()

        if transmission_workspace:
            transmission_workspace = self._move(state=state, workspace=transmission_workspace,
                                                component=component_as_string, is_transmission=True)

        if direct_workspace:
            direct_workspace = self._move(state=state, workspace=direct_workspace, component=component_as_string,
                                          is_transmission=True)

        alg = CreateSANSAdjustmentWorkspaces(state_adjustment=state.adjustment,
                                             component=component_as_string, data_type=data_type)
        returned_dict = alg.create_sans_adjustment_workspaces(direct_ws=direct_workspace, monitor_ws=monitor_workspace,
                                                              sample_data=workspace,
                                                              transmission_ws=transmission_workspace)

        wavelength_adjustment = returned_dict["wavelength_adj"]
        pixel_adjustment = returned_dict["pixel_adj"]
        wavelength_and_pixel_adjustment = returned_dict["wavelength_pixel_adj"]
        calculated_transmission_workspace = returned_dict["calculated_trans_ws"]
        unfitted_transmission_workspace = returned_dict["unfitted_trans_ws"]

        return wavelength_adjustment, pixel_adjustment, wavelength_and_pixel_adjustment, \
            calculated_transmission_workspace, unfitted_transmission_workspace
    def _adjustment(self, state, workspaces: WsList, monitor_workspace,
                    component_as_string,
                    data_type) -> Dict[WavRange, AdjustmentStruct]:
        transmission_workspace = self._get_transmission_workspace()
        direct_workspace = self._get_direct_workspace()

        if transmission_workspace:
            transmission_workspace = self._move(
                state=state,
                workspace=transmission_workspace,
                component=component_as_string,
                is_transmission=True)

        if direct_workspace:
            direct_workspace = self._move(state=state,
                                          workspace=direct_workspace,
                                          component=component_as_string,
                                          is_transmission=True)

        alg = CreateSANSAdjustmentWorkspaces(state_adjustment=state.adjustment,
                                             component=component_as_string,
                                             data_type=data_type)

        adjustments = {}
        for wav_range, ws in workspaces.items():
            returned_dict = alg.create_sans_adjustment_workspaces(
                direct_ws=direct_workspace,
                monitor_ws=monitor_workspace,
                sample_data=ws,
                transmission_ws=transmission_workspace,
                wav_range=wav_range)
            adjustments[wav_range] = AdjustmentStruct(
                wavelength_adjustment=returned_dict["wavelength_adj"],
                pixel_adjustment=returned_dict["pixel_adj"],
                wavelength_and_pixel_adjustment=returned_dict[
                    "wavelength_pixel_adj"],
                calculated_transmission_workspace=returned_dict[
                    "calculated_trans_ws"],
                unfitted_transmission_workspace=returned_dict[
                    "unfitted_trans_ws"])

        return adjustments