Skip to content

Commit 6169620

Browse files
committed
Use insert_scattering_quantity for now before PR merged
1 parent cd53586 commit 6169620

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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 'input_data' to modify '{attribute}'.",
33+
f"Please use 'insert_scattering_quantity' 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.input_data(xarray, yarray, xtype)
58+
self.insert_scattering_quantity(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 input_data(
330+
def insert_scattering_quantity(
331331
self,
332332
xarray,
333333
yarray,
@@ -361,7 +361,7 @@ def input_data(
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 'input_data' "
364+
"Please re-initialize 'DiffractionObject' or re-run the method 'insert_scattering_quantity' "
365365
"with 'xarray' and 'yarray' of identical length."
366366
)
367367

tests/test_diffraction_objects.py

Lines changed: 4 additions & 4 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 'input_data' to modify 'all_arrays'.",
369+
"Please use 'insert_scattering_quantity' to modify 'all_arrays'.",
370370
):
371371
actual_do.all_arrays = np.empty((4, 4))
372372

@@ -383,7 +383,7 @@ def test_id_setter():
383383
# Attempt to directly modify the property
384384
with pytest.raises(
385385
AttributeError,
386-
match="Direct modification of attribute 'id' is not allowed. Please use 'input_data' to modify 'id'.",
386+
match="Direct modification of attribute 'id' is not allowed. Please use 'insert_scattering_quantity' to modify 'id'.",
387387
):
388388
do.id = uuid.uuid4()
389389

@@ -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 'input_data' "
395+
"Please re-initialize 'DiffractionObject' or re-run the method 'insert_scattering_quantity' "
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 'input_data' to modify 'input_xtype'.",
413+
"Please use 'insert_scattering_quantity' to modify 'input_xtype'.",
414414
):
415415
do.input_xtype = "q"
416416

0 commit comments

Comments
 (0)