本文整理汇总了Python中EDUtilsArray.EDUtilsArray类的典型用法代码示例。如果您正苦于以下问题:Python EDUtilsArray类的具体用法?Python EDUtilsArray怎么用?Python EDUtilsArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDUtilsArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: postProcess
def postProcess(self, _edObject=None):
EDPluginExec.postProcess(self)
self.DEBUG("EDPluginExecShiftImagev1_0.postProcess")
# Create some output data
xsDataResult = XSDataResultShiftImage()
if self.strOutputType is None:
xsDataResult.setOutputArray(EDUtilsArray.arrayToXSData(self.npaImage))
elif self.strOutputType == "file":
image = edfimage(
data=self.npaImage,
header={"Offset_1": self.tOffset[0], "Offset_2": self.tOffset[1], "Max_Offset": self.MAX_OFFSET_VALUE},
)
image.write(self.strOutputImage, force_type=self.npaImage.dtype)
xsdimg = XSDataImageExt(path=XSDataString(self.strOutputImage))
xsDataResult.outputImage = xsdimg
elif self.strOutputType == "shared":
EDShare[self.strOutputImage] = self.npaImage
xsdimg = XSDataImageExt(shared=XSDataString(self.strOutputImage))
xsDataResult.outputImage = xsdimg
elif self.strOutputType == "array":
xsdimg = XSDataImageExt(array=EDUtilsArray.arrayToXSData(self.npaImage))
xsDataResult.outputImage = xsdimg
self.setDataOutput(xsDataResult)
self.npaImage = None
示例2: preProcess
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)
示例3: preProcess
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")
示例4: preProcess
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"
示例5: createNexusGroup
def createNexusGroup(self, _numpyDataArray,_groupTitle, _groupLongName,
_numpyXAxisDataArray=None, _xAxisTitle=None, _xAxisLongName=None, _xAxisUnit=None,
_numpyYAxisDataArray=None, _yAxisTitle=None, _yAxisLongName=None, _yAxisUnit=None,
):
# Create entry for data arrays in nexus file
xsDataNexusArrayGroup = XSDataNexusArrayGroup()
xsDataNexusArrayGroup.title = XSDataString(_groupTitle)
xsDataNexusArrayGroup.long_name = XSDataString(_groupLongName)
xsDataNexusArrayGroup.data = EDUtilsArray.arrayToXSData(_numpyDataArray)
xsDataNexusArrayGroup.signal = XSDataInteger(1)
if _numpyXAxisDataArray is not None:
xsDataNexusAxisX = XSDataNexusAxis()
xsDataNexusAxisX.title = XSDataString(_xAxisTitle)
xsDataNexusAxisX.long_name = XSDataString(_xAxisLongName)
xsDataNexusAxisX.primary = XSDataInteger(1)
xsDataNexusAxisX.axis = XSDataInteger(0)
xsDataNexusAxisX.units = XSDataString(_xAxisUnit)
xsDataNexusAxisX.axisData = EDUtilsArray.arrayToXSData(_numpyXAxisDataArray)
xsDataNexusArrayGroup.addAxis(xsDataNexusAxisX)
if _numpyYAxisDataArray is not None:
xsDataNexusAxisY = XSDataNexusAxis()
xsDataNexusAxisY.title = XSDataString(_yAxisTitle)
xsDataNexusAxisY.long_name = XSDataString(_yAxisLongName)
xsDataNexusAxisY.primary = XSDataInteger(2)
xsDataNexusAxisY.axis = XSDataInteger(1)
xsDataNexusAxisY.units = XSDataString(_yAxisUnit)
xsDataNexusAxisY.axisData = EDUtilsArray.arrayToXSData(_numpyYAxisDataArray)
xsDataNexusArrayGroup.addAxis(xsDataNexusAxisY)
# print xsDataInputWriteNexusFile.marshal()
return xsDataNexusArrayGroup
示例6: process
def process(self, _edObject = None):
EDPluginExec.process(self)
self.DEBUG("EDPluginExecReadDataID24v1_0.process")
self.checkMandatoryParameters(self.dataInput, "Data Input is None")
self.checkMandatoryParameters(self.dataInput.inputFile, "Data Input 'inputFile' is None")
self.checkMandatoryParameters(self.dataInput.energyCalibration, "Data Input 'energyuCalibration' is None")
self.checkMandatoryParameters(self.dataInput.energyCalibration.a, "Data Input 'energyCalibration a' is None")
self.checkMandatoryParameters(self.dataInput.energyCalibration.b, "Data Input 'energyCalibration b' is None")
# Load input data
listNumpyArray = []
iNumberOfSPectra = 0
iNumberOfEnergies = 0
for xsDataFile in self.dataInput.inputFile:
numpyDataArray = self.loadInputData(xsDataFile.path.value)
# print numpyDataArray.shape
listNumpyArray.append(numpyDataArray)
iNumberOfEnergies = numpyDataArray.shape[0]
iNumberOfSPectra += numpyDataArray.shape[1]
numpyTotalDataArray = numpy.zeros((iNumberOfEnergies,iNumberOfSPectra))
# print numpyTotalDataArray.shape
iIndex = 0
for numpyDataArray in listNumpyArray:
iSpectra = numpyDataArray.shape[1]
numpyTotalDataArray[:,iIndex:iIndex+iSpectra] = numpyDataArray
iIndex += iSpectra
# Create energy calibration array
numpyEnergyCalibrationArray = self.createEnergyCalibrationArray(numpyTotalDataArray.shape[0], self.dataInput.energyCalibration)
# Create some output data
xsDataResultReadDataID24 = XSDataResultReadDataID24()
xsDataResultReadDataID24.energy = EDUtilsArray.arrayToXSData(numpyEnergyCalibrationArray)
xsDataResultReadDataID24.dataArray = EDUtilsArray.arrayToXSData(numpyTotalDataArray)
self.setDataOutput(xsDataResultReadDataID24)
示例7: testExecute
def testExecute(self):
"""
"""
self.run()
plugin = self.getPlugin()
# Checking obtained results
xsDataResult = plugin.getDataOutput()
xsDataRef = XSDataResult1DPowderEDF.parseString(
self.readAndParseFile(self.getReferenceDataOutputFile()))
# EDAssert.strAlmostEqual(XSDataResult1DPowderEDF.parseString(self.readAndParseFile(self.getReferenceDataOutputFile())).marshal(), xsDataResult.marshal(), _strComment="XML structures are the same")
tthref = EDUtilsArray.xsDataToArray(
xsDataRef.getTwoTheta(), _bCheckMd5sum=False)
tthobt = EDUtilsArray.xsDataToArray(
xsDataResult.getTwoTheta(), _bCheckMd5sum=False)
Iref = EDUtilsArray.xsDataToArray(
xsDataRef.getIntensity(), _bCheckMd5sum=False)
Iobt = EDUtilsArray.xsDataToArray(
xsDataResult.getIntensity(), _bCheckMd5sum=False)
EDAssert.arraySimilar(
_npaValue=tthobt,
_npaRef=tthref,
_fAbsMaxDelta=0.1,
_strComment="2theta arrays are the same")
EDAssert.arraySimilar(
_npaValue=Iobt,
_npaRef=Iref,
_fAbsMaxDelta=0.1,
_strComment="Intensity arrays are the same")
示例8: preProcess
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
示例9: process
def process(self, _edObject = None):
EDPluginExec.process(self)
self.DEBUG("EDPluginExecWriteNexusFilev1_0.process")
xsDataInput = self.getDataInput()
# print xsDataInput.marshal()
fileName = str(xsDataInput.outputFileName.value)
if xsDataInput.outputFileDirectory is None:
fileDir = self.getWorkingDirectory()
else:
fileDir = str(xsDataInput.outputFileDirectory.value)
# timestamp = "2010-10-18T17:17:04-0500"
timestamp = datetime.datetime.now().isoformat()
instrument = str(xsDataInput.instrument.value)
# Create nexus file
nexusFile = self.makeFile(os.path.join(fileDir, fileName), file_name=fileName,
file_time=timestamp,
instrument=instrument,
creator="EDPluginExecWriteNexusFilev1_0",
NeXus_version="4.3.0",
HDF5_Version=h5py.version.hdf5_version,
h5py_version=h5py.version.version)
# Write main data
nxentry = self.makeGroup(nexusFile, "Result", "NXentryResult")
for nexusGroup in xsDataInput.nexusGroup:
groupTitle = str(nexusGroup.title.value)
long_name = str(nexusGroup.long_name.value)
nxdata = self.makeGroup(nxentry, groupTitle, "NXdata", long_name=long_name)
# First add the axes - if any...
listAxisNames = []
for xsDataNexusAxis in nexusGroup.axis:
numpyAxisArray = EDUtilsArray.xsDataToArray(xsDataNexusAxis.axisData)
self.makeDataset(nxdata,
str(xsDataNexusAxis.title.value),
numpyAxisArray,
axis=xsDataNexusAxis.axis.value,
primary=xsDataNexusAxis.primary.value,
units=str(xsDataNexusAxis.units.value),
long_name=str(xsDataNexusAxis.long_name.value))
listAxisNames.append(str(xsDataNexusAxis.title.value))
numpyDataArray = EDUtilsArray.xsDataToArray(nexusGroup.data)
strAxisNames = ""
bFirst = True
for strAxisName in listAxisNames:
if bFirst:
strAxisNames += strAxisName
bFirst = False
else:
strAxisNames += ":"+strAxisName
self.makeDataset(nxdata, groupTitle, numpyDataArray.transpose(),
signal='1', # Y axis of default plot
axes=strAxisNames, # name of X and Y axes
long_name=long_name)
pass
xsDataResult = XSDataResultWriteNexusFile()
xsDataResult.outputFilePath = XSDataFile(XSDataString(os.path.join(fileDir, fileName)))
self.setDataOutput(xsDataResult)
示例10: preProcess
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 ")
示例11: doSuccessProcessOneFile
def doSuccessProcessOneFile(self, _edPlugin=None):
self.DEBUG("EDPluginBioSaxsHPLCv1_5.doSuccessProcessOneFile")
self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsHPLCv1_5.doSuccessProcessOneFile")
if _edPlugin and _edPlugin.dataOutput and _edPlugin.dataOutput.status and _edPlugin.dataOutput.status.executiveSummary:
self.lstExecutiveSummary.append(_edPlugin.dataOutput.status.executiveSummary.value)
output = _edPlugin.dataOutput
if not output.integratedCurve:
strErr = "Edna plugin ProcessOneFile did not produce integrated curve"
self.ERROR(strErr)
self.lstExecutiveSummary.append(strErr)
self.setFailure()
return
self.curve = output.integratedCurve.path.value
if not os.path.exists(self.curve):
strErr = "Edna plugin ProcessOneFile: integrated curve not on disk !!"
self.ERROR(strErr)
self.lstExecutiveSummary.append(strErr)
self.setFailure()
return
self.xsDataResult.integratedCurve = output.integratedCurve
self.xsDataResult.normalizedImage = output.normalizedImage
self.xsDataResult.dataI = output.dataI
self.xsDataResult.dataQ = output.dataQ
self.xsDataResult.dataStdErr = output.dataStdErr
self.intensity = EDUtilsArray.xsDataToArray(output.dataI)
self.stdError = EDUtilsArray.xsDataToArray(output.dataStdErr)
if output.experimentSetup and output.experimentSetup.timeOfFrame:
startTime = output.experimentSetup.timeOfFrame.value
else:
try:
startTime = float(fabio.openheader(self.dataInput.rawImage.path.value).header["time_of_day"])
except Exception:
self.ERROR("Unable to read time_of_day in header of %s" % self.dataInput.rawImage.path.value)
startTime = 0
if not self.hplc_run.first_curve:
with self._sem:
if True: #not self.hplc_run.first_curve:
# Populate the buffer with the first curve if needed
self.hplc_run.first_curve = self.curve
self.hplc_run.start_time = startTime
self.hplc_run.q = EDUtilsArray.xsDataToArray(output.dataQ)
self.hplc_run.size = self.hplc_run.q.size
self.hplc_run.buffer_I = self.intensity
self.hplc_run.buffer_Stdev = self.stdError
self.hplc_run.firstCurveIntensity = self.intensity
self.hplc_run.for_buffer_sum_I = self.intensity
self.hplc_run.for_buffer_sum_sigma2 = self.stdError ** 2
self.hplc_run.for_buffer.append(self.frameId)
self.frame.curve = self.curve
self.frame.time = startTime
self.xsDataResult.timeStamp = XSDataTime(value=(startTime - self.hplc_run.start_time))
# self.calcIntensity()
self.frame.sum_I = float(self.intensity.sum())
self.xsDataResult.summedIntensity = XSDataDouble(value=self.frame.sum_I)
示例12: unitTestArraytoXsdNoNumpy
def unitTestArraytoXsdNoNumpy(self):
"""
test the execution of detectNumberOfCPUs
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestArraytoXsdNoNumpy")
EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
EDUtilsArray.arrayToXSData(self.arrayNumpy, _bForceNoNumpy=True).marshal(),
_strComment="XSDataArray from (numpyArray) are the same (forced No Numpy)")
EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
EDUtilsArray.arrayToXSData(self.arrayNoNumpy, _bForceNoNumpy=True).marshal(),
_strComment="XSDataArray from (list of lists) are the same (forced No Numpy)")
示例13: preProcess
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")
示例14: unitTestArraytoXsd
def unitTestArraytoXsd(self):
"""
test the execution of xsDataToArray static method
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestArraytoXsd")
if numpy is not None:
EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNumpy).marshal(),
EDUtilsArray.arrayToXSData(self.arrayNumpy).marshal(),
_strComment="XSDataArray from (numpyArray) are the same")
else:
EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
EDUtilsArray.arrayToXSData(self.arrayNumpy).marshal(),
_strComment="XSDataArray from (Non numpy Array) are the same")
示例15: unitTestXsdToArray
def unitTestXsdToArray(self):
"""
test the execution of xsDataToArray static method
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestXsdToArray")
if numpy is not None:
EDAssert.arraySimilar(self.arrayNumpy,
EDUtilsArray.xsDataToArray(self.xsDataArrayNumpy, _bForceNoNumpy=False),
_strComment="Array are the same (Numpy used)")
else:
EDAssert.equal(self.arrayNoNumpy,
EDUtilsArray.xsDataToArray(self.xsDataArrayNumpy, _bCheckMd5sum=True, _bForceNoNumpy=False),
"Array are the same (no Numpy available)")