def testCheckParameters(self): EDVerbose.DEBUG("EDTestCasePluginUnitControlDiffractionCTv1_0.testCheckParameters") xsDataInput = XSDataInputDiffractionCT() xsDataImage = XSDataImage() xsDataInput.setImage(xsDataImage) xsDataFile = XSDataFile() xsDataInput.setDestinationDirectory(xsDataFile) xsDataInput.setSinogramFileNamePrefix(XSDataString("FakePrefix")) xsDataInput.setPowderDiffractionSubdirectory(XSDataString("Powder")) edPluginControlDCTPowderIntegration = self.createPlugin() edPluginControlDCTPowderIntegration.setDataInput(xsDataInput) edPluginControlDCTPowderIntegration.checkParameters()
def makeXML(self, filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ bProcessFile = False basename = os.path.basename(filename) for oneExt in self.listExtensions: if basename.endswith(oneExt): bProcessFile = True break if bProcessFile: for onePref in self.listExcludedPrefix: if basename.startswith(onePref): bProcessFile = False if not bProcessFile: EDVerbose.screen("Not processing file: %s" % filename) return xsdimage = XSDataImage() xsdimage.setPath(XSDataString(filename)) xsd = XSDataInputDiffractionCT() xsd.setImage(xsdimage) xsd.setDestinationDirectory(self.destinationDirectory) xsd.setSinogramFileNamePrefix(self.sinogramFileNamePrefix) xsd.setPowderDiffractionSubdirectory( self.powderDiffractionSubdirectory) xsd.setPowderDiffractionFormat(self.powderDiffractionFormat) if self.indexOffset is not None and self.fastMotorSteps is not None: idx = 0 basename = list(os.path.splitext(os.path.basename(filename))[0]) basename.reverse() number = "" for i in basename: if i.isdigit(): number = i + number else: break idx = int(number) - self.indexOffset if idx < 0: return self.forceInstrument.set_tomo_spec_displ_x( XSDataLength(idx % (self.fastMotorSteps + 1))) self.forceInstrument.set_tomo_spec_displ_rotation( XSDataLength(idx // (self.fastMotorSteps + 1))) xsd.setOverrideScanParam(self.forceInstrument) xsd.setOverrideImageParam(self.forceImage) return xsd.marshal()
def testCheckParameters(self): EDVerbose.DEBUG( "EDTestCasePluginUnitControlDiffractionCTv1_0.testCheckParameters") xsDataInput = XSDataInputDiffractionCT() xsDataImage = XSDataImage() xsDataInput.setImage(xsDataImage) xsDataFile = XSDataFile() xsDataInput.setDestinationDirectory(xsDataFile) xsDataInput.setSinogramFileNamePrefix(XSDataString("FakePrefix")) xsDataInput.setPowderDiffractionSubdirectory(XSDataString("Powder")) edPluginControlDCTPowderIntegration = self.createPlugin() edPluginControlDCTPowderIntegration.setDataInput(xsDataInput) edPluginControlDCTPowderIntegration.checkParameters()
def makeXML(self, filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ bProcessFile = False basename = os.path.basename(filename) for oneExt in self.listExtensions: if basename.endswith(oneExt): bProcessFile = True break if bProcessFile: for onePref in self.listExcludedPrefix: if basename.startswith(onePref): bProcessFile = False if not bProcessFile: EDVerbose.screen("Not processing file: %s" % filename) return xsdimage = XSDataImage() xsdimage.setPath(XSDataString(filename)) xsd = XSDataInputDiffractionCT() xsd.setImage(xsdimage) xsd.setDestinationDirectory(self.destinationDirectory) xsd.setSinogramFileNamePrefix(self.sinogramFileNamePrefix) xsd.setPowderDiffractionSubdirectory(self.powderDiffractionSubdirectory) xsd.setPowderDiffractionFormat(self.powderDiffractionFormat) if self.indexOffset is not None and self.fastMotorSteps is not None: idx = 0 basename = list(os.path.splitext(os.path.basename(filename))[0]) basename.reverse() number = "" for i in basename: if i.isdigit(): number = i + number else: break idx = int(number) - self.indexOffset if idx < 0:return self.forceInstrument.set_tomo_spec_displ_x(XSDataLength(idx % (self.fastMotorSteps + 1))) self.forceInstrument.set_tomo_spec_displ_rotation(XSDataLength(idx // (self.fastMotorSteps + 1))) xsd.setOverrideScanParam(self.forceInstrument) xsd.setOverrideImageParam(self.forceImage) return xsd.marshal()