-
Notifications
You must be signed in to change notification settings - Fork 4
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
field filter array dereference #302
base: master
Are you sure you want to change the base?
Conversation
[] how to separate two cases: apply_filter, and apply_index? |
exetera/core/fields.py
Outdated
@@ -143,6 +143,27 @@ def _ensure_valid(self): | |||
if not self._valid_reference: | |||
raise ValueError("This field no longer refers to a valid underlying field object") | |||
|
|||
def __getitem__(self, item:Union[list, tuple, np.ndarray]): | |||
if isinstance(item, slice): | |||
# TODO |
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.
You can forward to the self.data getitem in the general case and then wrap the result in a mem field
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.
The data can be acquired with self.data[slice]
I think, this can then be put into a mem field.
exetera/core/fields.py
Outdated
# TODO | ||
pass | ||
elif isinstance(item, int): | ||
# TODO |
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.
You can get an array of a single value with self.data[[item]]
and then put that into a mem field.
exetera/core/fields.py
Outdated
# TODO | ||
pass | ||
elif isinstance(item, int): | ||
# TODO |
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.
same for this
Codecov Report
@@ Coverage Diff @@
## master #302 +/- ##
==========================================
+ Coverage 83.39% 83.43% +0.04%
==========================================
Files 22 22
Lines 6191 6213 +22
Branches 1247 1252 +5
==========================================
+ Hits 5163 5184 +21
Misses 733 733
- Partials 295 296 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
fix #227