-
Notifications
You must be signed in to change notification settings - Fork 14
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
add hkls attribute rs.DataSet #286
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #286 +/- ##
==========================================
- Coverage 88.98% 88.78% -0.20%
==========================================
Files 40 40
Lines 2841 2854 +13
==========================================
+ Hits 2528 2534 +6
- Misses 313 320 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I think the concept of this makes a lot of sense. I think having Some questions that will be easy to answer but I'm just writing here as part of my stream of consciousness:
From what I can tell, this all seems fine, though |
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.
Just a few small comments -- overall, looks good
reciprocalspaceship/dataset.py
Outdated
return hkl | ||
|
||
def get_hkls(self): | ||
"""For backwards compatibility retain the get_hkls method in addition to the dataset.hkls attribute""" |
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.
I think this docstring should be more of a method description, rather than a rationale for keeping the method
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.
Okay, I changed it. Let me know if you are okay with the update.
if range_index: | ||
ds = ds.reset_index() | ||
|
||
hmax = 20 |
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.
We have two pytest fixtures (hkls
and dataset_hkl
) that could probably support this test, rather than rolling your own. If the other two are insufficient, maybe we should modify them so that this can be used elsewhere as well?
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.
i don't think these fixtures are appropriate, because the hkls in this case should be matched to the length of the dataset. it might make sense to use them to test the case where the dataset length and hkl length differ.
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.
maybe we could match these hkls to those in data_merged and/or data_unmerged?
This PR makes a
.hkls
attribute forrs.DataSet
instances. The method has a setter to assign new Miller indices. It retains backward compatibility with theget_hkls
method.The use case here is for being able to set new miller indices using an expression like
where hkls can either be a dataset containing the keys 'H', 'K', and 'L' or it could be a numpy array. This saves the user having to reset and set the index.