-
Notifications
You must be signed in to change notification settings - Fork 7
Notify user if two datasets with different hashes are compared #219
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
Merged
paulmueller
merged 10 commits into
DC-analysis:master
from
RaghavaAlajangi:dcnum_hash_notification
Jul 30, 2025
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
aaa996d
feat: add dcnum hash mapping and integrate into PipelinePlot redraw
RaghavaAlajangi 47ba05f
fix: improve dcnum hash mapping transformation logic for single eleme…
RaghavaAlajangi 1a59d19
ref: optimize dcnum hash handling by using a hash set and simplifying…
RaghavaAlajangi 052a337
fix: improve hash flag determination logic in get_hash_flag function
RaghavaAlajangi f3cff9e
test: add test for get_hash_flag fucntion
RaghavaAlajangi 4eca74c
enh: implement dynamic hash length logic
RaghavaAlajangi 3112420
update changelog
RaghavaAlajangi e633557
ref: trigger hash flag logic only if hash_set contains multiple hashes
RaghavaAlajangi 302f1fc
enh: instead of valid hash use longest hash
RaghavaAlajangi 7c0fbf3
test: add tests for get_hash_flag function
RaghavaAlajangi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| import numpy as np | ||
| import pathlib | ||
|
|
||
| import dclab | ||
|
|
||
| from shapeout2.gui import pipeline_plot | ||
|
|
||
| datapath = pathlib.Path(__file__).parent / "data" | ||
|
|
||
|
|
||
| def test_compute_contour_opening_angles(): | ||
| contour = [ | ||
|
|
@@ -71,3 +76,26 @@ def test_compute_contour_opening_angles_log_scale(): | |
| angles = pipeline_plot.compute_contour_opening_angles( | ||
| plot_state=plot_state, contour=contour) | ||
| assert np.allclose(angles, np.pi/3) | ||
|
|
||
|
|
||
| def test_get_hash_flag(): | ||
| rtdc_paths = datapath.glob("*.rtdc") | ||
|
Member
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. Please add an |
||
|
|
||
| hash_set = set() | ||
| rtdc_ds_list = [] | ||
| expected = [] | ||
| for path in rtdc_paths: | ||
| ds = dclab.new_dataset(path) | ||
| # get the hash flag | ||
| pipe_config = ds.config.get("pipeline", {}) | ||
| dcnum_hash = pipe_config.get("dcnum hash", None) | ||
| hash_set.add(dcnum_hash) | ||
| expected.append(f"Pipeline: {dcnum_hash[:4]}" if dcnum_hash else None) | ||
| rtdc_ds_list.append(ds) | ||
|
|
||
| assert len(hash_set) == 2 | ||
|
|
||
| for ds, exp in zip(rtdc_ds_list, expected): | ||
| result = pipeline_plot.get_hash_flag(hash_set, ds) | ||
| print(result) | ||
| assert result == exp | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 hash length should be dynamic in all cases. I.e. if the first 4 characters of two hashes are identical, then the hash length should be 5, but if the first 5 characters are identical, then the hash length should be 6 etc. It is very unlikely to happen, but it can happen at some point.
There might be a smart way of achieving this with list comprehensions, but a simple for-loop over the length of the longest hash (incrementing
req_hash_lenand generatingshort_hash_set) with the list/set comprehension you proposed would be good enough.BTW this is a good design, putting the logic of whether to show the text and what text to show in one single method 👍