Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE_DANSE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ the City of New York. All rights reserved.

For more information please visit the diffpy web-page at
http://www.diffpy.org
or email Prof. Simon Billinge at sb2896@columbia.edu.
or email Prof. Simon Billinge at sbillinge@ucsb.edu.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/coreshellnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def makeRecipe(stru1, stru2, datname):
# The generator for the CdS core. We call it "G_CdS" and will use this name
# later when we set the fitting equation in the FitContribution.
generator_cds = PDFGenerator("G_CdS")
generator_cds.setStructure(stru1)
generator_cds.setQmax(26)
generator_cds.set_structure(stru1)
generator_cds.set_qmax(26)
generator_cds.qdamp.value = 0.0396
# The generator for the ZnS shell. We call it "G_ZnS".
generator_zns = PDFGenerator("G_ZnS")
generator_zns.setStructure(stru2)
generator_zns.setQmax(26)
generator_zns.set_structure(stru2)
generator_zns.set_qmax(26)
generator_zns.qdamp.value = 0.0396

# The FitContribution
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/crystalpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def makeRecipe(ciffile, datname):
# The ProfileGenerator
# The PDFGenerator is for configuring and calculating a PDF profile. Here,
# we want to refine a Structure object from diffpy.structure. We tell the
# PDFGenerator that with the 'setStructure' method. All other configuration
# options will be inferred from the metadata that is read by the
# PDFParser.
# PDFGenerator that with the 'set_structure' method. All other
# configuration options will be inferred from the metadata that is read by
# the PDFParser.
# In particular, this will set the scattering type (x-ray or neutron), the
# Qmax value, as well as initial values for the non-structural Parameters.
generator = PDFGenerator("G")
stru = Structure()
stru.read(str(ciffile))
generator.setStructure(stru)
generator.set_structure(stru)

# The FitContribution
# Here we associate the Profile and ProfileGenerator, as has been done
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/crystalpdfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ def makeRecipe(
# We create one for each phase and share the phases.
xgenerator_ni = PDFGenerator("xG_ni")
stru = create_crystal_from_cif(str(ciffile_ni))
xgenerator_ni.setStructure(stru)
xgenerator_ni.set_structure(stru)
phase_ni = xgenerator_ni.phase

xgenerator_si = PDFGenerator("xG_si")
stru = create_crystal_from_cif(str(ciffile_si))
xgenerator_si.setStructure(stru)
xgenerator_si.set_structure(stru)
phase_si = xgenerator_si.phase

ngenerator_ni = PDFGenerator("nG_ni")
ngenerator_ni.setPhase(phase_ni)
ngenerator_ni.set_structure_from_parset(phase_ni)

xgenerator_sini_ni = PDFGenerator("xG_sini_ni")
xgenerator_sini_ni.setPhase(phase_ni)
xgenerator_sini_ni.set_structure_from_parset(phase_ni)

xgenerator_sini_si = PDFGenerator("xG_sini_si")
xgenerator_sini_si.setPhase(phase_si)
xgenerator_sini_si.set_structure_from_parset(phase_si)

# The FitContributions
# We one of these for each data set.
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/crystalpdfobjcryst.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def makeRecipe(ciffile, datname):
# the previous example.
generator = PDFGenerator("G")
stru = create_crystal_from_cif(str(ciffile))
generator.setStructure(stru)
generator.setQmax(40.0)
generator.set_structure(stru)
generator.set_qmax(40.0)

# The FitContribution
contribution = FitContribution("nickel")
Expand All @@ -73,7 +73,7 @@ def makeRecipe(ciffile, datname):

# As before, we get a handle to the structure parameter set. In this case,
# it is a ObjCrystCrystalParSet instance that was created when we called
# 'setStructure' above. The ObjCrystCrystalParSet has different Parameters
# 'set_structure' above. The ObjCrystCrystalParSet has different Parameters
# and options than the DiffpyStructureParSet used in the last example. See
# its documentation in diffpy.srfit.structure.objcrystparset.
phase = generator.phase
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/crystalpdftwodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def makeRecipe(ciffile, xdatname, ndatname):
# We need one of these for the x-ray data.
xgenerator = PDFGenerator("G")
stru = create_crystal_from_cif(str(ciffile))
xgenerator.setStructure(stru)
xgenerator.set_structure(stru)

# And we need one for the neutron data. We want to refine the same
# structure object in each PDFGenerator. This would suggest that we add the
Expand All @@ -79,7 +79,7 @@ def makeRecipe(ciffile, xdatname, ndatname):
# Tell the neutron PDFGenerator to use the phase from the x-ray
# PDFGenerator.
ngenerator = PDFGenerator("G")
ngenerator.setPhase(xgenerator.phase)
ngenerator.set_structure_from_parset(xgenerator.phase)

# The FitContributions
# We associate the x-ray PDFGenerator and Profile in one FitContribution...
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/crystalpdftwophase.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def makeRecipe(niciffile, siciffile, datname):
# name later when we set the fitting equation in the FitContribution.
generator_ni = PDFGenerator("G_ni")
stru = create_crystal_from_cif(str(niciffile))
generator_ni.setStructure(stru)
generator_ni.set_structure(stru)
# The generator for the silicon phase. We call it "G_si".
generator_si = PDFGenerator("G_si")
stru = create_crystal_from_cif(str(siciffile))
generator_si.setStructure(stru)
generator_si.set_structure(stru)

# The FitContribution
# Add both generators to the FitContribution. Add the Profile. This will
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/nppdfcrystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def makeRecipe(ciffile, grdata):
pdfcontribution.set_profile(pdfprofile, xname="r")

pdfgenerator = PDFGenerator("G")
pdfgenerator.setQmax(30.0)
pdfgenerator.set_qmax(30.0)
stru = create_crystal_from_cif(str(ciffile))
pdfgenerator.setStructure(stru)
pdfgenerator.set_structure(stru)
pdfcontribution.add_profile_generator(pdfgenerator)

# Register the nanoparticle shape factor.
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/nppdfobjcryst.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def makeRecipe(molecule, datname):
# The ProfileGenerator
# Create a DebyePDFGenerator named "G".
generator = DebyePDFGenerator("G")
generator.setStructure(molecule)
generator.set_structure(molecule)
# These are metadata needed by the generator
generator.setQmin(0.68)
generator.setQmax(22)
generator.set_qmin(0.68)
generator.set_qmax(22)

# The FitContribution
contribution = FitContribution("bucky")
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/nppdfsas.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def makeRecipe(ciffile, grdata, iqdata):
pdfcontribution.set_profile(pdfprofile, xname="r")

pdfgenerator = PDFGenerator("G")
pdfgenerator.setQmax(30.0)
pdfgenerator.set_qmax(30.0)
stru = create_crystal_from_cif(str(ciffile))
pdfgenerator.setStructure(stru)
pdfgenerator.set_structure(stru)
pdfcontribution.add_profile_generator(pdfgenerator)
pdfcontribution.set_residual_equation("resv")

Expand Down
7 changes: 4 additions & 3 deletions docs/examples/parallel_refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ def make_recipe(ciffile, datname):
# The ProfileGenerator
# The PDFGenerator is for configuring and calculating a PDF profile. Here,
# we want to refine a Structure object from diffpy.structure. We tell the
# PDFGenerator that with the 'setStructure' method. All other configuration
# options will be inferred from the metadata that is read by the PDFParser.
# PDFGenerator that with the 'set_structure' method. All other
# configuration options will be inferred from the metadata that is read by
# the PDFParser.
# In particular, this will set the scattering type (x-ray or neutron), the
# Qmax value, as well as initial values for the non-structural Parameters.
generator = PDFGenerator("G")
stru = Structure()
stru.read(ciffile)
generator.setStructure(stru)
generator.set_structure(stru)

# The FitContribution
# Here we associate the Profile and ProfileGenerator, as has been done
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/simplepdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def makeRecipe(ciffile, datname):
"""Create a fitting recipe for crystalline PDF data."""
# Work directly with a custom PDFContribution to load the data
contribution = PDFContribution("nickel")
contribution.loadData(datname)
contribution.load_data(datname)
contribution.set_calculation_range(xmin=1, xmax=20, dx=0.1)

# and the phase
stru = Structure()
stru.read(str(ciffile))
contribution.addStructure("nickel", stru)
contribution.add_structure(stru, "nickel")

# Make the FitRecipe and add the FitContribution.
recipe = FitRecipe()
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/simplepdftwophase.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def makeRecipe(niciffile, siciffile, datname):
"""Create a fitting recipe for crystalline PDF data."""
# Load data and add it to the profile
contribution = PDFContribution("nisi")
contribution.loadData(datname)
contribution.load_data(datname)
contribution.set_calculation_range(xmax=20)

stru = create_crystal_from_cif(str(niciffile))
contribution.addStructure("ni", stru)
contribution.add_structure(stru, "ni")

stru = create_crystal_from_cif(str(siciffile))
contribution.addStructure("si", stru)
contribution.add_structure(stru, "si")

# Make the FitRecipe and add the FitContribution.
recipe = FitRecipe()
Expand All @@ -62,7 +62,7 @@ def makeRecipe(niciffile, siciffile, datname):
#
# First the nickel parameters.
# Note that ni is the name of the PDFGenerator that was automatically
# created by the PDFContribution. We selected this name in addStructure
# created by the PDFContribution. We selected this name in add_structure
# above.
phase_ni = contribution.ni.phase
for par in phase_ni.sgpars:
Expand Down
4 changes: 4 additions & 0 deletions docs/source/api/diffpy.srfit.pdf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
diffpy.srfit.pdf package
========================

.. deprecated:: 3.5.0
``diffpy.srfit.pdf`` has moved to ``diffpy.cmipdf`` and will be removed
in version 4.0.0. Please use ``diffpy.cmipdf`` instead.

.. automodule:: diffpy.srfit.pdf
:members:
:undoc-members:
Expand Down
24 changes: 24 additions & 0 deletions news/pdf-dep.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* ``set_qmax``, ``get_qmax``, ``set_qmin``, ``get_qmin``, ``set_scattering_type``, ``get_scattering_type``, ``set_structure`` and ``set_structure_from_parset`` to the PDF generators, and ``load_data``, ``set_calculation_range``, ``add_structure``, ``add_structure_from_parset``, ``set_qmax``, ``get_qmax``, ``set_qmin``, ``get_qmin``, ``set_scattering_type`` and ``get_scattering_type`` to ``PDFContribution``, which take the names they have in ``diffpy.cmipdf``.

**Changed:**

* The deprecation messages of the camelCase characteristic functions (``sphericalCF``, ``shellCF`` and the others) now point to ``diffpy.cmipdf.characteristicfunctions`` instead of ``diffpy.srfit.pdf.characteristicfunctions``. ``lognormalSphericalCF`` now points to ``lognormal_spherical_distribution``, and ``shellCF`` and ``shellCF2`` now point to ``spherical_shell``.

**Deprecated:**

* ``diffpy.srfit.pdf``, which moved to ``diffpy.cmipdf``. Importing it now raises a ``DeprecationWarning``.
* The camelCase methods of the PDF generators and ``PDFContribution`` (``setQmax``, ``getQmax``, ``setQmin``, ``getQmin``, ``setScatteringType``, ``getScatteringType``, ``setStructure``, ``setPhase``, ``loadData``, ``setCalculationRange``, ``addStructure`` and ``addPhase``). Please use their snake_case names in ``diffpy.cmipdf`` instead. ``setPhase`` and ``addPhase`` are now ``set_structure_from_parset`` and ``add_structure_from_parset``, and ``add_structure`` and ``add_structure_from_parset`` take the structure or parset before the name.

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
17 changes: 17 additions & 0 deletions src/diffpy/srfit/pdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,26 @@

__all__ = ["PDFGenerator", "DebyePDFGenerator", "PDFContribution", "PDFParser"]

import warnings

from diffpy.srfit.pdf.debyepdfgenerator import DebyePDFGenerator
from diffpy.srfit.pdf.pdfcontribution import PDFContribution
from diffpy.srfit.pdf.pdfgenerator import PDFGenerator
from diffpy.srfit.pdf.pdfparser import PDFParser
from diffpy.utils._deprecator import build_deprecation_message

removal_version = "4.0.0"

warnings.warn(
build_deprecation_message(
"diffpy.srfit",
"pdf",
"cmipdf",
removal_version,
new_base="diffpy",
),
DeprecationWarning,
stacklevel=2,
)

# End of file
Loading
Loading