diffpy.structure 3.3.1rc0__tar.gz → 3.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/LICENSE-DANSE.rst +1 -4
  2. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/LICENSE.rst +3 -0
  3. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/PKG-INFO +29 -12
  4. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/README.rst +23 -7
  5. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/pyproject.toml +7 -7
  6. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/requirements/conda.txt +1 -0
  7. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/requirements/docs.txt +1 -1
  8. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/requirements/pip.txt +1 -0
  9. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/__init__.py +1 -1
  10. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/__init__.py +50 -6
  11. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/_legacy_importer.py +5 -1
  12. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/apps/anyeye.py +108 -16
  13. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/apps/transtru.py +12 -9
  14. diffpy_structure-3.4.0/src/diffpy/structure/apps/vesta_viewer.py +366 -0
  15. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/atom.py +72 -21
  16. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/expansion/makeellipsoid.py +46 -10
  17. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/expansion/shapeutils.py +20 -0
  18. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/expansion/supercell_mod.py +1 -1
  19. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/lattice.py +160 -25
  20. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/mmlibspacegroups.py +20 -4
  21. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/__init__.py +53 -1
  22. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_auto.py +68 -11
  23. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_cif.py +156 -61
  24. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_discus.py +142 -9
  25. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_pdb.py +127 -10
  26. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_pdffit.py +53 -5
  27. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_rawxyz.py +53 -1
  28. diffpy_structure-3.4.0/src/diffpy/structure/parsers/p_vesta.py +370 -0
  29. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_xcfg.py +61 -4
  30. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/p_xyz.py +53 -1
  31. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/structureparser.py +53 -3
  32. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/pdffitstructure.py +21 -1
  33. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/spacegroupmod.py +18 -3
  34. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/spacegroups.py +76 -8
  35. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/structure.py +161 -45
  36. diffpy_structure-3.4.0/src/diffpy/structure/structure_app.py +33 -0
  37. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/symmetryutilities.py +396 -42
  38. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/utils.py +26 -5
  39. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/version.py +7 -6
  40. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy.structure.egg-info/PKG-INFO +29 -12
  41. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy.structure.egg-info/SOURCES.txt +6 -1
  42. diffpy_structure-3.4.0/src/diffpy.structure.egg-info/entry_points.txt +2 -0
  43. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy.structure.egg-info/requires.txt +1 -0
  44. diffpy_structure-3.4.0/tests/test_atom.py +305 -0
  45. diffpy_structure-3.4.0/tests/test_expansion.py +122 -0
  46. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_lattice.py +84 -16
  47. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_loadstructure.py +33 -7
  48. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_p_cif.py +129 -16
  49. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_p_discus.py +11 -11
  50. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_p_pdffit.py +25 -15
  51. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_parsers.py +49 -14
  52. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_spacegroups.py +62 -11
  53. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_structure.py +125 -8
  54. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_supercell.py +2 -2
  55. diffpy_structure-3.4.0/tests/test_symmetryutilities.py +1288 -0
  56. diffpy_structure-3.4.0/tests/test_utils.py +37 -0
  57. diffpy_structure-3.3.1rc0/src/diffpy.structure.egg-info/entry_points.txt +0 -2
  58. diffpy_structure-3.3.1rc0/tests/test_atom.py +0 -152
  59. diffpy_structure-3.3.1rc0/tests/test_symmetryutilities.py +0 -510
  60. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/AUTHORS.rst +0 -0
  61. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/LICENSE-pymmlib.rst +0 -0
  62. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/MANIFEST.in +0 -0
  63. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/requirements/build.txt +0 -0
  64. /diffpy_structure-3.3.1rc0/requirements/test.txt → /diffpy_structure-3.4.0/requirements/tests.txt +0 -0
  65. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/setup.cfg +0 -0
  66. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/apps/__init__.py +0 -0
  67. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/expansion/__init__.py +0 -0
  68. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/parsers/parser_index_mod.py +0 -0
  69. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/sgtbxspacegroups.py +0 -0
  70. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy/structure/structureerrors.py +0 -0
  71. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy.structure.egg-info/dependency_links.txt +0 -0
  72. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/src/diffpy.structure.egg-info/top_level.txt +0 -0
  73. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/conftest.py +0 -0
  74. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/test_version.py +0 -0
  75. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/BubbleRaftShort.xcfg +0 -0
  76. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/CdSe_bulk.stru +0 -0
  77. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/LiCl-bad.cif +0 -0
  78. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/Ni-bad.stru +0 -0
  79. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/Ni-discus.stru +0 -0
  80. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/Ni.stru +0 -0
  81. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/Ni_prim123.stru +0 -0
  82. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/Ni_ref.cif +0 -0
  83. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/PbTe.cif +0 -0
  84. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/TeI-unkocc.cif +0 -0
  85. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/TeI.cif +0 -0
  86. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/ZnSb_RT_Q28X_VM_20_fxiso.rstr +0 -0
  87. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/arginine.pdb +0 -0
  88. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/badspacegroup.cif +0 -0
  89. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky-bad1.xyz +0 -0
  90. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky-bad2.xyz +0 -0
  91. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky-plain-bad.xyz +0 -0
  92. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky-plain.xyz +0 -0
  93. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky-raw.xyz +0 -0
  94. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/bucky.xyz +0 -0
  95. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/curlybrackets.cif +0 -0
  96. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/customsg.cif +0 -0
  97. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/graphite.cif +0 -0
  98. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/hexagon-raw-bad.xyz +0 -0
  99. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/hexagon-raw.xy +0 -0
  100. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/hexagon-raw.xyz +0 -0
  101. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0}/tests/testdata/nosites.cif +0 -0
@@ -9,14 +9,11 @@ Copyright 2006-2007, Board of Trustees of Michigan State University,
9
9
  Copyright 2008-2012, The Trustees of Columbia University in the
10
10
  City of New York. (Copyright holder indicated in each source file).
11
11
 
12
- Copyright (c) 2024, The Trustees of Columbia University in the City of New York.
13
- All rights reserved.
14
-
15
12
  For more information please visit the project web-page:
16
13
 
17
14
  http://www.diffpy.org/
18
15
 
19
- or email Prof. Simon Billinge at sb2896@columbia.edu
16
+ or email Prof. Simon Billinge at sbillinge@ucsb.edu
20
17
 
21
18
  Redistribution and use in source and binary forms, with or without
22
19
  modification, are permitted provided that the following conditions
@@ -18,6 +18,9 @@ Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Labo
18
18
  Copyright (c) 2024-2025, The Trustees of Columbia University in the City of New York.
19
19
  All rights reserved.
20
20
 
21
+ Copyright (c) 2026-present, The Contributors to the diffpy.structure project.
22
+ All rights reserved.
23
+
21
24
  The "DiffPy-CMI" is distributed subject to the following license conditions:
22
25
 
23
26
  .. code-block:: text
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpy.structure
3
- Version: 3.3.1rc0
3
+ Version: 3.4.0
4
4
  Summary: Crystal structure container and parsers for structure formats.
5
- Author-email: Simon Billinge <sb2896@columbia.edu>
6
- Maintainer-email: Simon Billinge <sb2896@columbia.edu>
5
+ Author-email: Simon Billinge <sbillinge@ucsb.edu>
6
+ Maintainer-email: Simon Billinge <sbillinge@ucsb.edu>
7
7
  Project-URL: Homepage, https://github.com/diffpy/diffpy.structure/
8
8
  Project-URL: Issues, https://github.com/diffpy/diffpy.structure/issues/
9
9
  Keywords: diffpy,crystal structure data storage,CIF,PDB
@@ -16,12 +16,12 @@ Classifier: Operating System :: MacOS :: MacOS X
16
16
  Classifier: Operating System :: Microsoft :: Windows
17
17
  Classifier: Operating System :: POSIX
18
18
  Classifier: Operating System :: Unix
19
- Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
22
  Classifier: Topic :: Scientific/Engineering :: Physics
23
23
  Classifier: Topic :: Scientific/Engineering :: Chemistry
24
- Requires-Python: <3.14,>=3.11
24
+ Requires-Python: <3.15,>=3.12
25
25
  Description-Content-Type: text/x-rst
26
26
  License-File: LICENSE-DANSE.rst
27
27
  License-File: LICENSE-pymmlib.rst
@@ -29,6 +29,7 @@ License-File: LICENSE.rst
29
29
  License-File: AUTHORS.rst
30
30
  Requires-Dist: numpy
31
31
  Requires-Dist: pycifrw
32
+ Requires-Dist: diffpy.utils
32
33
  Dynamic: license-file
33
34
 
34
35
  |Icon| |title|_
@@ -58,6 +59,7 @@ Dynamic: license-file
58
59
  :target: https://anaconda.org/conda-forge/diffpy.structure
59
60
 
60
61
  .. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff
62
+ :target: https://github.com/diffpy/diffpy.structure/pulls
61
63
 
62
64
  .. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.structure
63
65
  :target: https://pypi.org/project/diffpy.structure/
@@ -132,6 +134,19 @@ and run the following ::
132
134
 
133
135
  pip install .
134
136
 
137
+ This package also provides command-line utilities. To check the software has been installed correctly, type ::
138
+
139
+ diffpy.structure --version
140
+
141
+ You can also type the following command to verify the installation. ::
142
+
143
+ python -c "import diffpy.structure; print(diffpy.structure.__version__)"
144
+
145
+
146
+ To view the basic usage and available commands, type ::
147
+
148
+ diffpy.structure -h
149
+
135
150
  Getting Started
136
151
  ---------------
137
152
 
@@ -167,8 +182,15 @@ Improvements and fixes are always appreciated.
167
182
 
168
183
  Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.structure/blob/main/CODE-OF-CONDUCT.rst>`_.
169
184
 
170
- Acknowledgement
171
- ---------------
185
+ Contact
186
+ -------
187
+
188
+ For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email the maintainer``Simon Billinge(sbillinge@ucsb.edu)``.
189
+
190
+ Acknowledgements
191
+ ----------------
192
+
193
+ ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
172
194
 
173
195
  Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py*
174
196
  originate from the `pymmlib project <http://pymmlib.sourceforge.net>`_.
@@ -177,8 +199,3 @@ Less common settings of space groups were generating using the
177
199
  `Computational Crystallography Toolbox <http://cctbx.sourceforge.net>`_.
178
200
 
179
201
  ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
180
-
181
- Contact
182
- -------
183
-
184
- For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email Prof. Simon Billinge at sb2896@columbia.edu.
@@ -25,6 +25,7 @@
25
25
  :target: https://anaconda.org/conda-forge/diffpy.structure
26
26
 
27
27
  .. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff
28
+ :target: https://github.com/diffpy/diffpy.structure/pulls
28
29
 
29
30
  .. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.structure
30
31
  :target: https://pypi.org/project/diffpy.structure/
@@ -99,6 +100,19 @@ and run the following ::
99
100
 
100
101
  pip install .
101
102
 
103
+ This package also provides command-line utilities. To check the software has been installed correctly, type ::
104
+
105
+ diffpy.structure --version
106
+
107
+ You can also type the following command to verify the installation. ::
108
+
109
+ python -c "import diffpy.structure; print(diffpy.structure.__version__)"
110
+
111
+
112
+ To view the basic usage and available commands, type ::
113
+
114
+ diffpy.structure -h
115
+
102
116
  Getting Started
103
117
  ---------------
104
118
 
@@ -134,8 +148,15 @@ Improvements and fixes are always appreciated.
134
148
 
135
149
  Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.structure/blob/main/CODE-OF-CONDUCT.rst>`_.
136
150
 
137
- Acknowledgement
138
- ---------------
151
+ Contact
152
+ -------
153
+
154
+ For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email the maintainer``Simon Billinge(sbillinge@ucsb.edu)``.
155
+
156
+ Acknowledgements
157
+ ----------------
158
+
159
+ ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
139
160
 
140
161
  Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py*
141
162
  originate from the `pymmlib project <http://pymmlib.sourceforge.net>`_.
@@ -144,8 +165,3 @@ Less common settings of space groups were generating using the
144
165
  `Computational Crystallography Toolbox <http://cctbx.sourceforge.net>`_.
145
166
 
146
167
  ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
147
-
148
- Contact
149
- -------
150
-
151
- For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email Prof. Simon Billinge at sb2896@columbia.edu.
@@ -6,15 +6,15 @@ build-backend = "setuptools.build_meta"
6
6
  name = "diffpy.structure"
7
7
  dynamic=['version', 'dependencies']
8
8
  authors = [
9
- { name="Simon Billinge", email="sb2896@columbia.edu" },
9
+ {name='Simon Billinge', email='sbillinge@ucsb.edu'},
10
10
  ]
11
11
  maintainers = [
12
- { name="Simon Billinge", email="sb2896@columbia.edu" },
12
+ {name='Simon Billinge', email='sbillinge@ucsb.edu'},
13
13
  ]
14
14
  description = "Crystal structure container and parsers for structure formats."
15
15
  keywords = ['diffpy', 'crystal structure data storage', 'CIF', 'PDB']
16
16
  readme = "README.rst"
17
- requires-python = ">=3.11, <3.14"
17
+ requires-python = ">=3.12, <3.15"
18
18
  classifiers = [
19
19
  'Development Status :: 5 - Production/Stable',
20
20
  'Environment :: Console',
@@ -25,16 +25,13 @@ classifiers = [
25
25
  'Operating System :: Microsoft :: Windows',
26
26
  'Operating System :: POSIX',
27
27
  'Operating System :: Unix',
28
- 'Programming Language :: Python :: 3.11',
29
28
  'Programming Language :: Python :: 3.12',
30
29
  'Programming Language :: Python :: 3.13',
30
+ 'Programming Language :: Python :: 3.14',
31
31
  'Topic :: Scientific/Engineering :: Physics',
32
32
  'Topic :: Scientific/Engineering :: Chemistry',
33
33
  ]
34
34
 
35
- [project.scripts]
36
- transtru = "diffpy.structure.apps.transtru:main"
37
-
38
35
  [project.urls]
39
36
  Homepage = "https://github.com/diffpy/diffpy.structure/"
40
37
  Issues = "https://github.com/diffpy/diffpy.structure/issues/"
@@ -51,6 +48,9 @@ include = ["*"] # package names should match these glob patterns (["*"] by defa
51
48
  exclude = [] # exclude packages matching these glob patterns (empty by default)
52
49
  namespaces = false # to disable scanning PEP 420 namespaces (true by default)
53
50
 
51
+ [project.scripts]
52
+ diffpy-structure = "diffpy.structure.app:main"
53
+
54
54
  [tool.setuptools.dynamic]
55
55
  dependencies = {file = ["requirements/pip.txt"]}
56
56
 
@@ -1,2 +1,3 @@
1
1
  numpy
2
2
  pycifrw
3
+ diffpy.utils
@@ -2,4 +2,4 @@ sphinx
2
2
  sphinx_rtd_theme
3
3
  sphinx-copybutton
4
4
  doctr
5
- m2r
5
+ m2r2
@@ -1,2 +1,3 @@
1
1
  numpy
2
2
  pycifrw
3
+ diffpy.utils
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  ##############################################################################
3
3
  #
4
- # (c) 2024-2025 The Trustees of Columbia University in the City of New York.
4
+ # (c) 2024-2026 The Trustees of Columbia University in the City of New York.
5
5
  # All rights reserved.
6
6
  #
7
7
  # File coded by: Billinge Group members and community contributors.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  ##############################################################################
3
3
  #
4
- # (c) 2024-2025 The Trustees of Columbia University in the City of New York.
4
+ # (c) 2024-2026 The Trustees of Columbia University in the City of New York.
5
5
  # All rights reserved.
6
6
  #
7
7
  # File coded by: Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members.
@@ -33,22 +33,66 @@ Exceptions:
33
33
  * SymmetryError
34
34
  """
35
35
 
36
- # Interface definitions ------------------------------------------------------
37
36
 
37
+ import os
38
+ import sys
39
+
40
+ import diffpy.structure as _structure
38
41
  from diffpy.structure.atom import Atom
39
42
  from diffpy.structure.lattice import Lattice
40
- from diffpy.structure.parsers import getParser
43
+ from diffpy.structure.parsers import get_parser
41
44
  from diffpy.structure.pdffitstructure import PDFFitStructure
42
45
  from diffpy.structure.structure import Structure
43
46
  from diffpy.structure.structureerrors import LatticeError, StructureFormatError, SymmetryError
44
47
 
45
48
  # package version
46
49
  from diffpy.structure.version import __version__
50
+ from diffpy.utils._deprecator import build_deprecation_message, deprecated
51
+
52
+ # Deprecations -------------------------------------------------------
53
+ base = "diffpy.structure"
54
+ removal_version = "4.0.0"
55
+ loadStructure_deprecation_msg = build_deprecation_message(
56
+ base,
57
+ "loadStructure",
58
+ "load_structure",
59
+ removal_version,
60
+ )
61
+
62
+
63
+ # @deprecated
64
+ # custom deprecator for diffpy.Structure module
65
+ class DeprecatedStructureModule:
66
+ """Proxy for backward compatibility of diffpy.Structure."""
67
+
68
+ def __getattr__(self, name):
69
+ import warnings
70
+
71
+ warnings.warn(
72
+ "Module 'diffpy.Structure' is deprecated and will be removed in version 4.0. "
73
+ "Use 'diffpy.structure' instead.",
74
+ DeprecationWarning,
75
+ stacklevel=2,
76
+ )
77
+ return getattr(_structure, name)
78
+
79
+
80
+ sys.modules["diffpy.Structure"] = DeprecatedStructureModule()
47
81
 
48
82
  # top level routines
49
83
 
50
84
 
85
+ @deprecated(loadStructure_deprecation_msg)
51
86
  def loadStructure(filename, fmt="auto", **kw):
87
+ """This function has been deprecated and will be removed in version
88
+ 4.0.0.
89
+
90
+ Please use diffpy.structure.load_structure instead.
91
+ """
92
+ return load_structure(filename, fmt, **kw)
93
+
94
+
95
+ def load_structure(filename, fmt="auto", **kw):
52
96
  """Load new structure object from the specified file.
53
97
 
54
98
  Parameters
@@ -72,9 +116,9 @@ def loadStructure(filename, fmt="auto", **kw):
72
116
  Return a more specific PDFFitStructure type for 'pdffit'
73
117
  and 'discus' formats.
74
118
  """
75
-
76
- p = getParser(fmt, **kw)
77
- rv = p.parseFile(filename)
119
+ filename = os.fspath(filename)
120
+ p = get_parser(fmt, **kw)
121
+ rv = p.parse_file(filename)
78
122
  return rv
79
123
 
80
124
 
@@ -80,7 +80,11 @@ class MapRenamedStructureModule(importlib.abc.Loader):
80
80
  # ----------------------------------------------------------------------------
81
81
 
82
82
  # show deprecation warning for diffpy.Structure
83
- warn(WMSG.format("diffpy.Structure", "diffpy.structure"), DeprecationWarning, stacklevel=2)
83
+ warn(
84
+ WMSG.format("diffpy.Structure", "diffpy.structure"),
85
+ DeprecationWarning,
86
+ stacklevel=2,
87
+ )
84
88
 
85
89
  # install meta path finder for diffpy.Structure submodules
86
90
  sys.meta_path.append(FindRenamedStructureModule())
@@ -52,6 +52,46 @@ import signal
52
52
  import sys
53
53
 
54
54
  from diffpy.structure.structureerrors import StructureFormatError
55
+ from diffpy.utils._deprecator import build_deprecation_message, deprecated
56
+
57
+ base = "diffpy.structure"
58
+ removal_version = "4.0.0"
59
+ loadStructureFile_deprecation_msg = build_deprecation_message(
60
+ base,
61
+ "loadStructureFile",
62
+ "load_structure_file",
63
+ removal_version,
64
+ )
65
+ convertStructureFile_deprecation_msg = build_deprecation_message(
66
+ base,
67
+ "loadStructureFile",
68
+ "load_structure_file",
69
+ removal_version,
70
+ )
71
+ watchStructureFile_deprecation_msg = build_deprecation_message(
72
+ base,
73
+ "watchStructureFile",
74
+ "watch_structure_file",
75
+ removal_version,
76
+ )
77
+ cleanUp_deprecation_msg = build_deprecation_message(
78
+ base,
79
+ "cleanUp",
80
+ "clean_up",
81
+ removal_version,
82
+ )
83
+ parseFormula_deprecation_msg = build_deprecation_message(
84
+ base,
85
+ "parseFormula",
86
+ "parse_formula",
87
+ removal_version,
88
+ )
89
+ signalHandler_deprecation_msg = build_deprecation_message(
90
+ base,
91
+ "signalHandler",
92
+ "signal_handler",
93
+ removal_version,
94
+ )
55
95
 
56
96
  # parameter dictionary
57
97
  pd = {
@@ -72,9 +112,9 @@ def usage(style=None):
72
112
  if style == "brief":
73
113
  msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
74
114
  else:
75
- from diffpy.structure.parsers import inputFormats
115
+ from diffpy.structure.parsers import input_formats
76
116
 
77
- fmts = [f for f in inputFormats() if f != "auto"]
117
+ fmts = [f for f in input_formats() if f != "auto"]
78
118
  msg = msg.replace("inputFormats", " ".join(fmts))
79
119
  print(msg)
80
120
  return
@@ -87,9 +127,28 @@ def version():
87
127
  return
88
128
 
89
129
 
130
+ @deprecated(loadStructureFile_deprecation_msg)
90
131
  def loadStructureFile(filename, format="auto"):
91
132
  """Load structure from specified file.
92
133
 
134
+ Parameters
135
+ ----------
136
+ filename : str
137
+ Path to the structure file.
138
+ format : str, Optional
139
+ File format, by default "auto".
140
+
141
+ Returns
142
+ -------
143
+ tuple
144
+ A tuple of (Structure, fileformat).
145
+ """
146
+ return load_structure_file(filename, format)
147
+
148
+
149
+ def load_structure_file(filename, format="auto"):
150
+ """Load structure from specified file.
151
+
93
152
  Parameters
94
153
  ----------
95
154
  filename : str
@@ -110,7 +169,12 @@ def loadStructureFile(filename, format="auto"):
110
169
  return (stru, fileformat)
111
170
 
112
171
 
172
+ @deprecated(convertStructureFile_deprecation_msg)
113
173
  def convertStructureFile(pd):
174
+ return convert_structure_file(pd)
175
+
176
+
177
+ def convert_structure_file(pd):
114
178
  # make temporary directory on the first pass
115
179
  if "tmpdir" not in pd:
116
180
  from tempfile import mkdtemp
@@ -134,11 +198,14 @@ def convertStructureFile(pd):
134
198
  return
135
199
  # otherwise convert to the first recognized viewer format
136
200
  if stru is None:
137
- stru = loadStructureFile(strufile, fmt)[0]
201
+ stru = load_structure_file(strufile, fmt)[0]
138
202
  if pd["formula"]:
139
203
  formula = pd["formula"]
140
204
  if len(formula) != len(stru):
141
- emsg = "Formula has %i atoms while structure %i" % (len(formula), len(stru))
205
+ emsg = "Formula has %i atoms while structure %i" % (
206
+ len(formula),
207
+ len(stru),
208
+ )
142
209
  raise RuntimeError(emsg)
143
210
  for a, el in zip(stru, formula):
144
211
  a.element = el
@@ -151,19 +218,29 @@ def convertStructureFile(pd):
151
218
  return
152
219
 
153
220
 
221
+ @deprecated(watchStructureFile_deprecation_msg)
154
222
  def watchStructureFile(pd):
223
+ return watch_structure_file(pd)
224
+
225
+
226
+ def watch_structure_file(pd):
155
227
  from time import sleep
156
228
 
157
229
  strufile = pd["strufile"]
158
230
  tmpfile = pd["tmpfile"]
159
231
  while pd["watch"]:
160
232
  if os.path.getmtime(tmpfile) < os.path.getmtime(strufile):
161
- convertStructureFile(pd)
233
+ convert_structure_file(pd)
162
234
  sleep(1)
163
235
  return
164
236
 
165
237
 
238
+ @deprecated(cleanUp_deprecation_msg)
166
239
  def cleanUp(pd):
240
+ return clean_up(pd)
241
+
242
+
243
+ def clean_up(pd):
167
244
  if "tmpfile" in pd:
168
245
  os.remove(pd["tmpfile"])
169
246
  del pd["tmpfile"]
@@ -173,7 +250,14 @@ def cleanUp(pd):
173
250
  return
174
251
 
175
252
 
253
+ @deprecated(parseFormula_deprecation_msg)
176
254
  def parseFormula(formula):
255
+ """Parse chemical formula and return a list of elements."""
256
+ # remove all blanks
257
+ return parse_formula(formula)
258
+
259
+
260
+ def parse_formula(formula):
177
261
  """Parse chemical formula and return a list of elements."""
178
262
  # remove all blanks
179
263
  formula = re.sub(r"\s", "", formula)
@@ -194,11 +278,17 @@ def parseFormula(formula):
194
278
 
195
279
 
196
280
  def die(exit_status=0, pd={}):
197
- cleanUp(pd)
281
+ clean_up(pd)
198
282
  sys.exit(exit_status)
199
283
 
200
284
 
285
+ @deprecated(signalHandler_deprecation_msg)
201
286
  def signalHandler(signum, stackframe):
287
+ # revert to default handler
288
+ return signal_handler(signum, stackframe)
289
+
290
+
291
+ def signal_handler(signum, stackframe):
202
292
  # revert to default handler
203
293
  signal.signal(signum, signal.SIG_DFL)
204
294
  if signum == signal.SIGCHLD:
@@ -217,7 +307,9 @@ def main():
217
307
  pd["watch"] = False
218
308
  try:
219
309
  opts, args = getopt.getopt(
220
- sys.argv[1:], "f:whV", ["formula=", "watch", "viewer=", "formats=", "help", "version"]
310
+ sys.argv[1:],
311
+ "f:whV",
312
+ ["formula=", "watch", "viewer=", "formats=", "help", "version"],
221
313
  )
222
314
  except getopt.GetoptError as errmsg:
223
315
  print(errmsg, file=sys.stderr)
@@ -226,7 +318,7 @@ def main():
226
318
  for o, a in opts:
227
319
  if o in ("-f", "--formula"):
228
320
  try:
229
- pd["formula"] = parseFormula(a)
321
+ pd["formula"] = parse_formula(a)
230
322
  except RuntimeError as msg:
231
323
  print(msg, file=sys.stderr)
232
324
  die(2)
@@ -250,23 +342,23 @@ def main():
250
342
  die(2)
251
343
  pd["strufile"] = args[0]
252
344
  # trap the following signals
253
- signal.signal(signal.SIGHUP, signalHandler)
254
- signal.signal(signal.SIGQUIT, signalHandler)
255
- signal.signal(signal.SIGSEGV, signalHandler)
256
- signal.signal(signal.SIGTERM, signalHandler)
257
- signal.signal(signal.SIGINT, signalHandler)
345
+ signal.signal(signal.SIGHUP, signal_handler)
346
+ signal.signal(signal.SIGQUIT, signal_handler)
347
+ signal.signal(signal.SIGSEGV, signal_handler)
348
+ signal.signal(signal.SIGTERM, signal_handler)
349
+ signal.signal(signal.SIGINT, signal_handler)
258
350
  env = os.environ.copy()
259
351
  if os.path.basename(pd["viewer"]).startswith("atomeye"):
260
352
  env["XLIB_SKIP_ARGB_VISUALS"] = "1"
261
353
  # try to run the thing:
262
354
  try:
263
- convertStructureFile(pd)
355
+ convert_structure_file(pd)
264
356
  spawnargs = (pd["viewer"], pd["viewer"], pd["tmpfile"], env)
265
357
  # load strufile in atomeye
266
358
  if pd["watch"]:
267
- signal.signal(signal.SIGCHLD, signalHandler)
359
+ signal.signal(signal.SIGCHLD, signal_handler)
268
360
  os.spawnlpe(os.P_NOWAIT, *spawnargs)
269
- watchStructureFile(pd)
361
+ watch_structure_file(pd)
270
362
  else:
271
363
  status = os.spawnlpe(os.P_WAIT, *spawnargs)
272
364
  die(status, pd)
@@ -52,10 +52,10 @@ def usage(style=None):
52
52
  if style == "brief":
53
53
  msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
54
54
  else:
55
- from diffpy.structure.parsers import inputFormats, outputFormats
55
+ from diffpy.structure.parsers import input_formats, output_formats
56
56
 
57
- msg = msg.replace("inputFormats", " ".join(inputFormats()))
58
- msg = msg.replace("outputFormats", " ".join(outputFormats()))
57
+ msg = msg.replace("inputFormats", " ".join(input_formats()))
58
+ msg = msg.replace("outputFormats", " ".join(output_formats()))
59
59
  print(msg)
60
60
  return
61
61
 
@@ -88,28 +88,31 @@ def main():
88
88
  usage("brief")
89
89
  sys.exit()
90
90
  # process arguments
91
- from diffpy.structure.parsers import inputFormats, outputFormats
91
+ from diffpy.structure.parsers import input_formats, output_formats
92
92
 
93
93
  try:
94
94
  infmt, outfmt = args[0].split("..", 1)
95
- if infmt not in inputFormats():
95
+ if infmt not in input_formats():
96
96
  print("'%s' is not valid input format" % infmt, file=sys.stderr)
97
97
  sys.exit(2)
98
- if outfmt not in outputFormats():
98
+ if outfmt not in output_formats():
99
99
  print("'%s' is not valid output format" % outfmt, file=sys.stderr)
100
100
  sys.exit(2)
101
101
  except ValueError:
102
- print("invalid format specification '%s' does not contain .." % args[0], file=sys.stderr)
102
+ print(
103
+ "invalid format specification '%s' does not contain .." % args[0],
104
+ file=sys.stderr,
105
+ )
103
106
  sys.exit(2)
104
107
  # ready to do some real work
105
108
  try:
106
109
  strufile = args[1]
107
110
  stru = Structure()
108
111
  if args[1] == "-":
109
- stru.readStr(sys.stdin.read(), infmt)
112
+ stru.read_structure(sys.stdin.read(), infmt)
110
113
  else:
111
114
  stru.read(strufile, infmt)
112
- sys.stdout.write(stru.writeStr(outfmt))
115
+ sys.stdout.write(stru.write_structure(outfmt))
113
116
  except IndexError:
114
117
  print("strufile not specified", file=sys.stderr)
115
118
  sys.exit(2)