Skip to content
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

Fix bugs in per-round-max-decoder #1602

Merged
merged 1 commit into from
Oct 8, 2019
Merged

Conversation

ttung
Copy link
Collaborator

@ttung ttung commented Oct 4, 2019

  1. When the entire row is nan, the decoder chokes. This is remedied by decoding on an array where the nan values are replaced with 0s.
  2. When the entire row is of equal intensity, the np.argmax arbitrarily picks the first column as the winner. That erroneously decodes as ch=0 having the max intensity. This code detects that scenario, and rewrites the ch to an impossible value in that situation.

Test plan: Wrote tests that failed with the existing code, applied fixes and verified that they now work.
Depends on #1600
Fixes #1485

@codecov-io
Copy link

codecov-io commented Oct 4, 2019

Codecov Report

Merging #1602 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1602      +/-   ##
==========================================
+ Coverage   87.47%   87.48%   +0.01%     
==========================================
  Files         145      145              
  Lines        5053     5058       +5     
==========================================
+ Hits         4420     4425       +5     
  Misses        633      633
Impacted Files Coverage Δ
starfish/core/codebook/codebook.py 96.75% <100%> (+0.1%) ⬆️
starfish/test/full_pipelines/api/test_iss_api.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35e8880...735eac9. Read the comment docs.

@ttung ttung force-pushed the tonytung-per-max-round-decoder branch from a29ddc6 to b7ba31c Compare October 4, 2019 06:05
Copy link
Member

@ambrosejcarr ambrosejcarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, Tony. Can you check the correlation between our results and the ones provided by Mats in the ISS notebook? Interested to know if we do any better, or if this edge case doesn't operate there.

intensities_without_nans = intensities.fillna(0)
max_channels = intensities_without_nans.argmax(Axes.CH.value)
# this snippet of code finds all the (feature, round) spots that have uniform illumination,
# and assigns them to a ch number that's one larger than max possible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# and assigns them to a ch number that's one larger than max possible.
# and assigns them to a ch number that's one larger than max possible to ensure that.
# such spots decode to `nan`.

@ttung ttung changed the base branch from tonytung-fix-dims-alltest to master October 4, 2019 17:52
@ttung ttung force-pushed the tonytung-per-max-round-decoder branch from b7ba31c to 735eac9 Compare October 4, 2019 17:53
1. When the entire row is nan, the decoder chokes.  This is remedied by decoding on an array where the nan values are replaced with 0s.
2. When the entire row is of equal intensity, the `np.argmax` arbitrarily picks the first column as the winner.  That erroneously decodes as ch=0 having the max intensity.  This code detects that scenario, and rewrites the ch to an impossible value in that situation.

Test plan: Wrote tests that failed with the existing code, applied fixes and verified that they now work.
Fixes #1485
@ttung ttung force-pushed the tonytung-per-max-round-decoder branch from 735eac9 to fd8c098 Compare October 8, 2019 22:31
@ttung ttung merged commit 505f73c into master Oct 8, 2019
@ttung ttung deleted the tonytung-per-max-round-decoder branch October 8, 2019 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decoding method in seqFISH
4 participants