diffpy.utils 3.6.1rc0__tar.gz → 3.6.1rc1__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.
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/PKG-INFO +2 -2
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/README.rst +1 -1
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/diffraction_objects.py +10 -7
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/PKG-INFO +2 -2
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/SOURCES.txt +1 -1
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_diffraction_objects.py +36 -6
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/AUTHORS.rst +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/LICENSE.rst +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/LICENSE_DANSE.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/MANIFEST.in +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/pyproject.toml +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/requirements/build.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/requirements/conda.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/requirements/docs.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/requirements/pip.txt +0 -0
- /diffpy_utils-3.6.1rc0/requirements/test.txt → /diffpy_utils-3.6.1rc1/requirements/tests.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/setup.cfg +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/__init__.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/__init__.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/parsers/__init__.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/parsers/custom_exceptions.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/parsers/loaddata.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/parsers/serialization.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/resampler.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/tools.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/transforms.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/validators.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/version.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/wx/__init__.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/wx/gridutils.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/dependency_links.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/requires.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/top_level.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/conftest.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_loaddata.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_resample.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_serialization.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_tools.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_transforms.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_validators.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/test_version.py +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/dbload/e1.gr +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/dbload/e2.gr +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/dbload/e3.gr +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/generated_db.json +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/generatewarnings.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/loaddata01.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/loaddatawithheaders.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/loadfile.txt +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/strumining.json +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/targetjson.json +0 -0
- {diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/tests/testdata/wrong.type +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffpy.utils
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.1rc1
|
|
4
4
|
Summary: General utilities for analyzing diffraction data
|
|
5
5
|
Author-email: Simon Billinge <sb2896@columbia.edu>
|
|
6
6
|
Maintainer-email: Simon Billinge <sb2896@columbia.edu>
|
|
@@ -169,7 +169,7 @@ trying to commit again.
|
|
|
169
169
|
|
|
170
170
|
Improvements and fixes are always appreciated.
|
|
171
171
|
|
|
172
|
-
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/
|
|
172
|
+
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE-OF-CONDUCT.rst>`_.
|
|
173
173
|
|
|
174
174
|
Contact
|
|
175
175
|
-------
|
|
@@ -136,7 +136,7 @@ trying to commit again.
|
|
|
136
136
|
|
|
137
137
|
Improvements and fixes are always appreciated.
|
|
138
138
|
|
|
139
|
-
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/
|
|
139
|
+
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE-OF-CONDUCT.rst>`_.
|
|
140
140
|
|
|
141
141
|
Contact
|
|
142
142
|
-------
|
|
@@ -409,17 +409,17 @@ class DiffractionObject:
|
|
|
409
409
|
def uuid(self, _):
|
|
410
410
|
raise AttributeError(_setter_wmsg("uuid"))
|
|
411
411
|
|
|
412
|
-
def get_array_index(self,
|
|
413
|
-
"""Return the index of the closest value in the array associated with
|
|
412
|
+
def get_array_index(self, xvalue, xtype=None):
|
|
413
|
+
f"""Return the index of the closest value in the array associated with
|
|
414
414
|
the specified xtype and the value provided.
|
|
415
415
|
|
|
416
416
|
Parameters
|
|
417
417
|
----------
|
|
418
|
-
xtype : str
|
|
419
|
-
The type of the independent variable in `xarray`. Must be one
|
|
420
|
-
of {*XQUANTITIES}.
|
|
421
418
|
xvalue : float
|
|
422
419
|
The value of the xtype to find the closest index for.
|
|
420
|
+
xtype : str, optional
|
|
421
|
+
The type of the independent variable in `xarray`. Must be one
|
|
422
|
+
of {*XQUANTITIES, }. Default is {self._input_xtype}
|
|
423
423
|
|
|
424
424
|
Returns
|
|
425
425
|
-------
|
|
@@ -427,8 +427,11 @@ class DiffractionObject:
|
|
|
427
427
|
The index of the closest value in the array associated with the
|
|
428
428
|
specified xtype and the value provided.
|
|
429
429
|
"""
|
|
430
|
-
|
|
431
|
-
|
|
430
|
+
if xtype is None:
|
|
431
|
+
xtype = self._input_xtype
|
|
432
|
+
else:
|
|
433
|
+
if xtype not in XQUANTITIES:
|
|
434
|
+
raise ValueError(_xtype_wmsg(xtype))
|
|
432
435
|
xarray = self.on_xtype(xtype)[0]
|
|
433
436
|
if len(xarray) == 0:
|
|
434
437
|
raise ValueError(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffpy.utils
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.1rc1
|
|
4
4
|
Summary: General utilities for analyzing diffraction data
|
|
5
5
|
Author-email: Simon Billinge <sb2896@columbia.edu>
|
|
6
6
|
Maintainer-email: Simon Billinge <sb2896@columbia.edu>
|
|
@@ -169,7 +169,7 @@ trying to commit again.
|
|
|
169
169
|
|
|
170
170
|
Improvements and fixes are always appreciated.
|
|
171
171
|
|
|
172
|
-
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/
|
|
172
|
+
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE-OF-CONDUCT.rst>`_.
|
|
173
173
|
|
|
174
174
|
Contact
|
|
175
175
|
-------
|
|
@@ -376,8 +376,8 @@ def test_scale_to_bad(org_do_args, target_do_args, scale_inputs):
|
|
|
376
376
|
},
|
|
377
377
|
0,
|
|
378
378
|
),
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
# C2: Target value lies in the array, expect the closest index
|
|
380
|
+
( # 1. xtype(tth) is equal to self._input_xtype(tth)
|
|
381
381
|
{
|
|
382
382
|
"wavelength": 4 * np.pi,
|
|
383
383
|
"xarray": np.array([30, 60]),
|
|
@@ -390,7 +390,7 @@ def test_scale_to_bad(org_do_args, target_do_args, scale_inputs):
|
|
|
390
390
|
},
|
|
391
391
|
0,
|
|
392
392
|
),
|
|
393
|
-
(
|
|
393
|
+
( # 2. use default xtype(equal to self._input_xtype)
|
|
394
394
|
{
|
|
395
395
|
"wavelength": 4 * np.pi,
|
|
396
396
|
"xarray": np.array([30, 60]),
|
|
@@ -398,11 +398,24 @@ def test_scale_to_bad(org_do_args, target_do_args, scale_inputs):
|
|
|
398
398
|
"xtype": "tth",
|
|
399
399
|
},
|
|
400
400
|
{
|
|
401
|
-
"xtype":
|
|
402
|
-
"value":
|
|
401
|
+
"xtype": None,
|
|
402
|
+
"value": 45,
|
|
403
403
|
},
|
|
404
404
|
0,
|
|
405
405
|
),
|
|
406
|
+
( # 3. xtype(q) is different from self._input_xtype(tth)
|
|
407
|
+
{
|
|
408
|
+
"wavelength": 4 * np.pi,
|
|
409
|
+
"xarray": np.array([30, 60]),
|
|
410
|
+
"yarray": np.array([1, 2]),
|
|
411
|
+
"xtype": "tth",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"xtype": "q",
|
|
415
|
+
"value": 0.5,
|
|
416
|
+
},
|
|
417
|
+
1,
|
|
418
|
+
),
|
|
406
419
|
# C3: Target value out of the range, expect the closest index
|
|
407
420
|
( # 1. Test with xtype of "q"
|
|
408
421
|
{
|
|
@@ -435,12 +448,13 @@ def test_scale_to_bad(org_do_args, target_do_args, scale_inputs):
|
|
|
435
448
|
def test_get_array_index(do_args, get_array_index_inputs, expected_index):
|
|
436
449
|
do = DiffractionObject(**do_args)
|
|
437
450
|
actual_index = do.get_array_index(
|
|
438
|
-
get_array_index_inputs["
|
|
451
|
+
get_array_index_inputs["value"], get_array_index_inputs["xtype"]
|
|
439
452
|
)
|
|
440
453
|
assert actual_index == expected_index
|
|
441
454
|
|
|
442
455
|
|
|
443
456
|
def test_get_array_index_bad():
|
|
457
|
+
# empty array in DiffractionObject
|
|
444
458
|
do = DiffractionObject(
|
|
445
459
|
wavelength=2 * np.pi,
|
|
446
460
|
xarray=np.array([]),
|
|
@@ -454,6 +468,22 @@ def test_get_array_index_bad():
|
|
|
454
468
|
),
|
|
455
469
|
):
|
|
456
470
|
do.get_array_index(xtype="tth", xvalue=30)
|
|
471
|
+
# non-existing xtype
|
|
472
|
+
do = DiffractionObject(
|
|
473
|
+
wavelength=4 * np.pi,
|
|
474
|
+
xarray=np.array([30, 60]),
|
|
475
|
+
yarray=np.array([1, 2]),
|
|
476
|
+
xtype="tth",
|
|
477
|
+
)
|
|
478
|
+
non_existing_xtype = "non_existing_xtype"
|
|
479
|
+
with pytest.raises(
|
|
480
|
+
ValueError,
|
|
481
|
+
match=re.escape(
|
|
482
|
+
f"I don't know how to handle the xtype, '{non_existing_xtype}'. "
|
|
483
|
+
f"Please rerun specifying an xtype from {*XQUANTITIES, }"
|
|
484
|
+
),
|
|
485
|
+
):
|
|
486
|
+
do.get_array_index(xtype=non_existing_xtype, xvalue=30)
|
|
457
487
|
|
|
458
488
|
|
|
459
489
|
def test_dump(tmp_path, mocker):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/diffpy_utils-3.6.1rc0/requirements/test.txt → /diffpy_utils-3.6.1rc1/requirements/tests.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy/utils/parsers/custom_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diffpy_utils-3.6.1rc0 → diffpy_utils-3.6.1rc1}/src/diffpy.utils.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|