def postProcess(self, _edObject = None): EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginXscale.postProcess") data_output = XSDataXscaleOutput() output_file = os.path.join(self.getWorkingDirectory(), 'XSCALE.LP') data_output.succeeded = XSDataBoolean(False) if os.path.isfile(output_file): # we have the output file data_output.output_file = XSDataString(os.path.abspath(output_file)) # look for an error message in the output with open(output_file, 'r') as f: success = True for line in f: if line.find('!!! ERROR !!!') != -1: success = False break data_output.succeeded = XSDataBoolean(success) self.dataOutput = data_output
def testExecute(self): """ """ self.run() plugin = self.getPlugin() output = plugin.dataOutput reference = XSDataXscaleOutput.parseFile( self.getReferenceDataOutputFile()) EDAssert.equal(output.succeeded.value, reference.succeeded.value, "'succeeded' values match")
def testExecute(self): """ """ self.run() plugin = self.getPlugin() output = plugin.dataOutput reference = XSDataXscaleOutput.parseFile(self.getReferenceDataOutputFile()) EDAssert.equal(output.succeeded.value, reference.succeeded.value, "'succeeded' values match")
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
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