Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f353243
replace SCon with modern build tools, rewrite ...
Tieqiong Dec 28, 2024
6198d35
black autofix
Tieqiong Dec 28, 2024
8fac115
Merge pull request #36 from Tieqiong/setup
sbillinge Dec 28, 2024
d52d0a4
Merge pull request #37 from Tieqiong/black
sbillinge Dec 30, 2024
5df5dfb
add precommit and fix related checks
Tieqiong Jan 1, 2025
9219061
Merge pull request #38 from Tieqiong/precommit
sbillinge Jan 1, 2025
d14bb52
add PR test workflow and issue templates
Tieqiong Jan 1, 2025
c0fd7d6
pcmt
Tieqiong Jan 1, 2025
1bd4447
add cookie
Tieqiong Jan 2, 2025
4bf46d2
Merge pull request #39 from Tieqiong/workflow
sbillinge Jan 2, 2025
ea77121
move tests
Tieqiong Jan 11, 2025
abc8a9c
remove unnecessary files, add conftest
Tieqiong Jan 11, 2025
f01987a
easy tests
Tieqiong Jan 11, 2025
70e88e4
fix pytest
Tieqiong Jan 11, 2025
d0a96e8
help py3.11 find boost
Tieqiong Jan 11, 2025
8815174
add dependencies
Tieqiong Jan 11, 2025
95f2ef1
update CI
Tieqiong Jan 11, 2025
59f9471
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jan 11, 2025
0ce4864
pcmt
Tieqiong Jan 11, 2025
81b3c03
git, codecov, cfgs, news dir, MANIFEST
Tieqiong Jan 11, 2025
4a8000a
AUTHORS, CHANGELOG, COC, LICENSEs, README
Tieqiong Jan 11, 2025
74ccfe1
gh workflows, conda-recipe, devutils
Tieqiong Jan 11, 2025
39eeb08
doc
Tieqiong Jan 11, 2025
b05530c
src
Tieqiong Jan 11, 2025
d2354a4
pyproject.toml
Tieqiong Jan 11, 2025
178507a
pcmt
Tieqiong Jan 11, 2025
5f34e62
Merge pull request #46 from Tieqiong/test
sbillinge Jan 11, 2025
cb402f9
Merge pull request #44 from Tieqiong/setup
sbillinge Jan 11, 2025
3ce7204
Merge pull request #45 from Tieqiong/deps
sbillinge Jan 11, 2025
fdceb92
Merge pull request #47 from Tieqiong/cookie
sbillinge Jan 11, 2025
50e6e81
srreal windows support
Tieqiong Feb 2, 2025
b83ee8f
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Feb 2, 2025
b075de8
Merge pull request #53 from Tieqiong/win
sbillinge Feb 2, 2025
d863058
skpkg: pc autofixes with updated config files
cadenmyers13 Jun 18, 2025
7a64d9d
chore: news
cadenmyers13 Jun 18, 2025
2ef09a4
chore: change to run on macos instead of ubuntu
cadenmyers13 Jun 18, 2025
a1420e4
Merge pull request #55 from cadenmyers13/pre-commit-auto
sbillinge Jun 20, 2025
2c7bf1f
find objcryst
Tieqiong Jun 20, 2025
99cd3d3
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jun 20, 2025
12481e9
update conda requirements, correct objcryst flag
Tieqiong Jun 22, 2025
cabdcc7
force libdiffpy rc version
Tieqiong Jun 22, 2025
fa597f8
update tests
Tieqiong Jun 22, 2025
170f9c9
try removing extra insurance
Tieqiong Jun 22, 2025
a86ab58
make MSVC linker happy
Tieqiong Jun 22, 2025
2202fb8
Merge pull request #56 from Tieqiong/setup
sbillinge Jun 22, 2025
d3ecb25
skpkg: change black line length requirements to 79
cadenmyers13 Jun 23, 2025
703588b
skpkg: autofixes with linelength 79
cadenmyers13 Jun 23, 2025
d0f61e8
chore: news
cadenmyers13 Jun 23, 2025
412bbf5
skpkg: flake8 fixes in setup.py
cadenmyers13 Jun 23, 2025
e392485
skpkg: doc formatting autofixes
cadenmyers13 Jun 23, 2025
9b9f2a3
skpkg: add docformatting config to pyproject.toml
cadenmyers13 Jun 23, 2025
4f3d0df
Merge pull request #57 from cadenmyers13/pc-blackv2
sbillinge Jun 24, 2025
c1003ac
skpkg: gitignore, code of conduct updates, rm env.yml and prettierignore
cadenmyers13 Jun 24, 2025
6300597
skpkg: ignore_words.txt and pyproject.toml
cadenmyers13 Jun 24, 2025
462a18c
skpkg: github workflows dir
cadenmyers13 Jun 24, 2025
b24e60a
skpkg: change log header
cadenmyers13 Jun 24, 2025
b84b8d8
skpkg: readme
cadenmyers13 Jun 24, 2025
7410460
skpkg: user facing files and requirements
cadenmyers13 Jun 24, 2025
e2e5e0d
chore: news
cadenmyers13 Jun 24, 2025
830af7d
chore: add diffpy user group to readme
cadenmyers13 Jun 24, 2025
f2e0ddc
chore: more diffpy user group in readme
cadenmyers13 Jun 24, 2025
ad73cb4
chore: fix typo
cadenmyers13 Jun 24, 2025
ea1c888
chore: revert tests-on-pr.yml back to original
cadenmyers13 Jun 24, 2025
ac8a64d
chore: add blank lines
cadenmyers13 Jun 24, 2025
62b83e5
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jun 24, 2025
1488319
ci: configure tests-on-pr.yml to run without environment.yml
cadenmyers13 Jun 25, 2025
e4a2700
skpkg: remove getting-started.rst
cadenmyers13 Jun 25, 2025
724018c
Merge pull request #58 from cadenmyers13/skpkg-migration
sbillinge Jun 26, 2025
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
Prev Previous commit
Next Next commit
black autofix
  • Loading branch information
Tieqiong committed Dec 28, 2024
commit 6198d352f84d9babfda3a0e77c93164b79e1dde5
1 change: 1 addition & 0 deletions conda-recipe/run_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python

import diffpy.srreal.tests

assert diffpy.srreal.tests.test().wasSuccessful()
72 changes: 39 additions & 33 deletions devutils/tunePeakPrecision.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
from diffpy.structure import Structure
from diffpy.srreal.pdf_ext import PDFCalculator
import diffpy.pdffit2

# make PdfFit silent
diffpy.pdffit2.redirect_stdout(open('/dev/null', 'w'))
diffpy.pdffit2.redirect_stdout(open("/dev/null", "w"))

# define nickel structure data
nickel_discus_data = '''
nickel_discus_data = """
title Ni
spcgr P1
cell 3.523870, 3.523870, 3.523870, 90.000000, 90.000000, 90.000000
Expand All @@ -44,10 +45,10 @@
NI 0.00000000 0.50000000 0.50000000 0.1000
NI 0.50000000 0.00000000 0.50000000 0.1000
NI 0.50000000 0.50000000 0.00000000 0.1000
'''
"""

nickel = Structure()
nickel.readStr(nickel_discus_data, format='discus')
nickel.readStr(nickel_discus_data, format="discus")


def Gpdffit2(qmax):
Expand All @@ -59,7 +60,7 @@ def Gpdffit2(qmax):
"""
# calculate reference data using pdffit2
pf2 = diffpy.pdffit2.PdfFit()
pf2.alloc('X', qmax, 0.0, rmin, rmax, int((rmax - rmin) / rstep + 1))
pf2.alloc("X", qmax, 0.0, rmin, rmax, int((rmax - rmin) / rstep + 1))
pf2.add_structure(nickel)
pf2.calc()
rg = numpy.array((pf2.getR(), pf2.getpdf_fit()))
Expand All @@ -81,7 +82,7 @@ def Gsrreal(qmax, peakprecision=None):
pdfcalc._setDoubleAttr("rmax", rmax + rstep * 1e-4)
pdfcalc._setDoubleAttr("rstep", rstep)
if peakprecision is not None:
pdfcalc._setDoubleAttr('peakprecision', peakprecision)
pdfcalc._setDoubleAttr("peakprecision", peakprecision)
pdfcalc.eval(nickel)
rg = numpy.array([pdfcalc.rgrid, pdfcalc.pdf])
return rg
Expand All @@ -105,38 +106,39 @@ def comparePDFCalculators(qmax, peakprecision=None):
t0, t1 -- CPU times used by pdffit2 and PDFCalculator calls
"""
rv = {}
rv['qmax'] = qmax
rv['peakprecision'] = (peakprecision is None and
PDFCalculator()._getDoubleAttr('peakprecision') or peakprecision)
rv["qmax"] = qmax
rv["peakprecision"] = (
peakprecision is None and PDFCalculator()._getDoubleAttr("peakprecision") or peakprecision
)
ttic = time.clock()
rg0 = Gpdffit2(qmax)
ttoc = time.clock()
rv['r'] = rg0[0]
rv['g0'] = rg0[1]
rv['t0'] = ttoc - ttic
rv["r"] = rg0[0]
rv["g0"] = rg0[1]
rv["t0"] = ttoc - ttic
ttic = time.clock()
rg1 = Gsrreal(qmax, peakprecision)
ttoc = time.clock()
assert numpy.all(rv['r'] == rg1[0])
rv['g1'] = rg1[1]
rv['t1'] = ttoc - ttic
rv['gdiff'] = rv['g0'] - rv['g1']
rv['grmsd'] = numpy.sqrt(numpy.mean(rv['gdiff']**2))
assert numpy.all(rv["r"] == rg1[0])
rv["g1"] = rg1[1]
rv["t1"] = ttoc - ttic
rv["gdiff"] = rv["g0"] - rv["g1"]
rv["grmsd"] = numpy.sqrt(numpy.mean(rv["gdiff"] ** 2))
return rv


def processCommandLineArguments():
global qmax, peakprecision, createplot
argc = len(sys.argv)
if set(['-h', '--help']).intersection(sys.argv):
if set(["-h", "--help"]).intersection(sys.argv):
print(__doc__)
sys.exit()
if argc > 1:
qmax = float(sys.argv[1])
if argc > 2:
peakprecision = float(sys.argv[2])
if argc > 3:
createplot = sys.argv[3].lower() in ('y', 'yes', '1', 'true')
createplot = sys.argv[3].lower() in ("y", "yes", "1", "true")
return


Expand All @@ -148,37 +150,41 @@ def plotComparison(cmpdata):
No return value.
"""
import pylab

pylab.clf()
pylab.subplot(211)
pylab.title('qmax=%(qmax)g peakprecision=%(peakprecision)g' % cmpdata)
pylab.ylabel('G')
r = cmpdata['r']
g0 = cmpdata['g0']
g1 = cmpdata['g1']
gdiff = cmpdata['gdiff']
pylab.title("qmax=%(qmax)g peakprecision=%(peakprecision)g" % cmpdata)
pylab.ylabel("G")
r = cmpdata["r"]
g0 = cmpdata["g0"]
g1 = cmpdata["g1"]
gdiff = cmpdata["gdiff"]
pylab.plot(r, g0, r, g1)
pylab.subplot(212)
pylab.plot(r, gdiff, 'r')
pylab.plot(r, gdiff, "r")
slope = numpy.sum(r * gdiff) / numpy.sum(r**2)
pylab.plot(r, slope * r, '--')
pylab.xlabel('r')
pylab.ylabel('Gdiff')
pylab.title('slope = %g' % slope)
pylab.plot(r, slope * r, "--")
pylab.xlabel("r")
pylab.ylabel("Gdiff")
pylab.title("slope = %g" % slope)
pylab.draw()
return


def main():
processCommandLineArguments()
cmpdata = comparePDFCalculators(qmax, peakprecision)
print(("qmax = %(qmax)g pkprec = %(peakprecision)g " +
"grmsd = %(grmsd)g t0 = %(t0).3f t1 = %(t1).3f") % cmpdata)
print(
("qmax = %(qmax)g pkprec = %(peakprecision)g " + "grmsd = %(grmsd)g t0 = %(t0).3f t1 = %(t1).3f")
% cmpdata
)
if createplot:
plotComparison(cmpdata)
import pylab

pylab.show()
return


if __name__ == '__main__':
if __name__ == "__main__":
main()
87 changes: 44 additions & 43 deletions doc/manual/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../../..'))
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath("../../.."))

# abbreviations
ab_authors = u'Pavol Juhás, Christopher L. Farrow, Simon J.L. Billinge group'
ab_authors = "Pavol Juhás, Christopher L. Farrow, Simon J.L. Billinge group"

# -- General configuration -----------------------------------------------------

Expand All @@ -33,38 +33,39 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'm2r',
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"m2r",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'diffpy.srreal'
copyright = '%Y, Brookhaven National Laboratory'
project = "diffpy.srreal"
copyright = "%Y, Brookhaven National Laboratory"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
from setup import versiondata
fullversion = versiondata.get('DEFAULT', 'version')

fullversion = versiondata.get("DEFAULT", "version")
# The short X.Y version.
version = ''.join(fullversion.split('.post')[:1])
version = "".join(fullversion.split(".post")[:1])
# The full version, including alpha/beta/rc tags.
release = fullversion

Expand All @@ -75,13 +76,13 @@
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
today_seconds = versiondata.getint('DEFAULT', 'timestamp')
today = time.strftime('%B %d, %Y', time.localtime(today_seconds))
today_seconds = versiondata.getint("DEFAULT", "timestamp")
today = time.strftime("%B %d, %Y", time.localtime(today_seconds))
year = today.split()[-1]
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# substitute YEAR in the copyright string
copyright = copyright.replace('%Y', year)
copyright = copyright.replace("%Y", year)

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -102,10 +103,10 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['diffpy.srreal']
modindex_common_prefix = ["diffpy.srreal"]

# Display all warnings for missing links.
nitpicky = True
Expand All @@ -114,14 +115,14 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_py3doc_enhanced_theme'
html_theme = "sphinx_py3doc_enhanced_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'collapsiblesidebar' : 'true',
'navigation_with_keys' : 'true',
"collapsiblesidebar": "true",
"navigation_with_keys": "true",
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down Expand Up @@ -190,27 +191,24 @@
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'srrealdoc'
htmlhelp_basename = "srrealdoc"


# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'diffpy.srreal.tex', 'diffpy.srreal Documentation',
ab_authors, 'manual'),
("index", "diffpy.srreal.tex", "diffpy.srreal Documentation", ab_authors, "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -238,10 +236,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'diffpy.srreal', 'diffpy.srreal Documentation',
ab_authors, 1)
]
man_pages = [("index", "diffpy.srreal", "diffpy.srreal Documentation", ab_authors, 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -253,9 +248,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'diffpy.srreal', 'diffpy.srreal Documentation',
ab_authors, 'diffpy.srreal', 'One line description of project.',
'Miscellaneous'),
(
"index",
"diffpy.srreal",
"diffpy.srreal Documentation",
ab_authors,
"diffpy.srreal",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand All @@ -270,6 +271,6 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'numpy': ('https://docs.scipy.org/doc/numpy', None),
'python' : ('https://docs.python.org/3.7', None),
"numpy": ("https://docs.scipy.org/doc/numpy", None),
"python": ("https://docs.python.org/3.7", None),
}
9 changes: 5 additions & 4 deletions examples/compareC60PDFs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
from diffpy.srreal.pdfcalculator import PDFCalculator, DebyePDFCalculator

mydir = os.path.dirname(os.path.abspath(sys.argv[0]))
buckyfile = os.path.join(mydir, 'datafiles', 'C60bucky.stru')
buckyfile = os.path.join(mydir, "datafiles", "C60bucky.stru")

# load C60 molecule as a diffpy.structure object
bucky = Structure(filename=buckyfile)
cfg = { 'qmax' : 25,
'rmin' : 0,
'rmax' : 10.001,
cfg = {
"qmax": 25,
"rmin": 0,
"rmax": 10.001,
}

# calculate PDF by real-space summation
Expand Down
13 changes: 7 additions & 6 deletions examples/compareC60PDFs_objcryst.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from diffpy.srreal.pdfcalculator import PDFCalculator, DebyePDFCalculator

# load C60 molecule as a diffpy.structure object
bucky_diffpy = Structure(filename='datafiles/C60bucky.stru')
bucky_diffpy = Structure(filename="datafiles/C60bucky.stru")

# convert to an ObjCryst molecule
c60 = Crystal(1, 1, 1, 'P1')
c60 = Crystal(1, 1, 1, "P1")
mc60 = Molecule(c60, "C60")
c60.AddScatterer(mc60)
# Create the scattering power object for the carbon atoms
Expand All @@ -26,10 +26,11 @@
mc60.AddAtom(a.xyz_cartn[0], a.xyz_cartn[1], a.xyz_cartn[2], sp, cname)

# PDF configuration
cfg = { 'qmax' : 25,
'rmin' : 0,
'rmax' : 10.001,
'rstep' : 0.05,
cfg = {
"qmax": 25,
"rmin": 0,
"rmax": 10.001,
"rstep": 0.05,
}

# calculate PDF by real-space summation
Expand Down
Loading