本文整理汇总了Python中EDUtilsUnit.EDUtilsUnit.getSIValue方法的典型用法代码示例。如果您正苦于以下问题:Python EDUtilsUnit.getSIValue方法的具体用法?Python EDUtilsUnit.getSIValue怎么用?Python EDUtilsUnit.getSIValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDUtilsUnit.EDUtilsUnit
的用法示例。
在下文中一共展示了EDUtilsUnit.getSIValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preProcess
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def preProcess(self, _edObject=None):
"""
The pre-process of ED Plugin Control DiffractionCT Powder Integration consists in preparing the input data for SPD Cake.
and declares the execution plugin as EDPluginFit2DCacke
"""
EDPluginControl.preProcess(self)
EDVerbose.DEBUG("EDPluginControlDCTPowderIntegrationv1_1.preProcess")
# Load the execution plugin
self.m_edPluginPowderIntegration = self.loadPlugin(self.m_edStringControlledPluginName)
#Retrive its'datamodel
xsDataInputSPDCake = XSDataInputSPDCake()
instrumentParameters = self.getDataInput().getInstrumentParameters()
imageParameters = self.getDataInput().getImageParameters()
xsDataInputSPDCake.setInputFile(self.getDataInput().getImageFile())
xsDataInputSPDCake.setWavelength(instrumentParameters.get_diffrn_radiation_wavelength())
xsDataInputSPDCake.setSampleToDetectorDistance(instrumentParameters.get_pd_instr_dist_spec_detc())
xsDataInputSPDCake.setAngleOfTilt(imageParameters.get_pd_instr_special_details_tilt_angle())
xsDataInputSPDCake.setTiltRotation(imageParameters.get_pd_instr_special_details_tilt_rotation())
xsDataInputSPDCake.setDarkCurrentImageFile(imageParameters.get_file_correction_image_dark_current())
xsDataInputSPDCake.setFlatFieldImageFile(imageParameters.get_file_correction_image_flat_field())
xsDataInputSPDCake.setSpatialDistortionFile(imageParameters.get_file_correction_spline_spatial_distortion())
# EDVerbose.screen("imageParameters.get_array_element_size_1: %s" % imageParameters.get_array_element_size_1().marshal())
xsDataInputSPDCake.setBeamCentreInPixelsX(XSDataDouble(\
EDUtilsUnit.getSIValue(imageParameters.get_diffrn_detector_element_center_1()) / \
EDUtilsUnit.getSIValue(imageParameters.get_array_element_size_1())))
xsDataInputSPDCake.setBeamCentreInPixelsY(XSDataDouble(\
EDUtilsUnit.getSIValue(imageParameters.get_diffrn_detector_element_center_2()) / \
EDUtilsUnit.getSIValue(imageParameters.get_array_element_size_2())))
xsDataInputSPDCake.setPixelSizeX(imageParameters.get_array_element_size_1())
#imageParameters.get_diffrn_detector_element_center_1())
xsDataInputSPDCake.setPixelSizeY(imageParameters.get_array_element_size_2())
#imageParameters.get_diffrn_detector_element_center_1())
xsDataInputSPDCake.setBufferSizeX(XSDataInteger(2048))
xsDataInputSPDCake.setBufferSizeY(XSDataInteger(2048))
xsDataInputSPDCake.setStartAzimuth(XSDataAngle(0))
xsDataInputSPDCake.setStopAzimuth(XSDataAngle(360))
xsDataInputSPDCake.setStepAzimuth(XSDataAngle(360))
xsDataInputSPDCake.setOutputDirCake(self.getDataInput().getDestinationDir())
xsDataInputSPDCake.setDeleteCorImg(XSDataBoolean(True))
try:
self.m_edPluginPowderIntegration.setDataInput(xsDataInputSPDCake)
except Exception, error:
# This exception handling needs to be rethought, see bug #43.
errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlDCTPowderIntegrationv1_1.preProcess: Unexpected error in SPD handler: ", error)
EDVerbose.error(errorMessage)
self.addErrorMessage(errorMessage)
raise RuntimeError, errorMessage
示例2: preProcess
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecNormalizeImagev1_2.preProcess")
sdi = self.getDataInput()
if sdi.dataScaleFactor is not None:
self.scaleData = sdi.dataScaleFactor.value
if sdi.darkScaleFactor is not None:
self.scaleDark = sdi.darkScaleFactor.value
if sdi.flatScaleFactor is not None:
self.scaleFlat = sdi.flatScaleFactor.value
if sdi.data == []:
strError = "You should either provide at least ONE input filename or an array, you provided: %s" % sdi.marshal()
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
else:
for inputData in sdi.data:
if inputData.exposureTime is None:
self.WARNING("You did not provide an exposure time for DATA... using default: 1")
self.listDataExposure.append(1.0)
else:
self.listDataExposure.append(EDUtilsUnit.getSIValue(inputData.exposureTime))
self.listDataArray.append(EDUtilsArray.getArray(inputData) / self.scaleData)
for inputFlat in sdi.flat:
if inputFlat.exposureTime is None:
self.WARNING("You did not provide an exposure time for FLAT... using default: 1")
expTime = 1.0
else:
expTime = EDUtilsUnit.getSIValue(inputFlat.exposureTime)
self.listFlatExposure.append(expTime)
self.listFlatArray.append(EDUtilsArray.getArray(inputFlat) / self.scaleFlat)
with self.__class__.semaphore:
for inputDark in sdi.dark:
if inputDark.exposureTime is None:
self.WARNING("You did not provide an exposure time for Dark... using default: 1")
expTime = 1.0
else:
expTime = EDUtilsUnit.getSIValue(inputDark.exposureTime)
# strMeanDarkKey = "/".join((self.getClassName(), "MeanDark%6.3f" % expTime))
if str(expTime) not in self.__class__.dictDark:
self.listDarkExposure.append(expTime)
self.listDarkArray.append(EDUtilsArray.getArray(inputDark) / self.scaleDark)
if sdi.output is not None:
if (sdi.output.path is not None):
self.strOutputFilename = sdi.output.path.value
elif (sdi.output.shared is not None):
self.strOutputShared = sdi.output.shared.value
# else export as array.
EDAssert.equal(len(self.listDataArray), len(self.listDataExposure), _strComment="number of data images / exposure times ")
EDAssert.equal(len(self.listFlatArray), len(self.listFlatExposure), _strComment="number of flat images / exposure times ")
EDAssert.equal(len(self.listDarkArray), len(self.listDarkExposure), _strComment="number of dark images / exposure times ")
示例3: unitTestGetSIValue
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def unitTestGetSIValue(self):
"""
test the execution of unitTestGetSIValue static method
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsUnit.unitTestGetSIValue")
xsd = XSDataLength(1.5)
xsd.setUnit(XSDataString("mm"))
EDAssert.equal(0.0015, EDUtilsUnit.getSIValue(xsd), "Conversion mm to meter")
xsd = XSDataAngle(90)
xsd.setUnit(XSDataString("deg"))
EDAssert.equal(math.pi / 2, EDUtilsUnit.getSIValue(xsd), "Conversion deg to rad")
示例4: getDetector
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def getDetector(xsDetector):
detector = None
if xsDetector.name and (xsDetector.name.value in dir(pyFAI.detectors)):
detector = getattr(pyFAI.detectors, xsDetector.name.value)()
else:
pixel2 = EDUtilsUnit.getSIValue(xsDetector.pixelSizeX)
pixel1 = EDUtilsUnit.getSIValue(xsDetector.pixelSizeY)
if xsDetector.splineFile and os.path.isFile(xsDetector.splineFile.path.value):
dictGeo = {"pixel1":pixel1, "pixel2":pixel2, "splineFile":xsDetector.splineFile.path.value}
else:
dictGeo = {"pixel1":pixel1, "pixel2":pixel2, "splineFile":None}
detector = pyFAI.detectors.Detector()
detector.setPyFAI(**dictGeo)
return detector
示例5: preProcess
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecPyFAIv1_0.preProcess")
sdi = self.dataInput
ai = pyFAI.AzimuthalIntegrator()
if sdi.geometryFit2D is not None:
xsGeometry = sdi.geometryFit2D
detector = self.getDetector(xsGeometry.detector)
d = {"direct": EDUtilsUnit.getSIValue(xsGeometry.distance) * 1000, #fit2D takes the distance in mm
"centerX": xsGeometry.beamCentreInPixelsX.value ,
"centerY":xsGeometry.beamCentreInPixelsY.value ,
"tilt": xsGeometry.angleOfTilt.value,
"tiltPlanRotation": xsGeometry.tiltRotation.value}
d.update(detector.getFit2D())
ai.setFit2D(**d)
elif sdi.geometryPyFAI is not None:
xsGeometry = sdi.geometryPyFAI
detector = self.getDetector(xsGeometry.detector)
d = {"dist": EDUtilsUnit.getSIValue(xsGeometry.sampleDetectorDistance),
"poni1": EDUtilsUnit.getSIValue(xsGeometry.pointOfNormalIncidence1),
"poni2": EDUtilsUnit.getSIValue(xsGeometry.pointOfNormalIncidence2),
"rot1": EDUtilsUnit.getSIValue(xsGeometry.rotation1),
"rot2": EDUtilsUnit.getSIValue(xsGeometry.rotation2),
"rot3": EDUtilsUnit.getSIValue(xsGeometry.rotation3)}
d.update(detector.getPyFAI())
ai.setPyFAI(**d)
else:
strError = "Geometry definition in %s, not recognized as a valid geometry%s %s" % (sdi, os.linesep, sdi.marshal())
self.ERROR(strError)
raise RuntimeError(strError)
########################################################################
# Choose the azimuthal integrator
########################################################################
with self.__class__._sem:
if tuple(ai.param) in self.__class__._dictGeo:
self.ai = self.__class__._dictGeo[tuple(ai.param)]
else:
self.__class__._dictGeo[tuple(ai.param)] = ai
self.ai = ai
self.data = EDUtilsArray.getArray(self.dataInput.input).astype(float)
if sdi.dark is not None:
self.data -= EDUtilsArray.getArray(sdi.dark)
if sdi.flat is not None:
self.data /= EDUtilsArray.getArray(sdi.flat)
if sdi.mask is not None:
self.mask = EDUtilsArray.getArray(sdi.mask)
if sdi.wavelength is not None:
self.ai.wavelength = EDUtilsUnit.getSIValue(sdi.wavelength)
if sdi.output is not None:
self.strOutputFile = sdi.output.path.value
if sdi.dummy is not None:
self.dummy = sdi.dummy.value
if sdi.deltaDummy is not None:
self.delta_dummy = sdi.deltaDummy.value
if sdi.nbPt:
self.nbPt = sdi.nbPt.value
示例6: integrate
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def integrate(self):
img = fabio.open(self.rawImage)
if "Date" in img.header:
self.experimentSetup.timeOfFrame = XSDataTime(time.mktime(time.strptime(img.header["Date"], "%a %b %d %H:%M:%S %Y")))
wavelength = EDUtilsUnit.getSIValue(self.experimentSetup.wavelength)
current_config = self.integrator.getPyFAI()
short_config = {}
for key in self.integrator_config:
short_config[key] = current_config[key]
with self.__class__.semaphore:
if (short_config != self.integrator_config) or \
(self.integrator.wavelength != wavelength) or\
(self.maskfile != self.experimentSetup.maskFile.path.value):
self.screen("Resetting PyFAI integrator")
self.integrator.setPyFAI(**self.integrator_config)
self.integrator.wavelength = wavelength
self.integrator.detector.mask = self.calc_mask()
q, I, std = self.integrator.integrate1d(data=img.data, nbPt=max(img.dim1, img.dim2),
correctSolidAngle=True,
dummy=self.dummy, delta_dummy=self.delta_dummy,
filename=None,
error_model="poisson",
radial_range=None, azimuth_range=None,
polarization_factor=0, dark=None, flat=None,
method=self.METHOD, unit="q_nm^-1", safe=False)
self.lstExecutiveSummary.append("Azimuthal integration of raw image '%s'-->'%s'." % (self.rawImage, self.integratedCurve))
return q, I, std
示例7: preProcess
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecNormalizeImagev1_1.preProcess")
sdi = self.getDataInput()
if sdi.getData() == []:
strError = "You should either provide at least ONE input filename or an array, you provided: %s" % sdi.marshal()
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
else:
for inputData in sdi.getData():
if inputData.exposureTime is None:
self.WARNING("You did not provide an exposure time for DATA... using default: 1")
self.listDataExposure.append(1.0)
else:
self.listDataExposure.append(EDUtilsUnit.getSIValue(inputData.exposureTime))
if inputData.path is not None:
strPath = inputData.path.value
if os.path.isfile(strPath):
self.listDataArray.append(fabio.open(strPath).data)
else:
strError = "The input file provided for DATA is not a valid file: %s" % strPath
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
elif inputData.array is not None:
self.listDataArray.append(EDUtilsArray.xsDataToArray(inputData.array))
else:
strError = "You should either provide an input filename or an array for DATA, you provided: %s" % inputData.marshal()
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
for inputFlat in sdi.getFlat():
if inputFlat.exposureTime is None:
self.WARNING("You did not provide an exposure time for FLAT... using default: 1")
expTime = 1.0
else:
expTime = EDUtilsUnit.getSIValue(inputFlat.exposureTime)
self.listFlatExposure.append(expTime)
if inputFlat.path is not None:
strPath = inputFlat.path.value
if os.path.isfile(strPath):
self.listFlatArray.append(fabio.open(strPath).data)
else:
strError = "The input file provided for FLAT is not a valid file: %s" % strPath
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
elif inputFlat.array is not None:
self.listFlatArray.append(EDUtilsArray.xsDataToArray(inputFlat.array))
else:
strError = "You should either provide an input filename or an array for FLAT, you provided: %s" % inputFlat.marshal()
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
with EDPluginExecNormalizeImagev1_1.semaphore:
for inputDark in sdi.getDark():
if inputDark.exposureTime is None:
self.WARNING("You did not provide an exposure time for Dark... using default: 1")
expTime = 1.0
else:
expTime = EDUtilsUnit.getSIValue(inputDark.exposureTime)
strMeanDarkKey = "/".join((self.getClassName(), "MeanDark%6.3f" % expTime))
if strMeanDarkKey not in EDShare:
self.listDarkExposure.append(expTime)
if inputDark.path is not None:
strPath = inputDark.path.value
if os.path.isfile(strPath):
self.listDarkArray.append(fabio.open(strPath).data)
else:
strError = "The input file provided for Dark is not a valid file: %s" % strPath
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
elif inputDark.array is not None:
self.listDarkArray.append(EDUtilsArray.xsDataToArray(inputDark.array))
elif inputDark.shared is not None:
self.listDarkArray.append(EDShare[inputDark.shared.value])
else:
strError = "You should either provide an input filename or an array for Dark, you provided: %s" % inputDark.marshal()
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
if sdi.output is not None:
if (sdi.output.path is not None):
self.strOutputFilename = sdi.output.path.value
elif (sdi.output.shared is not None):
self.strOutputShared = sdi.output.shared.value
# else export as array.
EDAssert.equal(len(self.listDataArray), len(self.listDataExposure), _strComment="number of data images / exposure times ")
EDAssert.equal(len(self.listFlatArray), len(self.listFlatExposure), _strComment="number of flat images / exposure times ")
EDAssert.equal(len(self.listDarkArray), len(self.listDarkExposure), _strComment="number of dark images / exposure times ")
示例8: preProcess
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
def preProcess(self, _edObject=None):
"""
Preprocess: check the input parameters and unpack them
"""
EDPluginExec.preProcess(self)
EDVerbose.DEBUG("EDPluginExportAsciiPowderv1_0.preProcess")
if self.getDataInput().getEdfFile() is not None:
self.inputFilename = self.getDataInput().getEdfFile().getPath().getValue()
if not os.path.isfile(self.inputFilename):
EDVerbose.ERROR("The input file provided is not a valid file: %s" % self.inputFilename)
raise RuntimeError("Not a valid file %s" % self.inputFilename)
else:
self.readArrayFromFile(self.inputFilename)
elif self.getDataInput().getIntensities() is not None:
self.inputArray = EDUtilsArray.xsDataToArray(self.getDataInput().getIntensities())
else:
strErrorMessage = "EDPluginExportAsciiPowderv1_0.preProcess: neither an input image, neither a data array given in input !"
EDVerbose.ERROR(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
raise ValueError, strErrorMessage
if self.getDataInput().getDistance() is not None:
self.fDistance = EDUtilsUnit.getSIValue(self.getDataInput().getDistance())
if self.getDataInput().getPixelSize() is not None:
self.fPixelSize = EDUtilsUnit.getSIValue(self.getDataInput().getPixelSize())
if self.getDataInput().getOffset() is not None:
self.fRadOffset = self.getDataInput().getOffset().getValue()
if self.getDataInput().getOutputFormat() is not None:
self.strFormat = self.getDataInput().getOutputFormat().getValue().lower()
if self.getDataInput().getNumberOfBins() is not None:
self.iNbBins = self.getDataInput().getNumberOfBins().getValue()
if self.strFormat == "array":
self.outputFilename = None
else:
if self.getDataInput().getOutputFile() is None:
if "chi" in self.strFormat:
ext = ".chi"
elif "cif" in self.strFormat:
ext = ".cif"
elif "spr" in self.strFormat:
ext = ".spr"
else:
ext = ".powder"
self.outputFilename = os.path.join(self.getWorkingDirectory(), "output" + ext)
else:
self.outputFilename = self.getDataInput().getOutputFile().getPath().getValue()
if os.path.isdir(self.outputFilename):
if "chi" in self.strFormat:
ext = ".chi"
elif "cif" in self.strFormat:
ext = ".cif"
elif "spr" in self.strFormat:
ext = ".spr"
else:
ext = ".powder"
self.outputFilename = os.path.join(self.outputFilename,
os.path.splitext(os.path.basename(self.inputFilename))[0] + ext)
if (self.fPixelSize is None) or (self.fDistance is None):
strErrorMessage = "EDPluginExportAsciiPowderv1_0.preProcess: pixel size: %s; distance: %s Cannot be identified in %s !!!!" % (self.fPixelSize, self.fDistance, self.inputFilename)
EDVerbose.ERROR(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
raise ValueError, strErrorMessage
示例9: getInputParameter
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import getSIValue [as 别名]
#.........这里部分代码省略.........
self.dictGeometry["SpatialDistortionFile"] = pathToSpatialDistortionFile
else:
edStringErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
self.getPluginName() + ".preProcess",
pathToSpatialDistortionFile,
)
self.error(edStringErrorMessage)
self.addErrorMessage(edStringErrorMessage)
raise RuntimeError, edStringErrorMessage
if self.xsDataInputSPD.getAngleOfTilt() is not None:
if self.xsDataInputSPD.getAngleOfTilt().getUnit() is not None:
self.dictGeometry["AngleOfTilt"] = EDUtilsUnit.getValue(self.xsDataInputSPD.getAngleOfTilt(), "deg")
else: # Fall-back by default to deg
self.WARNING("You did not specify the AngleOfTilt unit ... I Guess it is deg")
self.dictGeometry["AngleOfTilt"] = self.xsDataInputSPD.getAngleOfTilt().getValue()
else:
self.dictGeometry["AngleOfTilt"] = 0
if self.xsDataInputSPD.getTiltRotation() is not None:
if self.xsDataInputSPD.getTiltRotation().getUnit() is not None:
self.dictGeometry["TiltRotation"] = EDUtilsUnit.getValue(self.xsDataInputSPD.getTiltRotation(), "deg")
else: # Fall-back by default to deg
self.WARNING("You did not specify the TiltRotation unit ... I Guess it is deg")
self.dictGeometry["TiltRotation"] = self.xsDataInputSPD.getTiltRotation().getValue()
else:
self.dictGeometry["TiltRotation"] = 0
if self.xsDataInputSPD.getBeamCentreInPixelsX() is not None:
self.dictGeometry["BeamCenterX"] = self.xsDataInputSPD.getBeamCentreInPixelsX().getValue()
if self.xsDataInputSPD.getBeamCentreInPixelsY() is not None:
self.dictGeometry["BeamCenterY"] = self.xsDataInputSPD.getBeamCentreInPixelsY().getValue()
if self.xsDataInputSPD.getBufferSizeX() is not None:
self.dictGeometry["BufferSizeX"] = self.xsDataInputSPD.getBufferSizeX().getValue()
if self.xsDataInputSPD.getBufferSizeY() is not None:
self.dictGeometry["BufferSizeY"] = self.xsDataInputSPD.getBufferSizeY().getValue()
if self.xsDataInputSPD.getDistortionFileX() is not None:
pathToDistortionFileX = self.xsDataInputSPD.getDistortionFileX().getPath().getValue()
if os.path.isfile(pathToDistortionFileX):
self.dictGeometry["DistortionFileX"] = pathToDistortionFileX
else:
edStringErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
self.getPluginName() + ".preProcess",
pathToDistortionFileX,
)
self.error(edStringErrorMessage)
self.addErrorMessage(edStringErrorMessage)
raise RuntimeError, edStringErrorMessage
if self.xsDataInputSPD.getDistortionFileY() is not None:
pathToDistortionFileY = self.xsDataInputSPD.getDistortionFileY().getPath().getValue()
if os.path.isfile(pathToDistortionFileY):
self.dictGeometry["DistortionFileY"] = pathToDistortionFileY
else:
edStringErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
self.getPluginName() + ".preProcess",
pathToDistortionFileY,
)
self.error(edStringErrorMessage)
self.addErrorMessage(edStringErrorMessage)
raise RuntimeError, edStringErrorMessage
if self.xsDataInputSPD.getPixelSizeX() is not None:
self.dictGeometry["PixelSizeX"] = EDUtilsUnit.getSIValue(self.xsDataInputSPD.getPixelSizeX())
if self.xsDataInputSPD.getPixelSizeY() is not None:
self.dictGeometry["PixelSizeY"] = EDUtilsUnit.getSIValue(self.xsDataInputSPD.getPixelSizeY())
if self.xsDataInputSPD.getSampleToDetectorDistance() is not None:
self.dictGeometry["SampleToDetectorDistance"] = EDUtilsUnit.getSIValue(
self.xsDataInputSPD.getSampleToDetectorDistance()
)
if self.xsDataInputSPD.getWavelength() is not None:
if self.xsDataInputSPD.getWavelength().getUnit() is not None:
self.dictGeometry["Wavelength"] = EDUtilsUnit.getSIValue(self.xsDataInputSPD.getWavelength())
else: # Fall-back to Angsrom
self.WARNING("You did not specify the wavelength unit ... I Guess it is Angstrom")
self.dictGeometry["Wavelength"] = self.xsDataInputSPD.getWavelength().getValue() * 1e-10
if self.xsDataInputSPD.getOutputFileType() is not None:
self.dictGeometry["OutputFileType"] = self.xsDataInputSPD.getOutputFileType().getValue()
if not self.dictGeometry["OutputFileType"].startswith("."):
self.dictGeometry["OutputFileType"] = "." + self.dictGeometry["OutputFileType"]
else:
self.dictGeometry["OutputFileType"] = ".edf"
if self.xsDataInputSPD.getOutputDir() is not None:
tmpdir = self.xsDataInputSPD.getOutputDir().getPath().getValue()
if os.path.isdir(tmpdir):
self.dictGeometry["OutputDir"] = tmpdir
if tmpdir != os.path.dirname(self.pathToInputFile):
self._bFireAndForget = True
else:
self.WARNING(
"The destination directory %s does not exist, using working directory instead %s"
% (tmpdir, self.getWorkingDirectory())
)
self.dictGeometry["OutputDir"] = self.getWorkingDirectory()
else:
self.dictGeometry["OutputDir"] = os.path.dirname(self.pathToInputFile)
if (
self.dictGeometry["OutputDir"] == os.path.dirname(self.pathToInputFile)
and not (self.pathToInputFile.endswith(self.dictGeometry["OutputFileType"]))
and not (self.dictGeometry["OutputFileType"].lower() in [".h5", ".chi", ".nx", ".nexus", ".cif"])
):
self.bFireAndForget = True