コード例 #1
0
                fnc(x, **dbattrs).  Make sure to pick attribute names that
                do not conflict with other PDFCalculator attributes.

    Return an instance of the new PDFBaseline class.

    Example:

        # Python baseline function
        def fshiftedline(x, aline, bline):
            return aline * x + bline
        # wrap it as a PDFBaseline and register as a "shiftedline" type
        makePDFBaseline("shiftedline", fshiftedline, aline=-1, bline=0)
        baseline = PDFBaseline.createByType("shiftedline")
        print map(baseline, range(5))
        # use it in PDFCalculator
        pdfc = PDFCalculator()
        pdfc.baseline = baseline
        # or pdfc.baseline = "shiftedline"
    '''
    from diffpy.srreal.wraputils import _wrapAsRegisteredUnaryFunction
    rv = _wrapAsRegisteredUnaryFunction(PDFBaseline, name, fnc,
                                        replace=replace, **dbattrs)
    return rv

# Import delayed tweaks of the extension classes.

_final_imports.import_now()
del _final_imports

# End of file
コード例 #2
0
PeakWidthModel.__getstate__ = _pickle_getstate
PeakWidthModel.__setstate__ = _pickle_setstate

# Derived C++ classes are pickled without dictionary

ConstantPeakWidth.__reduce__ = _peakwidthmodel_reduce
DebyeWallerPeakWidth.__reduce__ = _peakwidthmodel_reduce
JeongPeakWidth.__reduce__ = _peakwidthmodel_reduce

# add attribute wrappers for the derived classes

ConstantPeakWidth.width = propertyFromExtDoubleAttr(
    'width', '''Constant FWHM value returned by this model.
    ''')

JeongPeakWidth.delta1 = propertyFromExtDoubleAttr(
    'delta1', 'Coefficient for (1/r) contribution to the peak sharpening.')

JeongPeakWidth.delta2 = propertyFromExtDoubleAttr(
    'delta2', 'Coefficient for (1/r**2) contribution to the peak sharpening.')

JeongPeakWidth.qbroad = propertyFromExtDoubleAttr(
    'qbroad', 'PDF peak broadening from increased intensity noise at high Q.')

# Import delayed tweaks of the extension classes.

_final_imports.import_now()
del _final_imports

# End of file