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.
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
864 hi l1b compute coincidence type and time deltas #995
864 hi l1b compute coincidence type and time deltas #995
Changes from 6 commits
8f575a1
92e6bcc
aa8d841
87215f8
c240a7b
0cae67f
5a9fea3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
For me personally I would really appreciate a docstring on each bitmask. Maybe it's overkill for some people, but it helps me to immediately understand the purpose.
Example:
Set the 'A' bit in the 'coincidence_type' variable where:
a_mask
), ORtof_1
is valid (usingtof_1_valid_mask
).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.
My philosophy is that if you need a bunch of comments to explain your code, then the code is not written in a way that it can be clearly understood. IMO, the comments you wrote are exactly what the code says with a slightly different order. For this instance, I think the comment is redundant.
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 that this could be split into two separate steps for clarity:
delta_t_2 = out_ds.tof_2.values[c_mask & tof_1and2_valid_mask].astype(np.float32) * HiConstants.TOF2_TICK_PER_NS
delta_t_1 = out_ds.tof_1.values[c_mask & tof_1and2_valid_mask].astype(np.float32) * HiConstants.TOF1_TICK_PER_NS
out_ds.delta_t_ab.values[c_mask & tof_1and2_valid_mask] = delta_t_2 - delta_t_1
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 could be split for clarity:
delta_t_2 = out_ds.tof_2.values[b_mask & tof_1and2_valid_mask] * HiConstants.TOF2_TICK_PER_NS
delta_t_1 = out_ds.tof_1.values[b_mask & tof_1and2_valid_mask] * HiConstants.TOF1_TICK_PER_NS
out_ds.delta_t_ac1.values[b_mask & tof_1and2_valid_mask] = delta_t_2 - delta_t_1
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 I would split it up:
delta_t_2 = out_ds.tof_2.values[a_mask & tof_1and2_valid_mask] * HiConstants.TOF2_TICK_PER_NS
delta_t_1 = out_ds.tof_1.values[a_mask & tof_1and2_valid_mask] * HiConstants.TOF1_TICK_PER_NS
out_ds.delta_t_bc1.values[a_mask & tof_1_valid_mask & tof_2_valid_mask] = delta_t_2 - delta_t_1
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.
This table is really helpful! I should add something similar for Lo's coincidence types
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.
Great idea to more easily cover the combinations!
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 can't quite take credit... found it on SO.