diff --git a/docs/source/examples/compareC60PDFs.py b/docs/examples/compareC60PDFs.py similarity index 100% rename from docs/source/examples/compareC60PDFs.py rename to docs/examples/compareC60PDFs.py diff --git a/docs/source/examples/compareC60PDFs_objcryst.py b/docs/examples/compareC60PDFs_objcryst.py similarity index 100% rename from docs/source/examples/compareC60PDFs_objcryst.py rename to docs/examples/compareC60PDFs_objcryst.py diff --git a/docs/source/examples/datafiles/C60bucky.stru b/docs/examples/datafiles/C60bucky.stru similarity index 100% rename from docs/source/examples/datafiles/C60bucky.stru rename to docs/examples/datafiles/C60bucky.stru diff --git a/docs/source/examples/datafiles/menthol.cif b/docs/examples/datafiles/menthol.cif similarity index 100% rename from docs/source/examples/datafiles/menthol.cif rename to docs/examples/datafiles/menthol.cif diff --git a/docs/source/examples/datafiles/sphalerite.cif b/docs/examples/datafiles/sphalerite.cif similarity index 100% rename from docs/source/examples/datafiles/sphalerite.cif rename to docs/examples/datafiles/sphalerite.cif diff --git a/docs/source/examples/distanceprinter.py b/docs/examples/distanceprinter.py similarity index 100% rename from docs/source/examples/distanceprinter.py rename to docs/examples/distanceprinter.py diff --git a/docs/source/examples/lennardjones/Makefile b/docs/examples/lennardjones/Makefile similarity index 100% rename from docs/source/examples/lennardjones/Makefile rename to docs/examples/lennardjones/Makefile diff --git a/docs/source/examples/lennardjones/README.txt b/docs/examples/lennardjones/README.txt similarity index 100% rename from docs/source/examples/lennardjones/README.txt rename to docs/examples/lennardjones/README.txt diff --git a/docs/source/examples/lennardjones/lj50.xyz b/docs/examples/lennardjones/lj50.xyz similarity index 100% rename from docs/source/examples/lennardjones/lj50.xyz rename to docs/examples/lennardjones/lj50.xyz diff --git a/docs/source/examples/lennardjones/ljcalculator.cpp b/docs/examples/lennardjones/ljcalculator.cpp similarity index 100% rename from docs/source/examples/lennardjones/ljcalculator.cpp rename to docs/examples/lennardjones/ljcalculator.cpp diff --git a/docs/source/examples/lennardjones/ljcalculator.py b/docs/examples/lennardjones/ljcalculator.py similarity index 100% rename from docs/source/examples/lennardjones/ljcalculator.py rename to docs/examples/lennardjones/ljcalculator.py diff --git a/docs/source/examples/parallelPDF.py b/docs/examples/parallelPDF.py similarity index 100% rename from docs/source/examples/parallelPDF.py rename to docs/examples/parallelPDF.py diff --git a/docs/source/api/diffpy.srreal.example_package.rst b/docs/source/api/diffpy.srreal.example_package.rst deleted file mode 100644 index 439a6b4f..00000000 --- a/docs/source/api/diffpy.srreal.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.srreal.example_package package - -.. automodule:: diffpy.srreal.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.srreal.example_package.foo module - -.. automodule:: diffpy.srreal.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.srreal.example_package.bar module - -.. automodule:: diffpy.srreal.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/api/diffpy.srreal.rst b/docs/source/api/diffpy.srreal.rst index 0f1bb4b7..82b25287 100644 --- a/docs/source/api/diffpy.srreal.rst +++ b/docs/source/api/diffpy.srreal.rst @@ -10,21 +10,142 @@ :undoc-members: :show-inheritance: -Subpackages ------------ - -.. toctree:: - diffpy.srreal.example_package - Submodules ---------- -|module| --------- +diffpy.srreal.atomradiitable module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.atomradiitable + :members: + :undoc-members: + :show-inheritance: + + +diffpy.srreal.attributes module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.attributes + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.bondcalculator module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.bondcalculator + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.bvparameterstable module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.bvparameterstable + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.bvscalculator module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.bvscalculator + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.eventticker module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.eventticker + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.overlapcalculator module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.overlapcalculator + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.overlapcalculator module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.overlapcalculator + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.pairquantity module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.pairquantity + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.parallel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.parallel + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.pdfbaseline module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.pdfbaseline + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.pdfcalculator module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.pdfcalculator + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.pdfenvelope module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.pdfenvelope + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.peakprofile module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.peakprofile + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.peakwidthmodel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.peakwidthmodel + :members: + :undoc-members: + :show-inheritance: + +diffpy.srreal.scatteringfactortable module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.srreal.scatteringfactortable + :members: + :undoc-members: + :show-inheritance: -.. |module| replace:: diffpy.srreal.example_submodule module +diffpy.srreal.sfaverage module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.srreal.example_submodule +.. automodule:: diffpy.srreal.sfaverage :members: :undoc-members: :show-inheritance: diff --git a/docs/source/examples.rst b/docs/source/examples.rst index ef8715f5..79bf30aa 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -1,4 +1,22 @@ -.. _examples: +.. _developers-guide-examples: +=================== Examples -######## +=================== + +.. This creates the links from the filenames within README to pages. +.. _compareC60PDFs_objcryst.py: examples/compareC60PDFs_objcryst.html +.. _compareC60PDFs.py: examples/compareC60PDFs.html +.. _distanceprinter.py: examples/distanceprinter.html +.. _parallelPDF.py: examples/parallelPDF.html + + +Files +----- + +.. toctree:: + + examples/compareC60PDFs_objcryst.rst + examples/compareC60PDFs.rst + examples/distanceprinter.rst + examples/parallelPDF.rst diff --git a/docs/source/examples/compareC60PDFs.rst b/docs/source/examples/compareC60PDFs.rst new file mode 100644 index 00000000..625002c9 --- /dev/null +++ b/docs/source/examples/compareC60PDFs.rst @@ -0,0 +1,7 @@ +.. _compareC60PDFs.rst: + +========================== +compareC60PDFs.py +========================== + +.. literalinclude:: ../../examples/compareC60PDFs.py diff --git a/docs/source/examples/compareC60PDFs_objcryst.rst b/docs/source/examples/compareC60PDFs_objcryst.rst new file mode 100644 index 00000000..44cbf6e8 --- /dev/null +++ b/docs/source/examples/compareC60PDFs_objcryst.rst @@ -0,0 +1,7 @@ +.. _compareC60PDFs_objcryst.py: + +========================== +compareC60PDFs_ObjCryst.py +========================== + +.. literalinclude:: ../../examples/compareC60PDFs_objcryst.py diff --git a/docs/source/examples/distanceprinter.rst b/docs/source/examples/distanceprinter.rst new file mode 100644 index 00000000..04883d1b --- /dev/null +++ b/docs/source/examples/distanceprinter.rst @@ -0,0 +1,7 @@ +.. _distanceprinter.py: + +=========================== +distanceprinter.py +=========================== + +.. literalinclude:: ../../examples/distanceprinter.py diff --git a/docs/source/examples/parallelPDF.rst b/docs/source/examples/parallelPDF.rst new file mode 100644 index 00000000..2263fbe0 --- /dev/null +++ b/docs/source/examples/parallelPDF.rst @@ -0,0 +1,7 @@ +.. _parallelPDF.py: + +=========================== +parallelPDF.py +=========================== + +.. literalinclude:: ../../examples/parallelPDF.py diff --git a/news/fix-docstring.rst b/news/fix-docstring.rst new file mode 100644 index 00000000..5c68390a --- /dev/null +++ b/news/fix-docstring.rst @@ -0,0 +1,23 @@ +**Added:** + +* No news added: Fix documentation rendering. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/diffpy/srreal/atomradiitable.py b/src/diffpy/srreal/atomradiitable.py index 9bcf9bd2..bdc012ca 100644 --- a/src/diffpy/srreal/atomradiitable.py +++ b/src/diffpy/srreal/atomradiitable.py @@ -35,7 +35,10 @@ class CovalentRadiiTable(AtomRadiiTable): def _standardLookup(self, smbl): """Return covalent atom radius in Angstroms. - smbl -- string symbol of an element + Attributes + ---------- + smbl + string symbol of an element Return float. Raise ValueError for unknown element symbol. """ diff --git a/src/diffpy/srreal/bondcalculator.py b/src/diffpy/srreal/bondcalculator.py index 98d2fe89..0fede96e 100644 --- a/src/diffpy/srreal/bondcalculator.py +++ b/src/diffpy/srreal/bondcalculator.py @@ -58,9 +58,13 @@ def _init_kwargs(self, **kwargs): def _call_kwargs(self, structure=None, **kwargs): """Return sorted bond distances in the specified structure. - structure -- structure to be evaluated, an instance of diffpy Structure - or pyobjcryst Crystal. Reuse the last structure when None. - kwargs -- optional parameter settings for this calculator + Attributes + ---------- + structure + structure to be evaluated, an instance of diffpy Structure + or pyobjcryst Crystal. Reuse the last structure when None. + kwargs + optional parameter settings for this calculator Return a sorted numpy array. """ diff --git a/src/diffpy/srreal/bvscalculator.py b/src/diffpy/srreal/bvscalculator.py index 82ff5a3c..855cf874 100644 --- a/src/diffpy/srreal/bvscalculator.py +++ b/src/diffpy/srreal/bvscalculator.py @@ -75,9 +75,13 @@ def _init_kwargs(self, **kwargs): def _call_kwargs(self, structure=None, **kwargs): """Return bond valence sums at each atom site in the structure. - structure -- structure to be evaluated, an instance of diffpy Structure - or pyobjcryst Crystal. Reuse the last structure when None. - kwargs -- optional parameter settings for this calculator + Attributes + ---------- + structure + structure to be evaluated, an instance of diffpy Structure + or pyobjcryst Crystal. Reuse the last structure when None. + kwargs + optional parameter settings for this calculator Return an array of calculated valence sums. See valences for the expected values. diff --git a/src/diffpy/srreal/devutils/tunePeakPrecision.py b/src/diffpy/srreal/devutils/tunePeakPrecision.py index d899ea5c..f9f0683a 100755 --- a/src/diffpy/srreal/devutils/tunePeakPrecision.py +++ b/src/diffpy/srreal/devutils/tunePeakPrecision.py @@ -54,7 +54,10 @@ def Gpdffit2(qmax): """Calculate reference nickel PDF using diffpy.pdffit2. - qmax -- vawevector cutoff value in 1/A + Attributes + ---------- + qmax + vawevector cutoff value in 1/A Return numpy array of (r, g). """ @@ -70,9 +73,13 @@ def Gpdffit2(qmax): def Gsrreal(qmax, peakprecision=None): """Calculate nickel PDF using PDFCalculator from diffpy.srreal. - qmax -- vawevector cutoff value in 1/A - peakprecision -- precision factor affecting peak cutoff, - keep at default value when None. + Attributes + ---------- + qmax + vawevector cutoff value in 1/A + peakprecision + precision factor affecting peak cutoff, + keep at default value when None. Return numpy array of (r, g). """ @@ -91,19 +98,30 @@ def Gsrreal(qmax, peakprecision=None): def comparePDFCalculators(qmax, peakprecision=None): """Compare Ni PDF calculations with pdffit2 and PDFCalculator. - qmax -- vawevector cutoff value in 1/A - peakprecision -- precision factor affecting peak cutoff, - keep at default value when None. + Attributes + ---------- + qmax + vawevector cutoff value in 1/A + peakprecision + precision factor affecting peak cutoff, + keep at default value when None. Return a dictionary of benchmark results with the following keys: - qmax -- vawevector cutoff value - peakprecision -- actual peak precision used in PDFCalculator - r -- common r-grid for the PDF arrays - g0, g1 -- calculated PDF curves from pdffit2 and PDFCalculator - gdiff -- PDF difference equal (g0 - g1) - grmsd -- root mean square value of PDF curves difference - t0, t1 -- CPU times used by pdffit2 and PDFCalculator calls + Attributes + ---------- + qmax + vawevector cutoff value + peakprecision + actual peak precision used in PDFCalculator + r + common r-grid for the PDF arrays + g0, g1 -- calculated PDF curves from pdffit2 and PDFCalculator + gdiff + PDF difference equal (g0 - g1) + grmsd + root mean square value of PDF curves difference + t0, t1 -- CPU times used by pdffit2 and PDFCalculator calls """ rv = {} rv["qmax"] = qmax @@ -147,7 +165,10 @@ def processCommandLineArguments(): def plotComparison(cmpdata): """Plot comparison of PDF curves. - cmpdata -- dictionary returned from comparePDFCalculators + Attributes + ---------- + cmpdata + dictionary returned from comparePDFCalculators No return value. """ diff --git a/src/diffpy/srreal/overlapcalculator.py b/src/diffpy/srreal/overlapcalculator.py index e0fcaa47..6abd4b40 100644 --- a/src/diffpy/srreal/overlapcalculator.py +++ b/src/diffpy/srreal/overlapcalculator.py @@ -66,9 +66,13 @@ def _init_kwargs(self, **kwargs): def _call_kwargs(self, structure=None, **kwargs): """Return siteSquareOverlaps per each site of the structure. - structure -- structure to be evaluated, an instance of diffpy Structure - or pyobjcryst Crystal. Reuse the last structure when None. - kwargs -- optional parameter settings for this calculator + Attributes + ---------- + structure + structure to be evaluated, an instance of diffpy Structure + or pyobjcryst Crystal. Reuse the last structure when None. + kwargs + optional parameter settings for this calculator Return a numpy array. """ diff --git a/src/diffpy/srreal/parallel.py b/src/diffpy/srreal/parallel.py index 179f092b..45aa39c2 100644 --- a/src/diffpy/srreal/parallel.py +++ b/src/diffpy/srreal/parallel.py @@ -31,9 +31,14 @@ def createParallelCalculator(pqobj, ncpu, pmap): """Create a proxy parallel calculator to a PairQuantity instance. - pqobj -- instance of PairQuantity calculator to be run in parallel - ncpu -- number of parallel jobs - pmap -- a parallel map function used to submit job to workers + Attributes + ---------- + pqobj + instance of PairQuantity calculator to be run in parallel + ncpu + number of parallel jobs + pmap + a parallel map function used to submit job to workers The ``pqobj.evaluatortype`` is reset to 'BASIC' because other evaluator types are not supported within parallel calculations. @@ -48,18 +53,28 @@ class to the wrapper PairQuantity type with the same interface. Instance data: - pqobj -- the master PairQuantity object to be evaluated in parallel - ncpu -- number of parallel jobs - pmap -- a parallel map function used to submit job to workers + Attributes + ---------- + pqobj + the master PairQuantity object to be evaluated in parallel + ncpu + number of parallel jobs + pmap + a parallel map function used to submit job to workers """ def __init__(self, pqobj, ncpu, pmap): """Initialize a parallel proxy to the PairQuantity instance. - pqobj -- instance of PairQuantity calculator to be run - in parallel - ncpu -- number of parallel jobs - pmap -- a parallel map function used to submit job to workers + Attributes + ---------- + pqobj + instance of PairQuantity calculator to be run + in parallel + ncpu + number of parallel jobs + pmap + a parallel map function used to submit job to workers """ # use explicit assignment to avoid setattr forwarding to the pqobj object.__setattr__(self, "pqobj", pqobj) @@ -73,9 +88,12 @@ def eval(self, stru=None): """Perform parallel calculation and return internal value array. - stru -- object that can be converted to StructureAdapter, - e.g., example diffpy Structure or pyobjcryst Crystal. - Use the last structure when None. + Attributes + ---------- + stru + object that can be converted to StructureAdapter, + e.g., example diffpy Structure or pyobjcryst Crystal. + Use the last structure when None. Return numpy array. """ diff --git a/src/diffpy/srreal/pdfbaseline.py b/src/diffpy/srreal/pdfbaseline.py index bb168467..d3d2e56e 100644 --- a/src/diffpy/srreal/pdfbaseline.py +++ b/src/diffpy/srreal/pdfbaseline.py @@ -52,21 +52,27 @@ def makePDFBaseline(name, fnc, replace=False, **dbattrs): This is required for using Python function as PDFCalculator.baseline. - name -- unique string name for registering Python function in the - global registry of PDFBaseline types. This will be the - string identifier for the createByType factory. - fnc -- Python function of a floating point argument and optional - float parameters. The parameters need to be registered as - double attributes in the functor class. The function fnc - must be picklable and it must return a float. - replace -- when set replace any PDFBaseline type already registered - under the name. Otherwise raise RuntimeError when the - name is taken. - dbattrs -- optional float parameters of the wrapped function. - These will be registered as double attributes in the - functor class. The wrapped function must be callable as - fnc(x, **dbattrs). Make sure to pick attribute names that - do not conflict with other PDFCalculator attributes. + Attributes + ---------- + name + unique string name for registering Python function in the + global registry of PDFBaseline types. This will be the + string identifier for the createByType factory. + fnc + Python function of a floating point argument and optional + float parameters. The parameters need to be registered as + double attributes in the functor class. The function fnc + must be picklable and it must return a float. + replace + when set replace any PDFBaseline type already registered + under the name. Otherwise raise RuntimeError when the + name is taken. + dbattrs + optional float parameters of the wrapped function. + These will be registered as double attributes in the + functor class. The wrapped function must be callable as + 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. diff --git a/src/diffpy/srreal/pdfcalculator.py b/src/diffpy/srreal/pdfcalculator.py index 0e7524b7..d4f1c1fb 100644 --- a/src/diffpy/srreal/pdfcalculator.py +++ b/src/diffpy/srreal/pdfcalculator.py @@ -167,9 +167,13 @@ def _call_kwargs(self, structure=None, **kwargs): attributes, these override any properties that may be passed from the structure, such as spdiameter. - structure -- a structure object to be evaluated. Reuse the last - structure when None. - kwargs -- optional parameter settings for this calculator + Attributes + ---------- + structure + a structure object to be evaluated. Reuse the last + structure when None. + kwargs + optional parameter settings for this calculator Example: pdfcalc(structure, qmax=20, spdiameter=15) diff --git a/src/diffpy/srreal/pdfenvelope.py b/src/diffpy/srreal/pdfenvelope.py index c7395175..a8f68a48 100644 --- a/src/diffpy/srreal/pdfenvelope.py +++ b/src/diffpy/srreal/pdfenvelope.py @@ -81,21 +81,27 @@ def makePDFEnvelope(name, fnc, replace=False, **dbattrs): This is required for using Python function as PDFCalculator envelope. - name -- unique string name for registering Python function in the - global registry of PDFEnvelope types. This will be the - string identifier for the createByType factory. - fnc -- Python function of a floating point argument and optional - float parameters. The parameters need to be registered as - double attributes in the functor class. The function fnc - must be picklable and it must return a float. - replace -- when set replace any PDFEnvelope type already registered - under the name. Otherwise raise RuntimeError when the - name is taken. - dbattrs -- optional float parameters of the wrapped function. - These will be registered as double attributes in the - functor class. The wrapped function must be callable as - fnc(x, **dbattrs). Make sure to pick attribute names that - do not conflict with other PDFCalculator attributes. + Attributes + ---------- + name + unique string name for registering Python function in the + global registry of PDFEnvelope types. This will be the + string identifier for the createByType factory. + fnc + Python function of a floating point argument and optional + float parameters. The parameters need to be registered as + double attributes in the functor class. The function fnc + must be picklable and it must return a float. + replace + when set replace any PDFEnvelope type already registered + under the name. Otherwise raise RuntimeError when the + name is taken. + dbattrs + optional float parameters of the wrapped function. + These will be registered as double attributes in the + functor class. The wrapped function must be callable as + fnc(x, **dbattrs). Make sure to pick attribute names that + do not conflict with other PDFCalculator attributes. Return an instance of the new PDFEnvelope class. diff --git a/src/diffpy/srreal/structureadapter.py b/src/diffpy/srreal/structureadapter.py index a878ab97..3f6b8aa9 100644 --- a/src/diffpy/srreal/structureadapter.py +++ b/src/diffpy/srreal/structureadapter.py @@ -48,9 +48,12 @@ def createStructureAdapter(stru): """Create StructureAdapter from a Python object. - stru -- an object that is convertible to StructureAdapter, i.e., it has - a registered factory that converts Python structure object to - StructureAdapter. Return stru if already a StructureAdapter. + Attributes + ---------- + stru + an object that is convertible to StructureAdapter, i.e., it has + a registered factory that converts Python structure object to + StructureAdapter. Return stru if already a StructureAdapter. Return a StructureAdapter instance. Raise TypeError if stru cannot be converted to StructureAdapter. @@ -79,11 +82,15 @@ def RegisterStructureAdapter(fqname, fnc=None): with calculators in diffpy.srreal as they would be implicitly converted to the internal diffpy.srreal structure type. - fqname -- fully qualified class name for the convertible objects. - This is the quoted string included in "str(type(obj))". - The converter function would be called for object of the - same or derived types. - fnc -- function that converts the fqname type to StructureAdapter. + Attributes + ---------- + fqname + fully qualified class name for the convertible objects. + This is the quoted string included in "str(type(obj))". + The converter function would be called for object of the + same or derived types. + fnc + function that converts the fqname type to StructureAdapter. Note: When fnc is None RegisterStructureAdapter works as a decorator and the conversion function can be specified below, i.e., diff --git a/src/diffpy/srreal/structureconverters.py b/src/diffpy/srreal/structureconverters.py index 5f9f6cb5..67883f79 100644 --- a/src/diffpy/srreal/structureconverters.py +++ b/src/diffpy/srreal/structureconverters.py @@ -40,7 +40,7 @@ @RegisterStructureAdapter("diffpy.Structure.structure.Structure") @RegisterStructureAdapter("diffpy.structure.structure.Structure") def convertDiffPyStructure(stru): - "Adapt Structure class from diffpy.structure package." + """Adapt Structure class from diffpy.structure package.""" haslattice = (1, 1, 1, 90, 90, 90) != stru.lattice.abcABG() isperiodic = haslattice hasmeta = _DiffPyStructureMetadata.hasMetadata(stru) @@ -63,7 +63,8 @@ def convertDiffPyStructure(stru): class _DiffPyStructureMetadata(object): - "Base class for handling metadata information in the pdffit attribute." + """Base class for handling metadata information in the pdffit + attribute.""" pdffit = None @@ -107,7 +108,10 @@ def _fetchMetadata(self, stru): """Copy data from the pdffit attribute of diffpy Structure object. - stru -- instance of Structure class from diffpy.structure + Attributes + ---------- + stru + instance of Structure class from diffpy.structure No return value. """ @@ -137,8 +141,12 @@ class DiffPyStructurePeriodicAdapter( def _fetchDiffPyStructureData(adpt, stru): """Copy structure data from diffpy Structure object to this Adapter. - adpt -- instance of AtomicStructureAdapter or PeriodicStructureAdapter - stru -- instance of Structure class from diffpy.structure + Attributes + ---------- + adpt + instance of AtomicStructureAdapter or PeriodicStructureAdapter + stru + instance of Structure class from diffpy.structure No return value. """ diff --git a/src/diffpy/srreal/wraputils.py b/src/diffpy/srreal/wraputils.py index 46322152..b3a5ee6f 100644 --- a/src/diffpy/srreal/wraputils.py +++ b/src/diffpy/srreal/wraputils.py @@ -24,8 +24,12 @@ def propertyFromExtDoubleAttr(attrname, doc): """Create property wrapper to a DoubleAttr in C++ extension object. - attrname -- string name of the double attribute - doc -- docstring for the Python class property + Attributes + ---------- + attrname + string name of the double attribute + doc + docstring for the Python class property Return a property object. """ @@ -46,7 +50,10 @@ def setattrFromKeywordArguments(obj, **kwargs): For example: setattrFromKeywordArguments(obj, qmax=24, scale=2) This is a shared helper function used by __init__ and __call__. - kwargs -- one or more keyword arguments + Attributes + ---------- + kwargs + one or more keyword arguments No return value. Raise TypeError for invalid keyword argument. @@ -67,21 +74,28 @@ def _wrapAsRegisteredUnaryFunction( PDFEnvelope functor. Not intended for direct usage, this function is rather called from makePDFBaseline or makePDFEnvelope wrappers. - cls -- the functor class for wrapping the Python function - regname -- string name for registering the function in the global - registry of cls functors. This will be the string - identifier for the createByType factory. - fnc -- Python function of a floating point argument and optional - float parameters. The parameters need to be registered as - dbattrs in the functor class. The function fnc - must be picklable and it must return a float. - replace -- when set replace any functor already registered under - the regname. Otherwise raise RuntimeError when regname - is taken. - dbattrs -- optional float parameters of the wrapped function. - These will be registered as double attributes in the - functor class. The wrapped function must be callable as - fnc(x, **dbattrs). + Attributes + ---------- + cls + the functor class for wrapping the Python function + regname + string name for registering the function in the global + registry of cls functors. This will be the string + identifier for the createByType factory. + fnc + Python function of a floating point argument and optional + float parameters. The parameters need to be registered as + dbattrs in the functor class. The function fnc + must be picklable and it must return a float. + replace + when set replace any functor already registered under + the regname. Otherwise raise RuntimeError when regname + is taken. + dbattrs + optional float parameters of the wrapped function. + These will be registered as double attributes in the + functor class. The wrapped function must be callable as + fnc(x, **dbattrs). Return an instance of the functor class. """