Skip to content

Commit 1916d97

Browse files
committed
Merge branch 'main' of https://github.com/diffpy/diffpy.utils into uuid
2 parents 6169620 + 5f67f6c commit 1916d97

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

news/mv-input-scattering-quan.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* Rename `input_scattering_quantity` to `input_data` in `DiffractionObject` init
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/utils/diffraction_objects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _xtype_wmsg(xtype):
3030
def _setter_wmsg(attribute):
3131
return (
3232
f"Direct modification of attribute '{attribute}' is not allowed. "
33-
f"Please use 'insert_scattering_quantity' to modify '{attribute}'.",
33+
f"Please use 'input_data' to modify '{attribute}'.",
3434
)
3535

3636

@@ -55,7 +55,7 @@ def __init__(
5555
yarray = np.empty(0)
5656

5757
self._id = uuid.uuid4()
58-
self.insert_scattering_quantity(xarray, yarray, xtype)
58+
self.input_data(xarray, yarray, xtype)
5959

6060
def __eq__(self, other):
6161
if not isinstance(other, DiffractionObject):
@@ -327,7 +327,7 @@ def _set_xarrays(self, xarray, xtype):
327327
self.dmin = np.nanmin(self._all_arrays[:, 3], initial=np.inf)
328328
self.dmax = np.nanmax(self._all_arrays[:, 3], initial=0.0)
329329

330-
def insert_scattering_quantity(
330+
def input_data(
331331
self,
332332
xarray,
333333
yarray,
@@ -361,7 +361,7 @@ def insert_scattering_quantity(
361361
if len(xarray) != len(yarray):
362362
raise ValueError(
363363
"'xarray' and 'yarray' must have the same length. "
364-
"Please re-initialize 'DiffractionObject' or re-run the method 'insert_scattering_quantity' "
364+
"Please re-initialize 'DiffractionObject' or re-run the method 'input_data' "
365365
"with 'xarray' and 'yarray' of identical length."
366366
)
367367

tests/test_diffraction_objects.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def test_all_array_setter():
366366
with pytest.raises(
367367
AttributeError,
368368
match="Direct modification of attribute 'all_arrays' is not allowed. "
369-
"Please use 'insert_scattering_quantity' to modify 'all_arrays'.",
369+
"Please use 'input_data' to modify 'all_arrays'.",
370370
):
371371
actual_do.all_arrays = np.empty((4, 4))
372372

@@ -392,7 +392,7 @@ def test_xarray_yarray_length_mismatch():
392392
with pytest.raises(
393393
ValueError,
394394
match="'xarray' and 'yarray' must have the same length. "
395-
"Please re-initialize 'DiffractionObject' or re-run the method 'insert_scattering_quantity' "
395+
"Please re-initialize 'DiffractionObject' or re-run the method 'input_data' "
396396
"with 'xarray' and 'yarray' of identical length",
397397
):
398398
DiffractionObject(xarray=np.array([1.0, 2.0]), yarray=np.array([0.0, 0.0, 0.0]))
@@ -410,7 +410,7 @@ def test_input_xtype_setter():
410410
with pytest.raises(
411411
AttributeError,
412412
match="Direct modification of attribute 'input_xtype' is not allowed. "
413-
"Please use 'insert_scattering_quantity' to modify 'input_xtype'.",
413+
"Please use 'input_data' to modify 'input_xtype'.",
414414
):
415415
do.input_xtype = "q"
416416

0 commit comments

Comments
 (0)