-
Notifications
You must be signed in to change notification settings - Fork 7
make dwa filtering within a dte not sorted by name by default but only if using a True argument #46
Conversation
…y if using a True argument
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 5.0.x_dev #46 +/- ##
==========================================
Coverage 76.49% 76.50%
==========================================
Files 17 17
Lines 3795 3796 +1
==========================================
+ Hits 2903 2904 +1
Misses 892 892 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
see PyMoDAQ/pymodaq_data#46 for a patch on the subject
malik-irain
left a comment
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.
Lots of comments to suggest renaming sort_name with sort_by_name
src/pymodaq_data/data.py
Outdated
| return dims | ||
|
|
||
| def get_data_from_source(self, source: DataSource, deepcopy=False) -> DataToExport: | ||
| def get_data_from_source(self, source: DataSource, deepcopy=False, sort_name=False) -> DataToExport: |
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 would have named the new parameter sort_by_name as it feels a more "boolean" name than sort_name that could seem to mean it needs a sort algorithm name
src/pymodaq_data/data.py
Outdated
| """ | ||
| source = enum_checker(DataSource, source) | ||
| return self.get_data_from_attribute('source', source, deepcopy=deepcopy) | ||
| return self.get_data_from_attribute('source', source, deepcopy=deepcopy, sort_name=sort_name) |
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 here
src/pymodaq_data/data.py
Outdated
| def get_data_from_attribute(self, attribute: str, | ||
| attribute_value: Any, | ||
| deepcopy=False, | ||
| sort_name=False) -> DataToExport: |
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 here
| deepcopy: bool | ||
| If True, the returned data are deepcopied from the original | ||
| sort_name: bool | ||
| If True the returned data are sorted alphabetically using their name, default is False |
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 here
src/pymodaq_data/data.py
Outdated
| selection = find_objects_in_list_from_attr_name_val(self.data, attribute, attribute_value, | ||
| return_first=False) | ||
| selection.sort(key=lambda elt: elt[0].name) | ||
| if sort_name: |
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 here
src/pymodaq_data/data.py
Outdated
| return DataToExport(name=self.name, data=data) | ||
|
|
||
| def get_data_from_dim(self, dim: DataDim, deepcopy=False) -> DataToExport: | ||
| def get_data_from_dim(self, dim: DataDim, deepcopy=False, sort_name=False) -> DataToExport: |
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 here
src/pymodaq_data/data.py
Outdated
| """ | ||
| dim = enum_checker(DataDim, dim) | ||
| return self.get_data_from_attribute('dim', dim, deepcopy=deepcopy) | ||
| return self.get_data_from_attribute('dim', dim, deepcopy=deepcopy, sort_name=sort_name) |
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 here
src/pymodaq_data/data.py
Outdated
| return self.get_data_from_attribute('dim', dim, deepcopy=deepcopy, sort_name=sort_name) | ||
|
|
||
| def get_data_from_dims(self, dims: List[DataDim], deepcopy=False) -> DataToExport: | ||
| def get_data_from_dims(self, dims: List[DataDim], deepcopy=False, sort_name=False) -> DataToExport: |
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 here
src/pymodaq_data/data.py
Outdated
| data = DataToExport(name=self.name) | ||
| for dim in dims: | ||
| data.append(self.get_data_from_dim(dim, deepcopy=deepcopy)) | ||
| data.append(self.get_data_from_dim(dim, deepcopy=deepcopy, sort_name=sort_name)) |
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 here
tests/data_test.py
Outdated
| data.append(dat4) | ||
| assert data.get_data_from_dim(data_mod.DataDim['Data2D']).data == [dat1, dat4] | ||
| assert data.get_data_from_dim(data_mod.DataDim.Data2D).data == [dat1, dat4] | ||
| assert data.get_data_from_dim(data_mod.DataDim.Data2D, sort_name=True).data == [dat4, dat1] |
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 here
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.
ok will do!
see PyMoDAQ/pymodaq_data#46 for a patch on the subject
Was creating a bug in the ordering of data plotted by bayesian and adaptive extensions