Пример #1
0
    def PyExec(self):
        use_zero_error_free = self.getProperty("UseZeroErrorFree").value
        file_formats = self._get_file_formats()
        file_name = self.getProperty("Filename").value
        workspace = self.getProperty("InputWorkspace").value

        transmission = self.getProperty("Transmission").value
        transmission_can = self.getProperty("TransmissionCan").value

        if use_zero_error_free:
            workspace = get_zero_error_free_workspace(workspace)
            if transmission:
                transmission = get_zero_error_free_workspace(transmission)
            if transmission_can:
                transmission_can = get_zero_error_free_workspace(
                    transmission_can)
        transmission_workspaces = {
            "Transmission": transmission,
            "TransmissionCan": transmission_can
        }

        additional_run_numbers = {
            "SampleTransmissionRunNumber":
            self.getProperty("SampleTransmissionRunNumber").value,
            "SampleDirectRunNumber":
            self.getProperty("SampleDirectRunNumber").value,
            "CanScatterRunNumber":
            self.getProperty("CanScatterRunNumber").value,
            "CanDirectRunNumber":
            self.getProperty("CanDirectRunNumber").value
        }

        progress = Progress(self,
                            start=0.0,
                            end=1.0,
                            nreports=len(file_formats) + 1)
        for file_format in file_formats:
            progress_message = "Saving to {0}.".format(
                file_format.file_format.value)
            progress.report(progress_message)
            progress.report(progress_message)
            try:
                save_to_file(workspace, file_format, file_name,
                             transmission_workspaces, additional_run_numbers)
            except (RuntimeError, ValueError) as e:
                logger.warning(
                    f"Cannot save workspace using SANSSave. "
                    "This workspace needs to be the result of a SANS reduction, "
                    "and must be appropriate for saving 1D or 2D reduced data."
                )
                raise e
        progress.report("Finished saving workspace to files.")
Пример #2
0
    def PyExec(self):
        use_zero_error_free = self.getProperty("UseZeroErrorFree").value
        file_formats = self._get_file_formats()
        file_name = self.getProperty("Filename").value
        workspace = self.getProperty("InputWorkspace").value

        if use_zero_error_free:
            workspace = get_zero_error_free_workspace(workspace)
        progress = Progress(self, start=0.0, end=1.0, nreports=len(file_formats) + 1)
        for file_format in file_formats:
            progress_message = "Saving to {0}.".format(SaveType.to_string(file_format.file_format))
            progress.report(progress_message)
            save_to_file(workspace, file_format, file_name)
        progress.report("Finished saving workspace to files.")
Пример #3
0
    def PyExec(self):
        use_zero_error_free = self.getProperty("UseZeroErrorFree").value
        file_formats = self._get_file_formats()
        file_name = self.getProperty("Filename").value
        workspace = self.getProperty("InputWorkspace").value

        if use_zero_error_free:
            workspace = get_zero_error_free_workspace(workspace)
        progress = Progress(self,
                            start=0.0,
                            end=1.0,
                            nreports=len(file_formats) + 1)
        for file_format in file_formats:
            progress_message = "Saving to {0}.".format(
                SaveType.to_string(file_format.file_format))
            progress.report(progress_message)
            save_to_file(workspace, file_format, file_name)
        progress.report("Finished saving workspace to files.")
Пример #4
0
    def PyExec(self):
        use_zero_error_free = self.getProperty("UseZeroErrorFree").value
        file_formats = self._get_file_formats()
        file_name = self.getProperty("Filename").value
        workspace = self.getProperty("InputWorkspace").value

        transmission = self.getProperty("Transmission").value
        transmission_can = self.getProperty("TransmissionCan").value

        if use_zero_error_free:
            workspace = get_zero_error_free_workspace(workspace)
            if transmission:
                transmission = get_zero_error_free_workspace(transmission)
            if transmission_can:
                transmission_can = get_zero_error_free_workspace(
                    transmission_can)
        transmission_workspaces = {
            "Transmission": transmission,
            "TransmissionCan": transmission_can
        }

        additional_run_numbers = {
            "SampleTransmissionRunNumber":
            self.getProperty("SampleTransmissionRunNumber").value,
            "SampleDirectRunNumber":
            self.getProperty("SampleDirectRunNumber").value,
            "CanScatterRunNumber":
            self.getProperty("CanScatterRunNumber").value,
            "CanDirectRunNumber":
            self.getProperty("CanDirectRunNumber").value
        }

        progress = Progress(self,
                            start=0.0,
                            end=1.0,
                            nreports=len(file_formats) + 1)
        for file_format in file_formats:
            progress_message = "Saving to {0}.".format(
                file_format.file_format.value)
            progress.report(progress_message)
            progress.report(progress_message)
            save_to_file(workspace, file_format, file_name,
                         transmission_workspaces, additional_run_numbers)
        progress.report("Finished saving workspace to files.")