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-13617: detection: fix restoration of tempWideBackground #105

Merged
merged 1 commit into from Feb 22, 2018

Conversation

PaulPrice
Copy link
Contributor

We weren't restoring the original image because we didn't have a copy
of it.

Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

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

Looks like you may have a critical logic bug in the tests that means that they're not actually testing much. Fix should be simple; hopefully they'll still pass.

Also a few suggestions to reduce verbosity.

@@ -899,7 +899,7 @@ def tempWideBackgroundContext(self, exposure):
doTempWideBackground = self.config.doTempWideBackground
if doTempWideBackground:
self.log.info("Applying temporary wide background subtraction")
original = exposure.maskedImage.image.array[:]
original = exposure.maskedImage.image.array[:].copy()
Copy link
Member

Choose a reason for hiding this comment

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

Could simplify this to

original = exposure.image.array.copy()

rng = np.random.RandomState(123)
original.maskedImage.image.array[:] = rng.normal(size=original.maskedImage.image.array.shape)
original.maskedImage.mask.set(0)
original.maskedImage.variance.set(1.0)
Copy link
Member

Choose a reason for hiding this comment

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

Could similarly make all of these original.(mask|image|variance)....

config.reEstimateBackground = False
config.thresholdType = "pixel_stdev"
config.doTempLocalBackground = False
config.doTempWideBackground = False
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't these be set to the function arguments?

We weren't restoring the original image because we didn't have a copy
of it.
@PaulPrice PaulPrice merged commit 3a37cf4 into master Feb 22, 2018
@ktlim ktlim deleted the tickets/DM-13617 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants