diffpy.labpdfproc 0.3.1rc4__tar.gz → 0.4.0rc0__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 (40) hide show
  1. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/MANIFEST.in +0 -1
  2. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/PKG-INFO +5 -7
  3. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/README.rst +2 -2
  4. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/pyproject.toml +8 -9
  5. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/requirements/conda.txt +1 -0
  6. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/labpdfprocapp.py +5 -9
  7. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/tools.py +42 -12
  8. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/PKG-INFO +5 -7
  9. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/SOURCES.txt +0 -9
  10. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/tests/conftest.py +6 -1
  11. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/tests/test_tools.py +35 -0
  12. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/tests/test_version.py +1 -1
  13. diffpy_labpdfproc-0.3.1rc4/.codecov.yml +0 -14
  14. diffpy_labpdfproc-0.3.1rc4/.flake8 +0 -13
  15. diffpy_labpdfproc-0.3.1rc4/.isort.cfg +0 -5
  16. diffpy_labpdfproc-0.3.1rc4/.pre-commit-config.yaml +0 -66
  17. diffpy_labpdfproc-0.3.1rc4/.readthedocs.yaml +0 -13
  18. diffpy_labpdfproc-0.3.1rc4/CHANGELOG.rst +0 -106
  19. diffpy_labpdfproc-0.3.1rc4/CODE-OF-CONDUCT.rst +0 -133
  20. diffpy_labpdfproc-0.3.1rc4/cookiecutter.json +0 -20
  21. diffpy_labpdfproc-0.3.1rc4/environment.yml +0 -6
  22. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/AUTHORS.rst +0 -0
  23. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/LICENSE.rst +0 -0
  24. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/requirements/build.txt +0 -0
  25. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/requirements/docs.txt +0 -0
  26. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/requirements/pip.txt +0 -0
  27. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/requirements/tests.txt +0 -0
  28. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/setup.cfg +0 -0
  29. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/__init__.py +0 -0
  30. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/__init__.py +0 -0
  31. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/data/coefficient_list.csv +0 -0
  32. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/data/inverse_cve.xy +0 -0
  33. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/functions.py +0 -0
  34. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy/labpdfproc/version.py +0 -0
  35. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/dependency_links.txt +0 -0
  36. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/entry_points.txt +0 -0
  37. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/requires.txt +0 -0
  38. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/src/diffpy.labpdfproc.egg-info/top_level.txt +0 -0
  39. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/tests/test_fixtures.py +0 -0
  40. {diffpy_labpdfproc-0.3.1rc4 → diffpy_labpdfproc-0.4.0rc0}/tests/test_functions.py +0 -0
@@ -3,7 +3,6 @@ graft tests
3
3
  graft requirements
4
4
 
5
5
  include AUTHORS.rst LICENSE*.rst README.rst
6
- include src/diffpy/labpdfproc/data *
7
6
 
8
7
  # Exclude all bytecode files and __pycache__ directories
9
8
  global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files.
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpy.labpdfproc
3
- Version: 0.3.1rc4
3
+ Version: 0.4.0rc0
4
4
  Summary: Tools for processing x-ray powder diffraction data from laboratory sources.
5
5
  Author-email: Yucong Chen <yc4372@columbia.edu>, Till Schertenleib <ts@chem.ku.dk>, Caden Myers <cjm2304@columbia.edu>, Simon Billinge <sbillinge@ucsb.edu>
6
6
  Maintainer-email: Simon Billinge <sbillinge@ucsb.edu>
7
+ License-Expression: BSD-3-Clause
7
8
  Project-URL: Homepage, https://github.com/diffpy/diffpy.labpdfproc/
8
9
  Project-URL: Issues, https://github.com/diffpy/diffpy.labpdfproc/issues/
9
10
  Keywords: powder XRD,absorption correction,PDF,diffpy
@@ -11,19 +12,16 @@ Classifier: Development Status :: 5 - Production/Stable
11
12
  Classifier: Environment :: Console
12
13
  Classifier: Intended Audience :: Developers
13
14
  Classifier: Intended Audience :: Science/Research
14
- Classifier: License :: OSI Approved :: BSD License
15
15
  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.10
20
- Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Programming Language :: Python :: 3.13
23
21
  Classifier: Programming Language :: Python :: 3.14
24
22
  Classifier: Topic :: Scientific/Engineering :: Physics
25
23
  Classifier: Topic :: Scientific/Engineering :: Chemistry
26
- Requires-Python: <3.15,>=3.10
24
+ Requires-Python: <3.15,>=3.12
27
25
  Description-Content-Type: text/x-rst
28
26
  License-File: LICENSE.rst
29
27
  License-File: AUTHORS.rst
@@ -51,8 +49,8 @@ Dynamic: license-file
51
49
  .. |Black| image:: https://img.shields.io/badge/code_style-black-black
52
50
  :target: https://github.com/psf/black
53
51
 
54
- .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg
55
- :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml
52
+ .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml/badge.svg
53
+ :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml
56
54
 
57
55
  .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.labpdfproc/branch/main/graph/badge.svg
58
56
  :target: https://codecov.io/gh/diffpy/diffpy.labpdfproc
@@ -15,8 +15,8 @@
15
15
  .. |Black| image:: https://img.shields.io/badge/code_style-black-black
16
16
  :target: https://github.com/psf/black
17
17
 
18
- .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg
19
- :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml
18
+ .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml/badge.svg
19
+ :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml
20
20
 
21
21
  .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.labpdfproc/branch/main/graph/badge.svg
22
22
  :target: https://codecov.io/gh/diffpy/diffpy.labpdfproc
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"]
2
+ requires = ["setuptools>=77", "setuptools-git-versioning>=2.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -17,19 +17,18 @@ maintainers = [
17
17
  description = "Tools for processing x-ray powder diffraction data from laboratory sources."
18
18
  keywords = ['powder XRD', 'absorption correction', 'PDF', 'diffpy']
19
19
  readme = "README.rst"
20
- requires-python = ">=3.10, <3.15"
20
+ license = "BSD-3-Clause"
21
+ license-files = ["LICENSE*.rst", "AUTHORS.rst"]
22
+ requires-python = ">=3.12, <3.15"
21
23
  classifiers = [
22
24
  'Development Status :: 5 - Production/Stable',
23
25
  'Environment :: Console',
24
26
  'Intended Audience :: Developers',
25
27
  'Intended Audience :: Science/Research',
26
- 'License :: OSI Approved :: BSD License',
27
28
  'Operating System :: MacOS :: MacOS X',
28
29
  'Operating System :: Microsoft :: Windows',
29
30
  'Operating System :: POSIX',
30
31
  'Operating System :: Unix',
31
- 'Programming Language :: Python :: 3.10',
32
- 'Programming Language :: Python :: 3.11',
33
32
  'Programming Language :: Python :: 3.12',
34
33
  'Programming Language :: Python :: 3.13',
35
34
  'Programming Language :: Python :: 3.14',
@@ -47,18 +46,18 @@ template = "{tag}"
47
46
  dev_template = "{tag}"
48
47
  dirty_template = "{tag}"
49
48
 
50
- [project.scripts]
51
- labpdfproc = "diffpy.labpdfproc.labpdfprocapp:main"
52
-
53
49
  [tool.setuptools.packages.find]
54
50
  where = ["src"] # list of folders that contain the packages (["."] by default)
55
51
  include = ["*"] # package names should match these glob patterns (["*"] by default)
56
52
  exclude = ["diffpy.labpdfproc.tests*"] # exclude packages matching these glob patterns (empty by default)
57
- namespaces = false # to disable scanning PEP 420 namespaces (true by default)
53
+ namespaces = true # to disable scanning PEP 420 namespaces (true by default)
58
54
 
59
55
  [tool.setuptools.package-data]
60
56
  "diffpy.labpdfproc" = ["data/*"]
61
57
 
58
+ [project.scripts]
59
+ labpdfproc = "diffpy.labpdfproc.labpdfprocapp:main"
60
+
62
61
  [tool.setuptools.dynamic]
63
62
  dependencies = {file = ["requirements/pip.txt"]}
64
63
 
@@ -3,3 +3,4 @@ diffpy.utils
3
3
  pandas
4
4
  scipy
5
5
  wxpython
6
+ gooey
@@ -131,20 +131,14 @@ def _add_credit_args(parser, use_gui=False):
131
131
 
132
132
 
133
133
  def _save_corrected(corrected, input_path, args):
134
- outfile = args.output_directory / (input_path.stem + "_corrected.chi")
135
- if outfile.exists() and not args.force:
136
- print(f"WARNING: {outfile} exists. Use --force to overwrite.")
137
- return
134
+ outfile = args.output_directory / (f"{input_path.stem}-mud-corrected.chi")
138
135
  corrected.metadata = corrected.metadata or {}
139
136
  corrected.dump(str(outfile), xtype=args.xtype)
140
137
  print(f"Saved corrected data to {outfile}")
141
138
 
142
139
 
143
140
  def _save_correction(correction, input_path, args):
144
- corrfile = args.output_directory / (input_path.stem + "_cve.chi")
145
- if corrfile.exists() and not args.force:
146
- print(f"WARNING: {corrfile} exists. Use --force to overwrite.")
147
- return
141
+ corrfile = args.output_directory / (f"{input_path.stem}-cve.chi")
148
142
  correction.metadata = correction.metadata or {}
149
143
  correction.dump(str(corrfile), xtype=args.xtype)
150
144
  print(f"Saved correction data to {corrfile}")
@@ -312,7 +306,9 @@ def get_args_gui():
312
306
 
313
307
  def get_args_cli(override=None):
314
308
  parser = create_parser(use_gui=False)
315
- return parser.parse_args(override)
309
+ argv = override if override is not None else sys.argv[1:]
310
+ argv = [arg for arg in argv if arg != "--ignore-gooey"]
311
+ return parser.parse_args(argv)
316
312
 
317
313
 
318
314
  def main():
@@ -113,8 +113,10 @@ def _expand_user_input(args):
113
113
 
114
114
 
115
115
  def set_input_lists(args):
116
- """Set input directory and files. It takes cli inputs, checks if
117
- they are files or directories and creates a list of files to be
116
+ """Set input directory and files.
117
+
118
+ It takes cli inputs, checks if they are files or directories
119
+ and creates a list of files to be
118
120
  processed which is stored in the args Namespace.
119
121
 
120
122
  Parameters
@@ -132,7 +134,6 @@ def set_input_lists(args):
132
134
  args : argparse.Namespace
133
135
  The updated arguments with the modified input list.
134
136
  """
135
-
136
137
  input_paths = []
137
138
  args = _expand_user_input(args)
138
139
  for input_name in args.input:
@@ -224,7 +225,6 @@ def load_wavelength_from_config_file(args):
224
225
  args : argparse.Namespace
225
226
  The updated arguments with the updated wavelength and anode type.
226
227
  """
227
-
228
228
  if args.wavelength is not None:
229
229
  return normalize_wavelength(args)
230
230
 
@@ -453,7 +453,6 @@ def load_user_metadata(args):
453
453
  The updated argparse Namespace
454
454
  with user metadata inserted as key-value pairs.
455
455
  """
456
-
457
456
  reserved_keys = set(vars(args).keys())
458
457
 
459
458
  if args.user_metadata:
@@ -479,10 +478,12 @@ def load_user_metadata(args):
479
478
 
480
479
 
481
480
  def load_user_info(args):
482
- """Load user info into args. If none is provided, call
483
- check_and_build_global_config function from diffpy.utils to prompt
484
- the user for inputs. Otherwise, call get_user_info with the provided
485
- arguments.
481
+ """Load user info into args.
482
+
483
+ If none is provided, call check_and_build_global_config
484
+ function from diffpy.utils to prompt
485
+ the user for inputs. Otherwise, call get_user_info
486
+ with the provided arguments.
486
487
 
487
488
  Parameters
488
489
  ----------
@@ -528,10 +529,33 @@ def load_package_info(args):
528
529
  return args
529
530
 
530
531
 
532
+ def _check_saved_file_exists(args):
533
+ """Check if the output files already exist based on the input paths
534
+ and output directory."""
535
+ existing_files = []
536
+ for path in args.input_paths:
537
+ outfile = args.output_directory / (f"{path.stem}-mud-corrected.chi")
538
+ if outfile.exists() and not args.force:
539
+ existing_files.append(outfile)
540
+ if args.output_correction:
541
+ corrfile = args.output_directory / (f"{path.stem}-cve.chi")
542
+ if corrfile.exists() and not args.force:
543
+ existing_files.append(corrfile)
544
+ if existing_files:
545
+ existing_files_str = "\n".join(str(f) for f in existing_files)
546
+ raise FileExistsError(
547
+ "The following output files already exist:"
548
+ f"\n{existing_files_str}\n"
549
+ "Use --force to overwrite them."
550
+ )
551
+
552
+
531
553
  def preprocessing_args(args):
532
- """Perform preprocessing on the provided args. The process includes
533
- loading package and user information, setting input, output,
534
- wavelength, anode type, xtype, mu*D, and loading user metadata.
554
+ """Perform preprocessing on the provided args.
555
+
556
+ The process includes loading package and user information,
557
+ setting input, output, wavelength, anode type, xtype,
558
+ mu*D, and loading user metadata.
535
559
 
536
560
  Parameters
537
561
  ----------
@@ -542,6 +566,11 @@ def preprocessing_args(args):
542
566
  -------
543
567
  args : argparse.Namespace
544
568
  The updated argparse Namespace with arguments preprocessed.
569
+
570
+ Raises
571
+ ------
572
+ FileExistsError
573
+ If the output files already exist and --force is not used.
545
574
  """
546
575
  args = load_wavelength_from_config_file(args)
547
576
  args = set_mud(args)
@@ -552,6 +581,7 @@ def preprocessing_args(args):
552
581
  args = load_user_metadata(args)
553
582
  args = load_user_info(args)
554
583
  args = load_package_info(args)
584
+ _check_saved_file_exists(args)
555
585
  return args
556
586
 
557
587
 
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpy.labpdfproc
3
- Version: 0.3.1rc4
3
+ Version: 0.4.0rc0
4
4
  Summary: Tools for processing x-ray powder diffraction data from laboratory sources.
5
5
  Author-email: Yucong Chen <yc4372@columbia.edu>, Till Schertenleib <ts@chem.ku.dk>, Caden Myers <cjm2304@columbia.edu>, Simon Billinge <sbillinge@ucsb.edu>
6
6
  Maintainer-email: Simon Billinge <sbillinge@ucsb.edu>
7
+ License-Expression: BSD-3-Clause
7
8
  Project-URL: Homepage, https://github.com/diffpy/diffpy.labpdfproc/
8
9
  Project-URL: Issues, https://github.com/diffpy/diffpy.labpdfproc/issues/
9
10
  Keywords: powder XRD,absorption correction,PDF,diffpy
@@ -11,19 +12,16 @@ Classifier: Development Status :: 5 - Production/Stable
11
12
  Classifier: Environment :: Console
12
13
  Classifier: Intended Audience :: Developers
13
14
  Classifier: Intended Audience :: Science/Research
14
- Classifier: License :: OSI Approved :: BSD License
15
15
  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.10
20
- Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Programming Language :: Python :: 3.13
23
21
  Classifier: Programming Language :: Python :: 3.14
24
22
  Classifier: Topic :: Scientific/Engineering :: Physics
25
23
  Classifier: Topic :: Scientific/Engineering :: Chemistry
26
- Requires-Python: <3.15,>=3.10
24
+ Requires-Python: <3.15,>=3.12
27
25
  Description-Content-Type: text/x-rst
28
26
  License-File: LICENSE.rst
29
27
  License-File: AUTHORS.rst
@@ -51,8 +49,8 @@ Dynamic: license-file
51
49
  .. |Black| image:: https://img.shields.io/badge/code_style-black-black
52
50
  :target: https://github.com/psf/black
53
51
 
54
- .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg
55
- :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov-on-merge-to-main.yml
52
+ .. |CI| image:: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml/badge.svg
53
+ :target: https://github.com/diffpy/diffpy.labpdfproc/actions/workflows/matrix-and-codecov.yml
56
54
 
57
55
  .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.labpdfproc/branch/main/graph/badge.svg
58
56
  :target: https://codecov.io/gh/diffpy/diffpy.labpdfproc
@@ -1,16 +1,7 @@
1
- .codecov.yml
2
- .flake8
3
- .isort.cfg
4
- .pre-commit-config.yaml
5
- .readthedocs.yaml
6
1
  AUTHORS.rst
7
- CHANGELOG.rst
8
- CODE-OF-CONDUCT.rst
9
2
  LICENSE.rst
10
3
  MANIFEST.in
11
4
  README.rst
12
- cookiecutter.json
13
- environment.yml
14
5
  pyproject.toml
15
6
  requirements/build.txt
16
7
  requirements/conda.txt
@@ -13,7 +13,8 @@ def user_filesystem(tmp_path):
13
13
  home_dir.mkdir(parents=True, exist_ok=True)
14
14
  test_dir = base_dir / "test_dir"
15
15
  test_dir.mkdir(parents=True, exist_ok=True)
16
-
16
+ output_dir = base_dir / "output_dir"
17
+ output_dir.mkdir(parents=True, exist_ok=True)
17
18
  chi_data = (
18
19
  "dataformat = twotheta\n mode = "
19
20
  "xray\n # chi_Q chi_I\n 1 2\n 3 4\n 5 6\n 7 8\n"
@@ -59,6 +60,10 @@ def user_filesystem(tmp_path):
59
60
  f.write("good_data.xy \n")
60
61
  f.write(f"{str(input_dir.resolve() / 'good_data.txt')}\n")
61
62
 
63
+ with open(output_dir / "good_data-mud-corrected.chi", "w") as f:
64
+ f.write(chi_data)
65
+ with open(output_dir / "good_data-cve.chi", "w") as f:
66
+ f.write(chi_data)
62
67
  home_config_data = {
63
68
  "wavelength": 0.3,
64
69
  "owner_name": "home_username",
@@ -847,3 +847,38 @@ def test_load_metadata(mocker, user_filesystem, inputs, expected):
847
847
  **expected,
848
848
  }
849
849
  assert actual_metadata == expected_metadata
850
+
851
+
852
+ def test_preprocess_args_bad(user_filesystem, monkeypatch):
853
+ # Case: user tries to run absorption correction, but the output
854
+ # filenames already for *-mud-corrected.chi and *-cve.chi exists.
855
+ # expected: preprocess_args catches this early and raises an Error
856
+ cwd = Path(user_filesystem)
857
+ home_dir = cwd / "home_dir"
858
+ # set cwd so program can find diffpyconfig.json
859
+ monkeypatch.setattr("pathlib.Path.home", lambda _: home_dir)
860
+ input_data_file = str(user_filesystem / "good_data.chi")
861
+ existing_corrected_file = str(
862
+ user_filesystem / "output_dir" / "good_data-mud-corrected.chi"
863
+ )
864
+ existing_corrected_cve_file = str(
865
+ user_filesystem / "output_dir" / "good_data-cve.chi"
866
+ )
867
+ cli_inputs = [
868
+ "mud",
869
+ input_data_file,
870
+ "2.5",
871
+ "-o",
872
+ str(user_filesystem / "output_dir"),
873
+ "-c", # -c flag saves the cve file
874
+ ]
875
+ args = get_args_cli(cli_inputs)
876
+ args = set_input_lists(args)
877
+ msg = (
878
+ "The following output files already exist:"
879
+ f"\n{existing_corrected_file}\n"
880
+ f"{existing_corrected_cve_file}\n"
881
+ "Use --force to overwrite them."
882
+ )
883
+ with pytest.raises(FileExistsError, match=re.escape(msg)):
884
+ preprocessing_args(args)
@@ -1,6 +1,6 @@
1
1
  """Unit tests for __version__.py."""
2
2
 
3
- import diffpy.labpdfproc
3
+ import diffpy.labpdfproc # noqa
4
4
 
5
5
 
6
6
  def test_package_version():
@@ -1,14 +0,0 @@
1
- coverage:
2
- status:
3
- project: # more options at https://docs.codecov.com/docs/commit-status
4
- default:
5
- target: auto # use the coverage from the base commit, fail if coverage is lower
6
- threshold: 0% # allow the coverage to drop by
7
-
8
- comment:
9
- layout: " diff, flags, files"
10
- behavior: default
11
- require_changes: false
12
- require_base: false # [true :: must have a base report to post]
13
- require_head: false # [true :: must have a head report to post]
14
- hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]
@@ -1,13 +0,0 @@
1
- # As of now, flake8 does not natively support configuration via pyproject.toml
2
- # https://github.com/microsoft/vscode-flake8/issues/135
3
- [flake8]
4
- exclude =
5
- .git,
6
- __pycache__,
7
- build,
8
- dist,
9
- docs/source/conf.py
10
- max-line-length = 79
11
- # Ignore some style 'errors' produced while formatting by 'black'
12
- # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
13
- extend-ignore = E203
@@ -1,5 +0,0 @@
1
- [settings]
2
- # Keep import statement below line_length character limit
3
- line_length = 79
4
- multi_line_output = 3
5
- include_trailing_comma = True
@@ -1,66 +0,0 @@
1
- default_language_version:
2
- python: python3
3
- ci:
4
- autofix_commit_msg: |
5
- [pre-commit.ci] auto fixes from pre-commit hooks
6
- autofix_prs: true
7
- autoupdate_branch: "pre-commit-autoupdate"
8
- autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
9
- autoupdate_schedule: monthly
10
- skip: [no-commit-to-branch]
11
- submodules: false
12
- repos:
13
- - repo: https://github.com/pre-commit/pre-commit-hooks
14
- rev: v4.6.0
15
- hooks:
16
- - id: check-yaml
17
- - id: end-of-file-fixer
18
- - id: trailing-whitespace
19
- - id: check-case-conflict
20
- - id: check-merge-conflict
21
- - id: check-toml
22
- - id: check-added-large-files
23
- - repo: https://github.com/psf/black
24
- rev: 24.4.2
25
- hooks:
26
- - id: black
27
- - repo: https://github.com/pycqa/flake8
28
- rev: 7.0.0
29
- hooks:
30
- - id: flake8
31
- - repo: https://github.com/pycqa/isort
32
- rev: 5.13.2
33
- hooks:
34
- - id: isort
35
- args: ["--profile", "black"]
36
- - repo: https://github.com/kynan/nbstripout
37
- rev: 0.7.1
38
- hooks:
39
- - id: nbstripout
40
- - repo: https://github.com/pre-commit/pre-commit-hooks
41
- rev: v4.4.0
42
- hooks:
43
- - id: no-commit-to-branch
44
- name: Prevent Commit to Main Branch
45
- args: ["--branch", "main"]
46
- stages: [pre-commit]
47
- - repo: https://github.com/codespell-project/codespell
48
- rev: v2.3.0
49
- hooks:
50
- - id: codespell
51
- additional_dependencies:
52
- - tomli
53
- # prettier - multi formatter for .json, .yml, and .md files
54
- - repo: https://github.com/pre-commit/mirrors-prettier
55
- rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
56
- hooks:
57
- - id: prettier
58
- additional_dependencies:
59
- - "prettier@^3.2.4"
60
- # docformatter - PEP 257 compliant docstring formatter
61
- - repo: https://github.com/s-weigand/docformatter
62
- rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
63
- hooks:
64
- - id: docformatter
65
- additional_dependencies: [tomli]
66
- args: [--in-place, --config, ./pyproject.toml]
@@ -1,13 +0,0 @@
1
- version: 2
2
-
3
- build:
4
- os: "ubuntu-22.04"
5
- tools:
6
- python: "latest"
7
-
8
- python:
9
- install:
10
- - requirements: requirements/docs.txt
11
-
12
- sphinx:
13
- configuration: docs/source/conf.py
@@ -1,106 +0,0 @@
1
- =============
2
- Release notes
3
- =============
4
-
5
- .. current developments
6
-
7
- 0.3.0
8
- =====
9
-
10
- **Added:**
11
-
12
- * Functionalities to estimate mu*D theoretically.
13
- * Added published reference to ``README.rst``.
14
- * Fast calculation supports values up to muD = 7
15
- * Recookiecut with updated ``scikit-package`` to enable docs preview in PRs.
16
- * Updated package standards to scikit-package 0.3.0.
17
- * Added ``cookiecutter.json`` file for the ``package update`` command.
18
- * Functionality to read wavelength and anode type directly from a diffpy configuration file.
19
- * Utility and example documentation for ``tools`` module.
20
- * Gooey support so that the app can be run with GUI
21
- * Coverage report in each PR
22
- * doi in Readme for papers.
23
- * Support for independent variables other than two-theta.
24
- * new subcommand ``applymud`` to run the original absorption correction process through CLI.
25
- * Utility and example documentation for the main module.
26
- * Added documentation for new CLI updates.
27
- * Documentation for functions module.
28
- * Spelling check via Codespell in pre-commit
29
- * Python 3.13 support
30
- * Functionality in `load_user_info` to enable user to enter an ORCID.
31
-
32
- **Changed:**
33
-
34
- * Default to brute-force computation when muD < 0.5 or > 7.
35
- * Print a warning message instead of error, explicitly stating the input muD value
36
- * Functions that use DiffractionObject` in `diffpy.utils` to follow the new API.
37
- * Workflow for loading wavelength - raise an error when both wavelength and anode type are specified.
38
- * Readme: muD now requires the ``--mud`` flag instead of a required argument.
39
- * Made muD an optional argument and provided different options (manually entry / z-scan file path) for users to specify muD
40
- * Increased the number of significant figures for wavelength and separated values for Ka1 and Ka2.
41
- * hyphens / underscores format according to new scikit-package group standard.
42
- * GitHub workflows for renamed test file.
43
- * Return a ``ValueError`` if no wavelength is found on config file or if its not specified.
44
- * Compartmentalize commands into the subcommands ``mud``, ``zscan``, and ``sample``. See documentation for more info.
45
- * Changed ``doc`` to ``docs`` and ``CODE_OF_CONDUCT.rst`` to ``CODE-OF-CONDUCT.rst`` to comply with scikit-package standards.
46
- * All function docstrings and tests to be more informative, incorporating new ORCID function and improving overall clarity.
47
-
48
- **Fixed:**
49
-
50
- * duplicated wavelength information in output files
51
-
52
- **Removed:**
53
-
54
- * Remove the import of extend_path from pkgutil in diffpy/__init__.py since we are not strictly following the Python namespace package convention.
55
-
56
-
57
- 0.2.0
58
- =====
59
-
60
- **Added:**
61
-
62
- * Support for Python 3.13
63
-
64
- **Removed:**
65
-
66
- * Support for Python 3.10
67
-
68
-
69
- 0.1.3
70
- =====
71
-
72
- **Added:**
73
-
74
- * generate package API doc
75
- * redo cookiecutter to add issue templates and update readme
76
-
77
-
78
- 0.1.2
79
- =====
80
-
81
- **Added:**
82
-
83
- * polynomial interpolation as the default method for cve computation.
84
-
85
- **Fixed:**
86
-
87
- * add PyPI packages under pip.txt
88
-
89
-
90
-
91
- 0.1.1
92
- =====
93
-
94
-
95
-
96
- 0.1.1
97
- =====
98
-
99
-
100
-
101
- 0.1.0
102
- =====
103
-
104
-
105
-
106
- Initial release of labPDFproc. Please see README and documentation for details
@@ -1,133 +0,0 @@
1
- =====================================
2
- Contributor Covenant Code of Conduct
3
- =====================================
4
-
5
- Our Pledge
6
- ----------
7
-
8
- We as members, contributors, and leaders pledge to make participation in our
9
- community a harassment-free experience for everyone, regardless of age, body
10
- size, visible or invisible disability, ethnicity, sex characteristics, gender
11
- identity and expression, level of experience, education, socioeconomic status,
12
- nationality, personal appearance, race, caste, color, religion, or sexual
13
- identity and orientation.
14
-
15
- We pledge to act and interact in ways that contribute to an open, welcoming,
16
- diverse, inclusive, and healthy community.
17
-
18
- Our Standards
19
- -------------
20
-
21
- Examples of behavior that contributes to a positive environment for our
22
- community include:
23
-
24
- * Demonstrating empathy and kindness toward other people
25
- * Being respectful of differing opinions, viewpoints, and experiences
26
- * Giving and gracefully accepting constructive feedback
27
- * Accepting responsibility and apologizing to those affected by our mistakes,
28
- and learning from the experience
29
- * Focusing on what is best not just for us as individuals, but for the overall
30
- community
31
-
32
- Examples of unacceptable behavior include:
33
-
34
- * The use of sexualized language or imagery, and sexual attention or advances of
35
- any kind
36
- * Trolling, insulting or derogatory comments, and personal or political attacks
37
- * Public or private harassment
38
- * Publishing others' private information, such as a physical or email address,
39
- without their explicit permission
40
- * Other conduct which could reasonably be considered inappropriate in a
41
- professional setting
42
-
43
- Enforcement Responsibilities
44
- ----------------------------
45
-
46
- Community leaders are responsible for clarifying and enforcing our standards of
47
- acceptable behavior and will take appropriate and fair corrective action in
48
- response to any behavior that they deem inappropriate, threatening, offensive,
49
- or harmful.
50
-
51
- Community leaders have the right and responsibility to remove, edit, or reject
52
- comments, commits, code, wiki edits, issues, and other contributions that are
53
- not aligned to this Code of Conduct, and will communicate reasons for moderation
54
- decisions when appropriate.
55
-
56
- Scope
57
- -----
58
-
59
- This Code of Conduct applies within all community spaces, and also applies when
60
- an individual is officially representing the community in public spaces.
61
- Examples of representing our community include using an official email address,
62
- posting via an official social media account, or acting as an appointed
63
- representative at an online or offline event.
64
-
65
- Enforcement
66
- -----------
67
-
68
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
69
- reported to the community leaders responsible for enforcement at
70
- sbillinge@ucsb.edu. All complaints will be reviewed and investigated promptly and fairly.
71
-
72
- All community leaders are obligated to respect the privacy and security of the
73
- reporter of any incident.
74
-
75
- Enforcement Guidelines
76
- ----------------------
77
-
78
- Community leaders will follow these Community Impact Guidelines in determining
79
- the consequences for any action they deem in violation of this Code of Conduct:
80
-
81
- 1. Correction
82
- ****************
83
-
84
- **Community Impact**: Use of inappropriate language or other behavior deemed
85
- unprofessional or unwelcome in the community.
86
-
87
- **Consequence**: A private, written warning from community leaders, providing
88
- clarity around the nature of the violation and an explanation of why the
89
- behavior was inappropriate. A public apology may be requested.
90
-
91
- 2. Warning
92
- *************
93
-
94
- **Community Impact**: A violation through a single incident or series of
95
- actions.
96
-
97
- **Consequence**: A warning with consequences for continued behavior. No
98
- interaction with the people involved, including unsolicited interaction with
99
- those enforcing the Code of Conduct, for a specified period of time. This
100
- includes avoiding interactions in community spaces as well as external channels
101
- like social media. Violating these terms may lead to a temporary or permanent
102
- ban.
103
-
104
- 3. Temporary Ban
105
- ******************
106
-
107
- **Community Impact**: A serious violation of community standards, including
108
- sustained inappropriate behavior.
109
-
110
- **Consequence**: A temporary ban from any sort of interaction or public
111
- communication with the community for a specified period of time. No public or
112
- private interaction with the people involved, including unsolicited interaction
113
- with those enforcing the Code of Conduct, is allowed during this period.
114
- Violating these terms may lead to a permanent ban.
115
-
116
- 4. Permanent Ban
117
- ******************
118
-
119
- **Community Impact**: Demonstrating a pattern of violation of community
120
- standards, including sustained inappropriate behavior, harassment of an
121
- individual, or aggression toward or disparagement of classes of individuals.
122
-
123
- **Consequence**: A permanent ban from any sort of public interaction within the
124
- community.
125
-
126
- Attribution
127
- -----------
128
-
129
- This Code of Conduct is adapted from the `Contributor Covenant <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>`_.
130
-
131
- Community Impact Guidelines were inspired by `Mozilla's code of conduct enforcement ladder <https://github.com/mozilla/inclusion>`_.
132
-
133
- For answers to common questions about this code of conduct, see the `FAQ <https://www.contributor-covenant.org/faq>`_. `Translations are available <https://www.contributor-covenant.org/translations>`_
@@ -1,20 +0,0 @@
1
- {
2
- "author_names": "Yucong Chen, Till Schertenleib, Caden Myers, Simon Billinge",
3
- "author_emails": "yc4372@columbia.edu, ts@chem.ku.dk, cjm2304@columbia.edu, sbillinge@ucsb.edu",
4
- "maintainer_names": "Simon Billinge",
5
- "maintainer_emails": "sbillinge@ucsb.edu",
6
- "maintainer_github_usernames": "sbillinge",
7
- "contributors": "Yucong Chen, Till Schertenleib, Caden Myers, Billinge Group members",
8
- "license_holders": "The Trustees of Columbia University in the City of New York",
9
- "project_name": "diffpy.labpdfproc",
10
- "github_username_or_orgname": "diffpy",
11
- "github_repo_name": "diffpy.labpdfproc",
12
- "conda_pypi_package_dist_name": "diffpy.labpdfproc",
13
- "package_dir_name": "diffpy.labpdfproc",
14
- "project_short_description": "Tools for processing x-ray powder diffraction data from laboratory sources.",
15
- "project_keywords": "powder XRD, absorption correction, PDF, diffpy",
16
- "minimum_supported_python_version": "3.12",
17
- "maximum_supported_python_version": "3.14",
18
- "project_needs_c_code_compiled": "No",
19
- "project_has_gui_tests": "No"
20
- }
@@ -1,6 +0,0 @@
1
- name: diffpy.labpdfproc
2
- channels:
3
- - conda-forge
4
- dependencies:
5
- - python=3
6
- - pip