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

DM-24556: Add normalize method to Defects #36

Merged
merged 1 commit into from
May 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 13 additions & 21 deletions tests/test_defects.py
Expand Up @@ -131,7 +131,6 @@ def check_maskBlocks(self, inputDefects, expectedDefects):
task = cpPipe.defects.FindDefectsTask(config=config)

defectsWithColumns = task.maskBlocksIfIntermitentBadPixelsInColumn(inputDefects)

Copy link
Collaborator

Choose a reason for hiding this comment

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

As always, try not to do whitespace only changes.

boxesMeasured = []
for defect in defectsWithColumns:
boxesMeasured.append(defect.getBBox())
Expand Down Expand Up @@ -214,6 +213,7 @@ def test_maskBlocks_discontigous_to_single_block(self):
Box2I(corner=Point2I(30, 34), dimensions=Extent2I(1, 15))]
for badBox in badPixels:
defects.append(badBox)

Copy link
Collaborator

Choose a reason for hiding this comment

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

And again.

self.check_maskBlocks(defects, expectedDefects)

def test_maskBlocks_discontigous_less_than_thresholds(self):
Expand Down Expand Up @@ -348,8 +348,7 @@ def test_maskBlocks_blobs_one_side_good_less_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(60, 1), dimensions=Extent2I(1, 29)),
Box2I(corner=Point2I(61, 2), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(62, 2), dimensions=Extent2I(1, 12))]
Comment on lines -351 to -352
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason this is being removed? I guess this comment applies to all the test changes. Presumably they're necessary, but could you briefly just explain why please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The expected defects before these changes where individual boxes, even if they were adjacent. With the changes, the boxes get merged into fewer boxes that have a wider extension (for example, 2 pixels in one direction instead of 1).

Box2I(corner=Point2I(61, 2), dimensions=Extent2I(2, 12))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(60, 1), dimensions=Extent2I(1, 18)),
Box2I(corner=Point2I(60, 20), dimensions=Extent2I(1, 10)),
Expand All @@ -370,8 +369,7 @@ def test_maskBlocks_blobs_other_side_good_less_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(70, 1), dimensions=Extent2I(1, 29)),
Box2I(corner=Point2I(68, 2), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(69, 2), dimensions=Extent2I(1, 12))]
Box2I(corner=Point2I(68, 2), dimensions=Extent2I(2, 12))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(70, 1), dimensions=Extent2I(1, 18)),
Box2I(corner=Point2I(70, 20), dimensions=Extent2I(1, 10)),
Expand All @@ -392,10 +390,8 @@ def test_maskBlocks_blob_both_sides_good_less_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(75, 1), dimensions=Extent2I(1, 29)),
Box2I(corner=Point2I(73, 2), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(74, 2), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(76, 2), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(77, 2), dimensions=Extent2I(1, 12))]
Box2I(corner=Point2I(73, 2), dimensions=Extent2I(2, 12)),
Box2I(corner=Point2I(76, 2), dimensions=Extent2I(2, 12))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(75, 1), dimensions=Extent2I(1, 18)),
Box2I(corner=Point2I(75, 20), dimensions=Extent2I(1, 10)),
Expand All @@ -418,8 +414,8 @@ def test_maskBlocks_blob_one_side_good_greater_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(80, 1), dimensions=Extent2I(1, 29)),
Box2I(corner=Point2I(81, 2), dimensions=Extent2I(1, 2)),
Box2I(corner=Point2I(81, 8), dimensions=Extent2I(1, 8))]
Box2I(corner=Point2I(81, 2), dimensions=Extent2I(2, 2)),
Box2I(corner=Point2I(81, 8), dimensions=Extent2I(2, 8))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(80, 1), dimensions=Extent2I(1, 18)),
Box2I(corner=Point2I(80, 20), dimensions=Extent2I(1, 10)),
Expand All @@ -440,8 +436,8 @@ def test_maskBlocks_other_side_good_greater_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(87, 1), dimensions=Extent2I(1, 29)),
Box2I(corner=Point2I(85, 2), dimensions=Extent2I(1, 2)),
Box2I(corner=Point2I(85, 8), dimensions=Extent2I(1, 8))]
Box2I(corner=Point2I(85, 2), dimensions=Extent2I(2, 2)),
Box2I(corner=Point2I(85, 8), dimensions=Extent2I(2, 8))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(87, 1), dimensions=Extent2I(1, 18)),
Box2I(corner=Point2I(87, 20), dimensions=Extent2I(1, 10)),
Expand All @@ -462,14 +458,10 @@ def test_maskBlocks_both_sides_good_greater_than_threshold(self):
"""

expectedDefects = [Box2I(corner=Point2I(93, 1), dimensions=Extent2I(1, 34)),
Box2I(corner=Point2I(91, 2), dimensions=Extent2I(1, 7)),
Box2I(corner=Point2I(91, 18), dimensions=Extent2I(1, 9)),
Box2I(corner=Point2I(92, 2), dimensions=Extent2I(1, 7)),
Box2I(corner=Point2I(92, 18), dimensions=Extent2I(1, 9)),
Box2I(corner=Point2I(94, 2), dimensions=Extent2I(1, 7)),
Box2I(corner=Point2I(94, 18), dimensions=Extent2I(1, 9)),
Box2I(corner=Point2I(95, 2), dimensions=Extent2I(1, 7)),
Box2I(corner=Point2I(95, 18), dimensions=Extent2I(1, 9))]
Box2I(corner=Point2I(91, 2), dimensions=Extent2I(2, 7)),
Box2I(corner=Point2I(91, 18), dimensions=Extent2I(2, 9)),
Box2I(corner=Point2I(94, 2), dimensions=Extent2I(2, 7)),
Box2I(corner=Point2I(94, 18), dimensions=Extent2I(2, 9))]
defects = self.allDefectsList
badPixels = [Box2I(corner=Point2I(93, 1), dimensions=Extent2I(1, 12)),
Box2I(corner=Point2I(93, 15), dimensions=Extent2I(1, 20)),
Expand Down