本文整理汇总了Python中EDUtilsArray.EDUtilsArray.getArray方法的典型用法代码示例。如果您正苦于以下问题:Python EDUtilsArray.getArray方法的具体用法?Python EDUtilsArray.getArray怎么用?Python EDUtilsArray.getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDUtilsArray.EDUtilsArray
的用法示例。
在下文中一共展示了EDUtilsArray.getArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [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
示例2: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [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: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecMeasureOffsetv1_0.preProcess")
sdi = self.getDataInput()
images = sdi.getImage()
arrays = sdi.getArray()
if len(images) == 2:
self.npaIm1 = numpy.array(EDUtilsArray.getArray(images[0]))
self.npaIm2 = numpy.array(EDUtilsArray.getArray(images[1]))
elif len(arrays) == 2:
self.npaIm1 = EDUtilsArray.xsDataToArray(arrays[0])
self.npaIm2 = EDUtilsArray.xsDataToArray(arrays[1])
else:
strError = (
"EDPluginExecMeasureOffsetv1_0.preProcess: You should either provide two images or two arrays, but I got: %s"
% sdi.marshal()[:1000]
)
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
crop = sdi.getCropBorders()
if len(crop) > 1:
self.tCrop = tuple([i.getValue() for i in crop])
elif len(crop) == 1:
self.tCrop = (crop[0].getValue(), crop[0].getValue())
center = sdi.getCenter()
if len(center) > 1:
self.tCenter = tuple([i.getValue() for i in center])
elif len(center) == 1:
self.tCenter = (center[0].getValue(), center[0].getValue())
width = sdi.getWidth()
if len(width) > 1:
self.tWidth = tuple([i.getValue() for i in width])
elif len(width) == 1:
self.tWidth = (width[0].getValue(), width[0].getValue())
smooth = sdi.getSmoothBorders()
if len(smooth) == 2:
self.tSmooth = (smooth[0].getValue(), smooth[1].getValue())
elif len(smooth) == 1:
self.tSmooth = (smooth[0].getValue(), smooth[0].getValue())
if sdi.getBackgroundSubtraction() is not None:
self.bBackgroundsubtraction = sdi.getBackgroundSubtraction().getValue() in [1, True, "true"]
if sdi.getSobelFilter() is not None:
self.sobel = sdi.getSobelFilter() in [1, True, "true"]
EDAssert.equal(self.npaIm1.shape, self.npaIm2.shape, "Images have the same size")
示例4: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecAlignFramev1_0.preProcess")
sdi = self.dataInput
images = sdi.image
arrays = sdi.array
if len(images) == 2:
self.npaIm1 = numpy.array(EDUtilsArray.getArray(images[0]))
self.npaIm2 = numpy.array(EDUtilsArray.getArray(images[1]))
elif len(arrays) == 2:
self.npaIm1 = EDUtilsArray.xsDataToArray(arrays[0])
self.npaIm2 = EDUtilsArray.xsDataToArray(arrays[1])
else:
strError = "EDPluginExecAlignFramev1_0.preProcess: You should either provide two images or two arrays, but I got: %s" % sdi.marshal()[:1000]
self.ERROR(strError)
self.setFailure()
raise RuntimeError(strError)
crop = sdi.cropBorders
if len(crop) > 1 :
self.tCrop = tuple([ i.value for i in crop ])
elif len(crop) == 1:
self.tCrop = (crop[0].value, crop[0].value)
center = sdi.center
if len(center) > 1:
self.tCenter = tuple([ i.value for i in center ])
elif len(center) == 1:
self.tCenter = (center[0].value, center[0].value)
width = sdi.width
if len(width) > 1 :
self.tWidth = tuple([i.value for i in width])
elif len(width) == 1:
self.tWidth = (width[0].value, width[0].value)
smooth = sdi.smoothBorders
if len(smooth) == 2:
self.tSmooth = (smooth[0].value, smooth[1].value)
elif len(smooth) == 1:
self.tSmooth = (smooth[0].value, smooth[0].value)
if sdi.backgroundSubtraction is not None:
self.bBackgroundsubtraction = (sdi.backgroundSubtraction.value in [1, True, "true"])
if sdi.sobelFilter is not None:
self.sobel = (sdi.sobelFilter in [1, True, "true"])
EDAssert.equal(self.npaIm1.shape , self.npaIm2.shape, "Images have the same size")
示例5: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecShiftImagev1_0.preProcess")
sdi = self.dataInput
if sdi.inputImage is not None:
self.npaImage = numpy.array(EDUtilsArray.getArray(sdi.inputImage))
elif sdi.inputArray is not None:
self.npaImage = EDUtilsArray.xsDataToArray(sdi.getInputArray())
else:
self.ERROR("EDPluginExecShiftImagev1_0.preProcess: You should either provide an images or an arrays, but I got: %s" % sdi.marshal())
self.setFailure()
raise RuntimeError
offset = sdi.offset
if len(offset) == 2:
self.tOffset = (offset[0].value, offset[1].value)
elif len(offset) == 1:
self.tOffset = (offset[0].value, offset[0].value)
if sdi.outputImage is not None:
if sdi.outputImage.path is not None:
self.strOutputType = "file"
self.strOutputImage = sdi.outputImage.path.value
if sdi.outputImage.shared is not None:
self.strOutputType = "shared"
self.strOutputImage = sdi.outputImage.shared.value
if sdi.outputImage.array is not None:
self.strOutputType = "array"
示例6: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginHDF5.preProcess(self)
self.DEBUG("EDPluginHDF5StackImagesv10test.preProcess")
for onefile in self.dataInput.inputImageFile:
if onefile.path is not None:
self.listImageFilenames.append(onefile.path.value)
if onefile.date is not None:
self.listImageDates.append(onefile.date.value)
if onefile.number is not None:
self.listForcedPositions.append(onefile.number.value)
self.listArray.append(EDUtilsArray.getArray(onefile))
for oneArray in self.dataInput.getInputArray():
self.listArray.append(EDUtilsArray.xsDataToArray(oneArray))
if self.dataInput.index != []:
self.listForcedPositions = [i.value for i in self.dataInput.index]
if self.dataInput.getDeleteInputImage() is not None:
self.bDeleteImage = bool(self.dataInput.deleteInputImage.value)
if self.listForcedPositions != []:
EDAssert.equal(len(self.listForcedPositions), max(len(self.listImageFilenames), len(self.listArray)), "Forced position list has a good length")
if self.listImageDates != []:
EDAssert.equal(len(self.listImageDates) , len(self.listImageFilenames), "listImageDates has the same size as listImageFilenames")
示例7: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginHDF5.preProcess(self)
self.DEBUG("EDPluginHDF5StackImagesv10.preProcess")
for onefile in self.dataInput.inputImageFile:
if onefile is None:
self.ERROR("Please investigate why EDPluginHDF5StackImagesv10.dataInput.inputImageFile is a list containing None !!!!")
self.setFailure()
continue
if onefile.path is not None:
self.listImageFilenames.append(onefile.path.value)
if onefile.date is not None:
self.listImageDates.append(onefile.date.value)
if onefile.number is not None:
self.listForcedPositions.append(onefile.number.value)
self.listArray.append(EDUtilsArray.getArray(onefile))
for oneArray in self.dataInput.inputArray:
self.listArray.append(EDUtilsArray.xsDataToArray(oneArray))
if self.dataInput.index != []:
self.listForcedPositions = [i.value for i in self.dataInput.index]
if self.dataInput.getDeleteInputImage() is not None:
self.bDeleteImage = bool(self.dataInput.deleteInputImage.value)
if self.listForcedPositions != []:
EDAssert.equal(len(self.listForcedPositions), max(len(self.listImageFilenames), len(self.listArray)), "Forced position list has a good length")
if self.listImageDates != []:
EDAssert.equal(len(self.listImageDates) , len(self.listImageFilenames), "listImageDates has the same size as listImageFilenames")
self.hdf5group = EDPluginHDF5.createStructure(self.strHDF5Filename, self.strHDF5Path, self.dictExtraAttributes)
示例8: testExecute
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def testExecute(self):
"""
"""
self.run()
# plugin = self.getPlugin()
strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
EDVerbose.DEBUG("Checking obtained result...")
xsDataResultReference = XSDataResultNormalize.parseString(strExpectedOutput)
xsDataResultObtained = XSDataResultNormalize.parseString(strObtainedOutput)
#EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "Result XML are the same")
npaReference = EDUtilsArray.getArray(xsDataResultReference.output)
npaObtained = EDUtilsArray.getArray(xsDataResultObtained.output)
EDAssert.arraySimilar(npaReference, npaObtained, "Arrays are the same", _fAbsMaxDelta=1e-6)
EDAssert.equal(npaReference.dtype, npaObtained.dtype, "Datatypes are the same")
示例9: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginControl.preProcess(self)
self.DEBUG("EDPluginControlAlignStackv1_0.preProcess")
sdi = self.dataInput
self.xsdHDF5File = sdi.HDF5File
self.xsdHDF5Internal = sdi.internalHDF5Path
self.hdf5ExtraAttributes = sdi.extraAttributes
if sdi.dontAlign is not None:
self.bDoAlign = not(bool(sdi.dontAlign.value))
self.iFrames = [ xsd.value for xsd in sdi.index]
for idx, oneXSDFile in enumerate(sdi.images):
self.npArrays.append(EDUtilsArray.getArray(oneXSDFile))
if len(self.iFrames) <= idx:
if (oneXSDFile.number is not None):
self.iFrames.append(oneXSDFile.number.value)
elif oneXSDFile.path is not None :
number = ""
filename = oneXSDFile.path.value
basename = os.path.splitext(filename)[0]
for i in basename[-1:0:-1]:
if i.isdigit():
number = i + number
else: break
self.iFrames.append(int(number))
if self.npArrays == []:
strError = "EDPluginControlAlignStackv1_0.preProcess: You should either provide an images or an arrays, but I got: %s" % sdi.marshal()
self.ERROR(strError)
self.setFailure()
self.xsdMeasureOffset = sdi.measureOffset
if self.xsdMeasureOffset.alwaysVersusRef is not None:
self.bAlwaysMOvsRef = bool(self.xsdMeasureOffset.alwaysVersusRef.value)
with self.__class__.__semaphore:
if (self.__class__.__iRefFrame is None):
self.DEBUG("reference Frame is: %s" % sdi.frameReference.value)
if sdi.getFrameReference() is not None:
self.__class__.__iRefFrame = sdi.frameReference.value
else:
self.__class__.__iRefFrame = 0
if len(self.iFrames) == len(self.npArrays):
for i, j in zip(self.iFrames, self.npArrays):
self.addFrame(i, j)
else:
self.ERROR("EDPluginControlAlignStackv1_0.preProcess: You should either provide an images with a frame number or precise it in the XML ! I got: %s" % sdi.marshal())
self.setFailure()
raise RuntimeError
示例10: doSuccessExecNormalize
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def doSuccessExecNormalize(self, _edPlugin=None):
with self.locked():
self.DEBUG("EDPluginControlFullFieldXASv1_0.doSuccessExecNormalize")
self.retrieveSuccessMessages(_edPlugin, "EDPluginControlFullFieldXASv1_0.doSuccessExecNormalize")
self.xsdAlignStack.setMeasureOffset(self.xsdMeasureOffset)
output = _edPlugin.dataOutput.output
self.xsdAlignStack.images = [output]
data = EDUtilsArray.getArray(output)
data.shape = -1
self.xsdAlignStack.index = [XSDataInteger(self.index)]
self.xsdAlignStack.frameReference = XSDataInteger(self.reference)
self.xsdAlignStack.HDF5File = self.dataInput.getHDF5File()
self.xsdAlignStack.internalHDF5Path = self.internalHDF5Path
internalHDF5Path = self.internalHDF5Path.value
if not internalHDF5Path.startswith("/"):
internalHDF5Path = "/" + internalHDF5Path
keyValuePair1 = XSDataKeyValuePair(key=XSDataString("axes"), value=XSDataString(self.DSenergy))
keyValuePair2 = XSDataKeyValuePair(key=XSDataString("long_name"), value=XSDataString(self.TITLE))
keyValuePair3 = XSDataKeyValuePair(key=XSDataString("interpretation"), value=XSDataString("image"))
keyValuePair4 = XSDataKeyValuePair(key=XSDataString("signal"), value=XSDataString("1"))
xsAttrDataset = XSDataHDF5Attributes(
h5path=XSDataString(posixpath.join(internalHDF5Path, self.DSstack)),
metadata=XSDataDictionary(
[XSDataKeyValuePair(key=XSDataString(k), value=XSDataString(v)) for k, v in self.dataAttr.items()]
),
)
# NXdata is treated in this file not in HDF5 plugins
# xsAttrNXdata = XSDataHDF5Attributes(h5path=XSDataString(posixpath.join(internalHDF5Path, "NXdata")), \
# metadata=XSDataDictionary([XSDataKeyValuePair(key=XSDataString(k), value=XSDataString(v)) for k, v in self.NXdataAttr.items()]))
xsAttrEntry = XSDataHDF5Attributes(
h5path=XSDataString(internalHDF5Path),
metadata=XSDataDictionary(
[
XSDataKeyValuePair(key=XSDataString(k), value=XSDataString(v))
for k, v in self.NXentryAttr.items()
]
),
)
self.xsdAlignStack.extraAttributes = [xsAttrDataset, xsAttrEntry]
########################################################################
# Selecte the mean of last centile
########################################################################
data.sort()
fMaxSignal = data[int(0.99 * len(data)) :].mean()
self.makeHDF5MaxIntStructure(fMaxSignal)
示例11: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
self.DEBUG("EDPluginExecStitchOffsetedImagev1_0.preProcess")
sdi = self.getDataInput()
for ofImage in sdi.getInputImages():
if (ofImage.file is not None) and os.path.isfile(ofImage.file.path.value):
self._lImages.append(EDUtilsArray.getArray(ofImage.file))
elif (ofImage.array is not None):
self._lImages.append(EDUtilsArray.xsDataToArray(ofImage.array))
else:
strError = "EDPluginExecStitchOffsetedImagev1_0.preProcess: You need to provide either an image file either an array; I got: %s !!!" % ofImage.marshal()
self.ERROR(strError)
raise RuntimeError(strError)
dummy = [0.0, 0.001]
if ofImage.dummyValue is not None:
dummy[0] = ofImage.dummyValue.value
if ofImage.deltaDummy is not None:
dummy[1] = ofImage.deltaDummy.value
self._lDummies.append(tuple(dummy))
if ofImage.offset not in [list(), None]:
offset = [i.value for i in ofImage.offset ]
else:
offset = [0, 0]
self._lOffsets.append(tuple(offset))
if sdi.blending is not None:
self._strBlending = sdi.blending.value
if sdi.dummyValue is not None:
self._fDummy = sdi.dummyValue.value
if sdi.outputImage is not None:
self._strOutFile = sdi.outputImage.path.value
if sdi.autoscale is not None:
self._bAutoscale = bool(sdi.autoscale.value)
if sdi.mask is not None:
self._strMask = sdi.mask.path.value
if not os.path.isfile(self._strMask):
self._strMask = None
center = sdi.centerROI
if len(center) > 1:
self.tCenter = tuple([ i.value for i in center ])
elif len(center) == 1:
self.tCenter = (center[0].value, center[0].value)
width = sdi.widthROI
if len(width) > 1 :
self.tWidth = tuple([i.value for i in width])
elif len(width) == 1:
self.tWidth = (width[0].value, width[0].value)
示例12: process
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def process(self, _edObject=None):
EDPluginExec.process(self)
self.DEBUG("EDPluginExecPyFAIv1_0.process")
data = EDUtilsArray.getArray(self.dataInput.input)
if self.dataInput.saxsWaxs and self.dataInput.saxsWaxs.value.lower().startswith("s"):
out = self.ai.saxs(self.data,
nbPt=self.nbPt,
filename=self.strOutputFile,
mask=self.mask,
dummy=self.dummy,
delta_dummy=self.delta_dummy)
else:
out = self.ai.xrpd(self.data,
nbPt=self.nbPt,
filename=self.strOutputFile,
mask=self.mask,
dummy=self.dummy,
delta_dummy=self.delta_dummy)
self.npaOut = np.hstack((i.reshape(-1, 1) for i in out if i is not None))
示例13: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExecProcessScript.preProcess(self)
self.DEBUG("EDPluginExecGnomv0_2.preProcess")
if self.dataInput.angularScale is not None:
self.fAngularScale = self.dataInput.angularScale.value
dataInput = self.dataInput
inputFile = None
if len(dataInput.experimentalDataQ) > 0:
self.npaExperimentalDataQ = numpy.array([i.value for i in dataInput.experimentalDataQ])
elif dataInput.experimentalDataQArray is not None:
self.npaExperimentalDataQ = EDUtilsArray.xsDataToArray(dataInput.experimentalDataQArray)
elif dataInput.experimentalDataFile is not None:
inputFile = dataInput.experimentalDataFile.path.value
else:
strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataQ or experimentalDataQArray or experimentalDataFile"
self.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
if len(dataInput.experimentalDataValues) > 0:
self.npaExperimentalDataI = numpy.array([i.value for i in dataInput.experimentalDataValues])
elif dataInput.experimentalDataIArray is not None:
self.npaExperimentalDataI = EDUtilsArray.xsDataToArray(dataInput.experimentalDataIArray)
elif dataInput.experimentalDataFile is not None:
inputFile = dataInput.experimentalDataFile.path.value
else:
strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataValues or experimentalDataIArray or experimentalDataFile"
self.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
if len(dataInput.experimentalDataStdDev) > 0:
self.npaExperimentalDataStdDev = numpy.array([i.value for i in dataInput.experimentalDataStdDev])
elif dataInput.experimentalDataStdArray is not None:
self.npaExperimentalDataStdDev = EDUtilsArray.getArray(dataInput.experimentalDataStdArray)
if inputFile:
self.loadDataFile(inputFile)
self.generateGnomConfigFile()
self.generateGnomScript()
示例14: preProcess
# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import getArray [as 别名]
def preProcess(self, _edObject=None):
EDPluginExec.preProcess(self)
EDVerbose.DEBUG("EDPluginExecShiftImagev1_0.preProcess")
sdi = self.getDataInput()
if sdi.inputImage is not None:
self.npaImage = numpy.array(EDUtilsArray.getArray(sdi.inputImage))
elif sdi.getInputArray() is not None:
self.npaImage = EDUtilsArray.xsDataToArray(sdi.getInputArray())
else:
EDVerbose.ERROR("EDPluginExecShiftImagev1_0.preProcess: You should either provide an images or an arrays, but I got: %s" % sdi.marshal())
self.setFailure()
raise RuntimeError
offset = sdi.getOffset()
if len(offset) == 2:
self.tOffset = (offset[0].getValue(), offset[1].getValue())
elif len(offset) == 1:
self.tOffset = (offset[0].getValue(), offset[0].getValue())
if sdi.getOutputImage() is not None:
self.strOutputImage = sdi.getOutputImage().getPath().getValue()