Exemplo n.º 1
0
    def addPhase(self, name, parset, periodic=True):
        """Add a phase that goes into the PDF calculation.

        name    --  A name to give the generator that will manage the PDF
                    calculation from the passed parameter phase. The parset
                    will be accessible via the name "phase" as an attribute
                    of the generator, e.g., contribution.name.phase, where
                    'contribution' is this contribution and 'name' is passed
                    name.
        parset  --  A SrRealParSet that holds the structural information.
                    This can be used to share the phase between multiple
                    BasePDFGenerators, and have the changes in one reflect in
                    another.
        periodic -- The structure should be treated as periodic.  If this is
                    True (default), then a PDFGenerator will be used to
                    calculate the PDF from the phase. Otherwise, a
                    DebyePDFGenerator will be used. Note that some structures
                    do not support periodicity, in which case this may be
                    ignored.

        Returns the new phase (ParameterSet appropriate for what was passed in
        stru.)

        """
        # Based on periodic, create the proper generator.
        if periodic:
            from diffpy.srfit.pdf.pdfgenerator import PDFGenerator
            gen = PDFGenerator(name)
        else:
            from diffpy.srfit.pdf.debyepdfgenerator import DebyePDFGenerator
            gen = DebyePDFGenerator(name)

        # Set up the generator
        gen.setPhase(parset, periodic)
        self._setupGenerator(gen)

        return gen.phase
Exemplo n.º 2
0
    def addPhase(self, name, parset, periodic = True):
        """Add a phase that goes into the PDF calculation.

        name    --  A name to give the generator that will manage the PDF
                    calculation from the passed parameter phase. The parset
                    will be accessible via the name "phase" as an attribute
                    of the generator, e.g., contribution.name.phase, where
                    'contribution' is this contribution and 'name' is passed
                    name.
        parset  --  A SrRealParSet that holds the structural information.
                    This can be used to share the phase between multiple
                    BasePDFGenerators, and have the changes in one reflect in
                    another. 
        periodic -- The structure should be treated as periodic.  If this is
                    True (default), then a PDFGenerator will be used to
                    calculate the PDF from the phase. Otherwise, a
                    DebyePDFGenerator will be used. Note that some structures
                    do not support periodicity, in which case this may be
                    ignored.

        Returns the new phase (ParameterSet appropriate for what was passed in
        stru.)

        """
        # Based on periodic, create the proper generator.
        if periodic:
            from diffpy.srfit.pdf.pdfgenerator import PDFGenerator
            gen = PDFGenerator(name)
        else:
            from diffpy.srfit.pdf.debyepdfgenerator import DebyePDFGenerator
            gen = DebyePDFGenerator(name)

        # Set up the generator
        gen.setPhase(parset, periodic)
        self._setupGenerator(gen)

        return gen.phase
Exemplo n.º 3
0
    def addStructure(self, name, stru, periodic=True):
        """Add a phase that goes into the PDF calculation.

        name    --  A name to give the generator that will manage the PDF
                    calculation from the passed structure. The adapted
                    structure will be accessible via the name "phase" as an
                    attribute of the generator, e.g.
                    contribution.name.phase, where 'contribution' is this
                    contribution and 'name' is passed name.
                    (default), then the name will be set as "phase".
        stru    --  diffpy.Structure.Structure, pyobjcryst.crystal.Crystal or
                    pyobjcryst.molecule.Molecule instance.  Default None.
        periodic -- The structure should be treated as periodic.  If this is
                    True (default), then a PDFGenerator will be used to
                    calculate the PDF from the phase. Otherwise, a
                    DebyePDFGenerator will be used. Note that some structures
                    do not support periodicity, in which case this may be
                    ignored.

        Returns the new phase (ParameterSet appropriate for what was passed in
        stru.)

        """
        # Based on periodic, create the proper generator.
        if periodic:
            from diffpy.srfit.pdf.pdfgenerator import PDFGenerator
            gen = PDFGenerator(name)
        else:
            from diffpy.srfit.pdf.debyepdfgenerator import DebyePDFGenerator
            gen = DebyePDFGenerator(name)

        # Set up the generator
        gen.setStructure(stru, "phase", periodic)
        self._setupGenerator(gen)

        return gen.phase
Exemplo n.º 4
0
    def addStructure(self, name, stru, periodic = True):
        """Add a phase that goes into the PDF calculation.

        name    --  A name to give the generator that will manage the PDF
                    calculation from the passed structure. The adapted
                    structure will be accessible via the name "phase" as an
                    attribute of the generator, e.g.
                    contribution.name.phase, where 'contribution' is this
                    contribution and 'name' is passed name.
                    (default), then the name will be set as "phase".
        stru    --  diffpy.Structure.Structure, pyobjcryst.crystal.Crystal or
                    pyobjcryst.molecule.Molecule instance . Default None.
        periodic -- The structure should be treated as periodic.  If this is
                    True (default), then a PDFGenerator will be used to
                    calculate the PDF from the phase. Otherwise, a
                    DebyePDFGenerator will be used. Note that some structures
                    do not support periodicity, in which case this may be
                    ignored.

        Returns the new phase (ParameterSet appropriate for what was passed in
        stru.)

        """
        # Based on periodic, create the proper generator.
        if periodic:
            from diffpy.srfit.pdf.pdfgenerator import PDFGenerator
            gen = PDFGenerator(name)
        else:
            from diffpy.srfit.pdf.debyepdfgenerator import DebyePDFGenerator
            gen = DebyePDFGenerator(name)

        # Set up the generator
        gen.setStructure(stru, "phase", periodic)
        self._setupGenerator(gen)

        return gen.phase