Esempio n. 1
0
    def postProcess(self, _edObject = None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginXscale.postProcess")

        data_output = XSDataXscaleOutput()
        lp_file = os.path.join(self.getWorkingDirectory(), 'XSCALE.LP')
        data_output.succeeded = XSDataBoolean(False)
        if os.path.isfile(lp_file):
            # we have the output file
            # copy it to some other name
            anomalous = self.dataInput.friedels_law.value
            merged = self.dataInput.merge.value
            new_lp_file = 'merged' if merged else 'unmerged'
            if anomalous:
                new_lp_file += '_anom_XSCALE.LP'
            else:
                new_lp_file += '_noanom_XSCALE.LP'
            new_lp_file = os.path.join(self.getWorkingDirectory(), new_lp_file)

            shutil.copy(lp_file, new_lp_file)

            data_output.lp_file = XSDataString(os.path.abspath(new_lp_file))

            # look for an error message in the output
            with open(new_lp_file, 'r') as f:
                success = True
                for line in f:
                    if line.find('!!! ERROR !!!') != -1:
                        success = False
                        break
                data_output.succeeded = XSDataBoolean(success)

        # also add the hkl file to our output
        data_output.hkl_file = XSDataString(os.path.join(self.getWorkingDirectory(),
                                                         self.hkl_file))

        self.dataOutput = data_output
Esempio n. 2
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginXscale.postProcess")

        data_output = XSDataXscaleOutput()
        lp_file = os.path.join(self.getWorkingDirectory(), 'XSCALE.LP')
        data_output.succeeded = XSDataBoolean(False)
        if os.path.isfile(lp_file):
            # we have the output file
            # copy it to some other name
            anomalous = self.dataInput.friedels_law.value
            merged = self.dataInput.merge.value
            new_lp_file = 'merged' if merged else 'unmerged'
            if anomalous:
                new_lp_file += '_anom_XSCALE.LP'
            else:
                new_lp_file += '_noanom_XSCALE.LP'
            new_lp_file = os.path.join(self.getWorkingDirectory(), new_lp_file)

            shutil.copy(lp_file, new_lp_file)

            data_output.lp_file = XSDataString(os.path.abspath(new_lp_file))

            # look for an error message in the output
            with open(new_lp_file, 'r') as f:
                success = True
                for line in f:
                    if line.find('!!! ERROR !!!') != -1:
                        success = False
                        break
                data_output.succeeded = XSDataBoolean(success)

        # also add the hkl file to our output
        data_output.hkl_file = XSDataString(
            os.path.join(self.getWorkingDirectory(), self.hkl_file))

        self.dataOutput = data_output