11import datetime
2+ import uuid
23import warnings
34from copy import deepcopy
45
@@ -29,7 +30,7 @@ def _xtype_wmsg(xtype):
2930def _setter_wmsg (attribute ):
3031 return (
3132 f"Direct modification of attribute '{ attribute } ' is not allowed. "
32- f"Please use 'insert_scattering_quantity ' to modify '{ attribute } '." ,
33+ f"Please use 'input_data ' to modify '{ attribute } '." ,
3334 )
3435
3536
@@ -53,7 +54,8 @@ def __init__(
5354 if yarray is None :
5455 yarray = np .empty (0 )
5556
56- self .insert_scattering_quantity (xarray , yarray , xtype )
57+ self ._id = uuid .uuid4 ()
58+ self .input_data (xarray , yarray , xtype )
5759
5860 def __eq__ (self , other ):
5961 if not isinstance (other , DiffractionObject ):
@@ -205,6 +207,14 @@ def input_xtype(self):
205207 def input_xtype (self , _ ):
206208 raise AttributeError (_setter_wmsg ("input_xtype" ))
207209
210+ @property
211+ def id (self ):
212+ return self ._id
213+
214+ @id .setter
215+ def id (self , _ ):
216+ raise AttributeError (_setter_wmsg ("id" ))
217+
208218 def set_angles_from_list (self , angles_list ):
209219 self .angles = angles_list
210220 self .n_steps = len (angles_list ) - 1.0
@@ -317,7 +327,7 @@ def _set_xarrays(self, xarray, xtype):
317327 self .dmin = np .nanmin (self ._all_arrays [:, 3 ], initial = np .inf )
318328 self .dmax = np .nanmax (self ._all_arrays [:, 3 ], initial = 0.0 )
319329
320- def insert_scattering_quantity (
330+ def input_data (
321331 self ,
322332 xarray ,
323333 yarray ,
@@ -351,7 +361,7 @@ def insert_scattering_quantity(
351361 if len (xarray ) != len (yarray ):
352362 raise ValueError (
353363 "'xarray' and 'yarray' must have the same length. "
354- "Please re-initialize 'DiffractionObject' or re-run the method 'insert_scattering_quantity ' "
364+ "Please re-initialize 'DiffractionObject' or re-run the method 'input_data ' "
355365 "with 'xarray' and 'yarray' of identical length."
356366 )
357367
0 commit comments