def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()

        EDVerbose.DEBUG("Checking obtained result...")
        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
        xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
#        EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal())
#        EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal())
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same")

        # Checking obtained results
        xsDataResultsSPDCake = plugin.getDataOutput()
        strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue()
        strPathToChiReference = os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_0.chi")
        Xref, Yref = readChiPlot(strPathToChiReference)
        Xobt, Yobt = readChiPlot(strPathToChiOutput)
        EDVerbose.DEBUG("Output File: %s, Reference file: %s" % (strPathToChiOutput, strPathToChiReference))
        bigX = Xref + Xobt
        bigX.sort()
        bigYobt = numpy.interp(bigX, Xobt, Yobt)
        bigYref = numpy.interp(bigX, Xref, Yref)
        EDVerbose.DEBUG("ref.shape= %s, obt.shape=%s" % (bigYobt.shape, bigYref.shape))
        EDVerbose.DEBUG("Type of object ref= %s, obt=%s" % (bigYobt.__class__, bigYref.__class__))
        EDAssert.arraySimilar(bigYobt, bigYref, _fAbsMaxDelta=0.1, _fScaledMaxDelta=0.1, _strComment="Comparing ChiPlot files")
Exemplo n.º 2
0
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        xsDataResultReference = XSDataResultSPDCake.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        #        EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal())
        #        EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal())
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                "XSDataResult output are the same")

        # Checking obtained results
        xsDataResultsSPDCake = plugin.getDataOutput()
        strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath(
        ).getValue()
        strDataObtained = EDUtilsFile.readFile(strPathToChiOutput)
        strDataReference = EDUtilsFile.readFile(
            os.path.join(self.getTestsDataImagesHome(),
                         "EDPluginSPDCakev1_1.cif"))
        EDAssert.strAlmostEqual(strDataReference,
                                strDataObtained,
                                "Comparing PowderCIF output",
                                _fAbsError=2e-3)
 def preProcess(self):
     """
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage([ "diff6105.edf", "darks0001.edf", "flats0001.edf", "EDPluginSPDCakev1_0.cif" ])
     strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
     xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput)
     outputFileName = xsDataResultReference.getCakedFile().getPath().getValue()
     EDVerbose.DEBUG(" Output file is %s" % outputFileName)
     if not os.path.isdir(os.path.dirname(outputFileName)):
         os.makedirs(os.path.dirname(outputFileName))
     if os.path.isfile(outputFileName):
         EDVerbose.DEBUG(" Output file exists %s, I will remove it" % outputFileName)
         os.remove(outputFileName)
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        #        # Checking obtained results
        xsDataResultsSPDCake = plugin.getDataOutput()
        pathToOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue()
        #        edStringDataObtained = EDUtilsFile.readFile(pathToOutput)
        #        edStringDataReference = EDUtilsFile.readFile(os.path.join(self.getPluginTestsDataHome(), \
        #                                                                             "EDPluginSPDCakev1_1.chi"))
        #        EDAssert.strAlmostEqual(edStringDataReference, edStringDataObtained, "Comparing ChiPlot files")
        EDVerbose.DEBUG("Checking obtained result...")
        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        xsDataResultReference = XSDataResultSPDCake.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                "XSDataResult output are the same")

        # Checking obtained results
        xsDataResultsSPDCake = plugin.getDataOutput()
        strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath(
        ).getValue()
        strPathToChiReference = os.path.join(self.getTestsDataImagesHome(),
                                             "EDPluginSPDCakev1_1.chi")
        Xref, Yref = readChiPlot(strPathToChiReference)
        Xobt, Yobt = readChiPlot(strPathToChiOutput)
        EDVerbose.DEBUG("Output File: %s, Reference file: %s" %
                        (strPathToChiOutput, strPathToChiReference))
        bigX = Xref + Xobt
        bigX.sort()
        bigYobt = numpy.interp(bigX, Xobt, Yobt)
        bigYref = numpy.interp(bigX, Xref, Yref)
        EDVerbose.DEBUG("ref.shape= %s, obt.shape=%s" %
                        (bigYobt.shape, bigYref.shape))
        EDVerbose.DEBUG("Type of object ref= %s, obt=%s" %
                        (bigYobt.__class__, bigYref.__class__))
        EDAssert.arraySimilar(bigYobt,
                              bigYref,
                              _fAbsMaxDelta=0.1,
                              _fScaledMaxDelta=0.1,
                              _strComment="Comparing ChiPlot files")
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
        xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
#        EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal())
#        EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal())
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same")


        # Checking obtained results
        xsDataResultsSPDCake = plugin.getDataOutput()
        strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue()
        strDataObtained = EDUtilsFile.readFile(strPathToChiOutput)
        strDataReference = EDUtilsFile.readFile(os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_0.cif"))
        EDAssert.strAlmostEqual(strDataReference, strDataObtained, "Comparing PowderCIF output")
 def preProcess(self):
     """
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage([
         "diff6105.edf", "darks0001.edf", "flats0001.edf",
         "EDPluginSPDCakev1_1.chi"
     ])
     strExpectedOutput = self.readAndParseFile(
         self.getReferenceDataOutputFile())
     xsDataResultReference = XSDataResultSPDCake.parseString(
         strExpectedOutput)
     outputFileName = xsDataResultReference.getCakedFile().getPath(
     ).getValue()
     EDVerbose.DEBUG(" Output file is %s" % outputFileName)
     if not os.path.isdir(os.path.dirname(outputFileName)):
         os.makedirs(os.path.dirname(outputFileName))
     if os.path.isfile(outputFileName):
         EDVerbose.DEBUG(" Output file exists %s, I will remove it" %
                         outputFileName)
         os.remove(outputFileName)
Exemplo n.º 7
0
    def postProcess(self, _edObject=None):
        """
        postProcess of the plugin EDPluginSPDCakev1_5.py:
        - convert to HDF if needed (to be implemented)
        - convert to chiplot or xye or cif if needed
        - move images (if needed) or delete .cor image 
        - set result XML   
        """
        EDPluginSPDCorrectv10.postProcess(self)
        self.DEBUG("EDPluginSPDCakev1_5.postProcess")

        if not os.path.isdir(self.dictGeometry["OutputDirCake"]):
            os.makedirs(self.dictGeometry["OutputDirCake"])

        strInputImagePathNoSfx = os.path.splitext(
            os.path.basename(self.pathToInputFile))[0]
        strSpdoutCake = strInputImagePathNoSfx + self.dictGeometry[
            "OutputFileType"]

        strOutputCakeFilePath = os.path.join(
            self.dictGeometry["OutputDirCake"], strSpdoutCake)
        xsDataResultSPD = XSDataResultSPDCake()

        if not self.getFireAndForget():
            strTempFilePath = None
            if "corrected" in self.dictRes:
                strSpdoutCor = self.dictRes["corrected"]
            if "regrouped" in self.dictRes:
                strTempFilePath = self.dictRes["regrouped"]

            if self.dictGeometry["OutputFileType"].lower() in [
                    ".hdf5", ".nexus", ".h5", ".nx"
            ]:
                self.WARNING(
                    "HDF5/Nexus output is not yet implemented in the SPD plugin."
                )

            if strTempFilePath is None:
                self.WARNING(
                    "Cannot copy output to %s as there is not input: %s " %
                    (strOutputCakeFilePath, self.dictRes))
            elif os.path.exists(strOutputCakeFilePath):
                self.WARNING(
                    "Destination file exists, I will leave result file in %s."
                    % strTempFilePath)
                strOutputCakeFilePath = strTempFilePath
            else:
                shutil.move(strTempFilePath, strOutputCakeFilePath)

            strOutputCorFilePath = os.path.join(self.dictGeometry["OutputDir"],
                                                os.path.split(strSpdoutCor)[1])
            if self.bDeleteCorImg:
                if os.path.isfile(strSpdoutCor):
                    os.remove(strSpdoutCor)
                else:
                    self.WARNING("Corrected file vanished before removal %s" %
                                 strSpdoutCor)
            else:
                strTempFilePathCor = os.path.join(self.getWorkingDirectory(),
                                                  strSpdoutCor)
                if self.dictGeometry["OutputFileType"].lower() in [
                        ".hdf5", ".nexus", ".h5", ".nx"
                ]:
                    self.WARNING(
                        "HDF5/Nexus output is not yet implemented in the SPD plugin."
                    )
                elif self.dictGeometry["OutputFileType"].lower() not in [
                        ".edf", ".azim", ".cor"
                ]:
                    self.WARNING(
                        "Output file format %s is not yet implemented in the SPD plugin."
                        % self.dictGeometry["OutputFileType"])

                if os.path.exists(strOutputCorFilePath):
                    self.WARNING(
                        "Destination file exists, I will leave result file in %s."
                        % strTempFilePathCor)
                    strOutputCorFilePath = os.path.abspath(strTempFilePathCor)
                else:

                    shutil.move(strTempFilePath, strOutputCorFilePath)
                xsDataFileCorr = XSDataFile()
                xsDataFileCorr.setPath(XSDataString(strOutputCorFilePath))
                xsDataResultSPD.setcorrectedFile(xsDataFileCorr)
#        # Create the output data
        xsDataFileCake = XSDataFile()
        xsDataFileCake.setPath(XSDataString(strOutputCakeFilePath))
        xsDataResultSPD.setCakedFile(xsDataFileCake)

        self.setDataOutput(xsDataResultSPD)
Exemplo n.º 8
0
    def postProcess(self, _edObject=None):

        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginSPDCakev1_1.postProcess")

        xsDataInputSPDCake = self.getDataInput()
        strOutputFileType = xsDataInputSPDCake.getOutputFileType().getValue()
        # Determine the image file name without path and suffix
        strInputImageFilePath = xsDataInputSPDCake.getInputFile().getPath(
        ).getValue()
        strInputFileNameWithoutSuffix = os.path.splitext(
            EDUtilsFile.getBaseName(strInputImageFilePath))[0]

        self.strOutputFileSuffix = "data"
        if (strOutputFileType == "PowderCIF"):
            self.strOutputFileSuffix = "cif"
        elif (strOutputFileType == "CHIPLOT"):
            self.strOutputFileSuffix = "chi"

        strOutputFileName = strInputFileNameWithoutSuffix + "." + self.strOutputFileSuffix
        if self.outputDir is None:
            self.m_strOutputFilePath = os.path.join(self.getWorkingDirectory(),
                                                    strOutputFileName)
        else:
            self.m_strOutputFilePath = os.path.join(self.outputDir,
                                                    strOutputFileName)
        PyStrCakeFilePrefix = os.path.splitext(
            os.path.split(strInputImageFilePath)[1])[0]

        ################################################################
        ####  Do some manipulation of the  output image  ##############
        ################################################################
        EDFCakeFile = fabio.open(
            os.path.join(self.getWorkingDirectory(),
                         PyStrCakeFilePrefix + ".azim.edf"))
        npaData = EDFCakeFile.data
        pydHeader = EDFCakeFile.header

        pyfPixSize = float(pydHeader["PSize_1"].split()[0])
        pyfDist = float(pydHeader["SampleDistance"].split()[0])
        EDVerbose.DEBUG("Calculation done with PixSize=%s, distance= %s" %
                        (pydHeader["PSize_1"], pydHeader["SampleDistance"]))
        pyiNbAzimBin, pyiLength = npaData.shape
        nplInt = npaData.reshape((pyiLength))
        nplTth = numpy.degrees(
            numpy.arctan(
                numpy.linspace(
                    0.5 * pyfPixSize / pyfDist,
                    (pyiLength - 0.5) * pyfPixSize / pyfDist,
                    pyiLength,
                )))

        #for the description of the +0.5 term, please refer to http://www.esrf.fr/computing/scientific/SAXS/doc/SaxsKeywords/SaxsKeywords.pdf page 23

        ######################################Debugging#######################
        f = open(os.path.join(self.getWorkingDirectory(), "original.dat"), "w")
        for i in range(pyiLength):
            f.write("%f\t%f\n" % (nplTth[i], nplInt[i]))
        f.close()
        ##############################end Debugging############################
        XRPD = lambda tth: numpy.interp(tth, nplTth, nplInt, left=0, right=0)
        pyfTthMin = nplTth[0]
        pyfTthMax = nplTth[-1]
        pyfStep = (pyfTthMax - pyfTthMin) / (pyiLength - 1)
        ########### Remove large files to prevent disk saturation when not in debug mode ###################
        if not EDVerbose.isVerboseDebug():
            os.remove(
                os.path.join(self.getWorkingDirectory(),
                             PyStrCakeFilePrefix + ".cor.edf"))
            os.remove(
                os.path.join(self.getWorkingDirectory(),
                             PyStrCakeFilePrefix + ".azim.edf"))

#        # Create the output data
        xsDataResultSPDCake = XSDataResultSPDCake()
        if (self.m_strOutputFilePath is not None):

            if (strOutputFileType == "PowderCIF"):
                import CIFfile
                cif = CIFfile.CIF()
                cif["_audit_creation_method"] = 'From 2-D detector using SPD and CIFfile'
                cif["_pd_meas_2theta_range_inc"] = str(pyfStep)
                cif["_pd_meas_2theta_range_max"] = str(pyfTthMax)
                cif["_pd_meas_2theta_range_min"] = str(pyfTthMin)
                cif["_pd_meas_number_of_points"] = str(pyiLength)
                cif["_pd_meas_scan_method"] = "fixed"
                cif["_pd_spec_description"] = pydHeader["title"]
                cif["_diffrn_radiation_wavelength"] = str(
                    self.getDataInput().getWavelength().getValue())
                cif["_pd_instr_dist_spec/detc"] = str(self.getDataInput(
                ).getSampleToDetectorDistance().getValue())
                oneloop = []
                #range( pyiLength ):
                for i in numpy.linspace(pyfTthMin, pyfTthMax, pyiLength):
                    oneloop.append({"_pd_meas_intensity_total": str(XRPD(i))})
                cif["loop_"] = [[["_pd_meas_intensity_total"], oneloop]]
                cif.saveCIF(self.m_strOutputFilePath)

            elif (strOutputFileType == "CHIPLOT"):
                f = open(
                    os.path.join(self.getWorkingDirectory(),
                                 self.m_strOutputFilePath), "w")
                f.write(
                    pydHeader["title"] +
                    ": Angular Profile\nTwo-Theta Angle (degrees)\nIntensity (normalised)\n%i\n"
                    % pyiLength)
                for i in numpy.linspace(pyfTthMin, pyfTthMax, pyiLength):
                    f.write("%f\t%f\n" % (i, XRPD(i)))
                f.close()

            xsDataFile = XSDataFile()
            xsDataFile.setPath(XSDataString(self.m_strOutputFilePath))
            xsDataResultSPDCake.setCakedFile(xsDataFile)
        self.setDataOutput(xsDataResultSPDCake)
Exemplo n.º 9
0
    def postProcess(self, _edObject=None):
        """
        postProcess of the plugin EDPluginSPDCakev1_5.py:
        - convert to HDF if needed (to be implemented)
        - convert to chiplot or xye or cif if needed
        - move images (if needed) or delete .cor image 
        - set result XML   
        """
        EDPluginSPDCorrectv10.postProcess(self)
        self.DEBUG("EDPluginSPDCakev1_5.postProcess")

        if not os.path.isdir(self.dictGeometry["OutputDirCake"]):
            os.makedirs(self.dictGeometry["OutputDirCake"])



        strInputImagePathNoSfx = os.path.splitext(os.path.basename(self.pathToInputFile))[0]
        strSpdoutCake = strInputImagePathNoSfx + self.dictGeometry["OutputFileType"]

        strOutputCakeFilePath = os.path.join(self.dictGeometry["OutputDirCake"], strSpdoutCake)
        xsDataResultSPD = XSDataResultSPDCake()


        if not self.getFireAndForget():
            strTempFilePath = None
            if "corrected" in self.dictRes:
                strSpdoutCor = self.dictRes["corrected"]
            if "regrouped" in self.dictRes:
                strTempFilePath = self.dictRes["regrouped"]

            if self.dictGeometry["OutputFileType"].lower() in [".hdf5", ".nexus", ".h5", ".nx"]:
                self.WARNING("HDF5/Nexus output is not yet implemented in the SPD plugin.")

            if strTempFilePath is None:
                self.WARNING("Cannot copy output to %s as there is not input: %s " % (strOutputCakeFilePath, self.dictRes))
            elif os.path.exists(strOutputCakeFilePath):
                self.WARNING("Destination file exists, I will leave result file in %s." % strTempFilePath)
                strOutputCakeFilePath = strTempFilePath
            else:
                shutil.move(strTempFilePath, strOutputCakeFilePath)

            strOutputCorFilePath = os.path.join(self.dictGeometry["OutputDir"], os.path.split(strSpdoutCor)[1])
            if self.bDeleteCorImg:
                if os.path.isfile(strSpdoutCor):
                    os.remove(strSpdoutCor)
                else:
                    self.WARNING("Corrected file vanished before removal %s" % strSpdoutCor)
            else:
                strTempFilePathCor = os.path.join(self.getWorkingDirectory(), strSpdoutCor)
                if self.dictGeometry["OutputFileType"].lower() in [".hdf5", ".nexus", ".h5", ".nx"]:
                    self.WARNING("HDF5/Nexus output is not yet implemented in the SPD plugin.")
                elif self.dictGeometry["OutputFileType"].lower() not in [".edf", ".azim", ".cor"] :
                    self.WARNING("Output file format %s is not yet implemented in the SPD plugin." % self.dictGeometry["OutputFileType"])

                if os.path.exists(strOutputCorFilePath):
                    self.WARNING("Destination file exists, I will leave result file in %s." % strTempFilePathCor)
                    strOutputCorFilePath = os.path.abspath(strTempFilePathCor)
                else:

                    shutil.move(strTempFilePath, strOutputCorFilePath)
                xsDataFileCorr = XSDataFile()
                xsDataFileCorr.setPath(XSDataString(strOutputCorFilePath))
                xsDataResultSPD.setcorrectedFile(xsDataFileCorr)
#        # Create the output data
        xsDataFileCake = XSDataFile()
        xsDataFileCake.setPath(XSDataString(strOutputCakeFilePath))
        xsDataResultSPD.setCakedFile(xsDataFileCake)

        self.setDataOutput(xsDataResultSPD)
Exemplo n.º 10
0
    def postProcess(self, _edObject=None):

        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginSPDCakev1_1.postProcess")


        xsDataInputSPDCake = self.getDataInput()
        strOutputFileType = xsDataInputSPDCake.getOutputFileType().getValue()
        # Determine the image file name without path and suffix
        strInputImageFilePath = xsDataInputSPDCake.getInputFile().getPath().getValue()
        strInputFileNameWithoutSuffix = os.path.splitext(EDUtilsFile.getBaseName(strInputImageFilePath))[0]

        self.strOutputFileSuffix = "data"
        if (strOutputFileType == "PowderCIF"):
            self.strOutputFileSuffix = "cif"
        elif (strOutputFileType == "CHIPLOT"):
            self.strOutputFileSuffix = "chi"

        strOutputFileName = strInputFileNameWithoutSuffix + "." + self.strOutputFileSuffix
        if self.outputDir is None:
            self.m_strOutputFilePath = os.path.join(self.getWorkingDirectory(), strOutputFileName)
        else:
            self.m_strOutputFilePath = os.path.join(self.outputDir, strOutputFileName)
        PyStrCakeFilePrefix = os.path.splitext(os.path.split(strInputImageFilePath)[1])[0]


        ################################################################
        ####  Do some manipulation of the  output image  ##############
        ################################################################
        EDFCakeFile = fabio.open(os.path.join(self.getWorkingDirectory(), PyStrCakeFilePrefix + ".azim.edf"))
        npaData = EDFCakeFile.data
        pydHeader = EDFCakeFile.header

        pyfPixSize = float(pydHeader["PSize_1"].split()[0])
        pyfDist = float(pydHeader["SampleDistance"].split()[0])
        EDVerbose.DEBUG("Calculation done with PixSize=%s, distance= %s" % (pydHeader["PSize_1"], pydHeader["SampleDistance"]))
        pyiNbAzimBin, pyiLength = npaData.shape
        nplInt = npaData.reshape((pyiLength))
        nplTth = numpy.degrees(numpy.arctan(numpy.linspace(0.5 * pyfPixSize / pyfDist, (pyiLength - 0.5) * pyfPixSize / pyfDist  , pyiLength,)))

        #for the description of the +0.5 term, please refer to http://www.esrf.fr/computing/scientific/SAXS/doc/SaxsKeywords/SaxsKeywords.pdf page 23

        ######################################Debugging#######################
        f = open(os.path.join(self.getWorkingDirectory(), "original.dat"), "w")
        for i in range(pyiLength):
            f.write("%f\t%f\n" % (nplTth[i], nplInt[i]))
        f.close()
        ##############################end Debugging############################
        XRPD = lambda tth: numpy.interp(tth, nplTth, nplInt, left=0, right=0)
        pyfTthMin = nplTth[0]
        pyfTthMax = nplTth[-1]
        pyfStep = (pyfTthMax - pyfTthMin) / (pyiLength - 1)
                ########### Remove large files to prevent disk saturation when not in debug mode ###################
        if not EDVerbose.isVerboseDebug():
            os.remove(os.path.join(self.getWorkingDirectory(), PyStrCakeFilePrefix + ".cor.edf"))
            os.remove(os.path.join(self.getWorkingDirectory(), PyStrCakeFilePrefix + ".azim.edf"))



#        # Create the output data
        xsDataResultSPDCake = XSDataResultSPDCake()
        if (self.m_strOutputFilePath is not None):

            if (strOutputFileType == "PowderCIF"):
                    import CIFfile
                    cif = CIFfile.CIF()
                    cif[ "_audit_creation_method"    ] = 'From 2-D detector using SPD and CIFfile'
                    cif[ "_pd_meas_2theta_range_inc" ] = str(pyfStep)
                    cif[ "_pd_meas_2theta_range_max" ] = str(pyfTthMax)
                    cif[ "_pd_meas_2theta_range_min" ] = str(pyfTthMin)
                    cif[ "_pd_meas_number_of_points" ] = str(pyiLength)
                    cif[ "_pd_meas_scan_method"      ] = "fixed"
                    cif[ "_pd_spec_description"      ] = pydHeader["title"]
                    cif["_diffrn_radiation_wavelength"] = str(self.getDataInput().getWavelength().getValue())
                    cif["_pd_instr_dist_spec/detc"] = str(self.getDataInput().getSampleToDetectorDistance().getValue())
                    oneloop = []
                    #range( pyiLength ):
                    for i in numpy.linspace(pyfTthMin, pyfTthMax, pyiLength):
                        oneloop.append({ "_pd_meas_intensity_total" : str(XRPD(i)) })
                    cif["loop_"] = [ [ ["_pd_meas_intensity_total"], oneloop ] ]
                    cif.saveCIF(self.m_strOutputFilePath)

            elif (strOutputFileType == "CHIPLOT"):
                f = open(os.path.join(self.getWorkingDirectory(), self.m_strOutputFilePath), "w")
                f.write(pydHeader["title"] + ": Angular Profile\nTwo-Theta Angle (degrees)\nIntensity (normalised)\n%i\n" % pyiLength)
                for i in numpy.linspace(pyfTthMin, pyfTthMax, pyiLength):
                    f.write("%f\t%f\n" % (i, XRPD(i)))
                f.close()

            xsDataFile = XSDataFile()
            xsDataFile.setPath(XSDataString(self.m_strOutputFilePath))
            xsDataResultSPDCake.setCakedFile(xsDataFile)
        self.setDataOutput(xsDataResultSPDCake)