Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 19
Rename id to uuid in DiffractionObject#271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1a2214f209a19458242502f293c0ceba7f92d1c104b198d6698a3028File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
| * <news item> | ||
| **Changed:** | ||
| * DiffractionObject's "id" property renamed to "uuid" | ||
| **Deprecated:** | ||
| * <news item> | ||
| **Removed:** | ||
| * <news item> | ||
| **Fixed:** | ||
| * <news item> | ||
| **Security:** | ||
| * <news item> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -46,12 +46,6 @@ class DiffractionObject: | ||
| Attributes | ||
| ---------- | ||
| all_arrays : ndarray | ||
| The array containing the quantity of q, tth, d values. | ||
| input_xtype : str | ||
| The type of the independent variable in `xarray`. Must be one of {*XQUANTITIES} | ||
| id : uuid | ||
| The unique identifier for the diffraction object. | ||
| scat_quantity : str | ||
| The type of scattering experiment (e.g., "x-ray", "neutron"). Default is an empty string "". | ||
| wavelength : float | ||
| @@ -127,7 +121,7 @@ def __init__( | ||
| >>> print(do.metadata) | ||
| """ | ||
| self._id = uuid.uuid4() | ||
| self._uuid = uuid.uuid4() | ||
| self._input_data(xarray, yarray, xtype, wavelength, scat_quantity, name, metadata) | ||
| def _input_data(self, xarray, yarray, xtype, wavelength, scat_quantity, name, metadata): | ||
| @@ -284,6 +278,23 @@ def __rtruediv__(self, other): | ||
| @property | ||
| def all_arrays(self): | ||
| """The 2D array containing `xarray` and `yarray` values. | ||
| Returns | ||
| ------- | ||
| ndarray | ||
| The shape (len(data), 4) 2D array with columns containing the `yarray` (intensity) | ||
| and the `xarray` values in q, tth, and d. | ||
| Examples | ||
| -------- | ||
| To access specific arrays individually, use these slices: | ||
| >>> my_do.all_arrays[:, 0] # yarray | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add "To access specific arrays individually, use these slices:"? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a stray y-array at the end of the line :( ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry - fixed now: | ||
| >>> my_do.all_arrays[:, 1] # xarray in q | ||
| >>> my_do.all_arrays[:, 2] # xarray in tth | ||
| >>> my_do.all_arrays[:, 3] # xarray in d | ||
| """ | ||
| return self._all_arrays | ||
| @all_arrays.setter | ||
| @@ -292,19 +303,33 @@ def all_arrays(self, _): | ||
| @property | ||
| def input_xtype(self): | ||
| """The type of the independent variable in `xarray`. | ||
| Returns | ||
| ------- | ||
| str | ||
| The type of `xarray`, which must be one of {*XQUANTITIES}. | ||
| """ | ||
| return self._input_xtype | ||
| @input_xtype.setter | ||
| def input_xtype(self, _): | ||
| raise AttributeError(_setter_wmsg("input_xtype")) | ||
| @property | ||
| def id(self): | ||
| return self._id | ||
| def uuid(self): | ||
| """The unique identifier for the DiffractionObject instance. | ||
| Returns | ||
| ------- | ||
| uuid | ||
| The unique identifier of the DiffractionObject instance. | ||
| """ | ||
| return self._uuid | ||
| @id.setter | ||
| def id(self, _): | ||
| raise AttributeError(_setter_wmsg("id")) | ||
| @uuid.setter | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while User still has access to | ||
| def uuid(self, _): | ||
| raise AttributeError(_setter_wmsg("uuid")) | ||
| def get_array_index(self, value, xtype=None): | ||
| """Return the index of the closest value in the array associated with | ||
| @@ -319,7 +344,8 @@ def get_array_index(self, value, xtype=None): | ||
| Returns | ||
| ------- | ||
| the index of the value in the array | ||
| list | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's check. Logically, this should return an int not a list. Let's check and maybe update the function/tesnts, or understand why it returns a list and change the name. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, I created a separate issue for this since it's beyond the scope of this PR. I will look into this. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| The list containing the index of the closest value in the array. | ||
| """ | ||
| xtype = self._input_xtype | ||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are marked with
@property- docstrings are provided separately (please see below)