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

Tickets/dm 8145 #61

Merged
merged 1 commit into from May 9, 2017
Merged

Tickets/dm 8145 #61

merged 1 commit into from May 9, 2017

Conversation

djreiss
Copy link
Contributor

@djreiss djreiss commented Apr 28, 2017

No description provided.

Copy link
Contributor

@isullivan isullivan left a comment

Choose a reason for hiding this comment

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

My only significant concern after reading through everything is the kernel filtering hack you include twice (e.g. line 401 of zogy.py). I suspect there will be use cases that will want some form of kernel filtering, so I recommend you write a function to replace the existing code.

import unittest

from builtins import range
from past.builtins import basestring
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we are supposed to avoid past.builtins at all costs. Also, it doesn't look like range or basestring is actually used anywhere, so they should be removed.

#import lsst.afw.geom as afwGeom
import lsst.afw.math as afwMath
#import lsst.meas.algorithms as measAlg
import lsst.daf.base as dafBase
Copy link
Contributor

Choose a reason for hiding this comment

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

dafBase appears to not be used anywhere, so should be removed. Also remove the commented-out imports.

del self.im2ex

def _compareExposures(self, D_F, D_R, Scorr=False, tol=0.02):
"""Tests to compare the two images (diffim's or Scorr's). See below.
Copy link
Contributor

Choose a reason for hiding this comment

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

My flake8 would like a blank line between the summary line and the description. Here, and for many other docstrings.


from .imageMapReduce import (ImageMapReduceConfig, ImageMapperSubtask, ImageMapperSubtaskConfig)

__all__ = ("ZogyTask", "ZogyConfig",
Copy link
Contributor

Choose a reason for hiding this comment

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

__all__ should be a list, not a tuple. Using a tuple can lead to some very odd errors in some cases.

import lsst.pipe.base as pipeBase
import lsst.log

from .imageMapReduce import (ImageMapReduceConfig, ImageMapperSubtask, ImageMapperSubtaskConfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these imports need to be inside a tuple?

return pipeBase.Struct(subExposure=subExposure)

psf1b = psf2b = None
if True and psf1.shape[0] == 41: # it's a measured psf (hack!) Note this *really* helps for measured psfs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're using this code again, it really should be a separate kernelFilter function. In that function, the size of the zero-padding should be configurable, but could have a default of 10 as you use here.
I don't think testing against the size of the psf equalling 41 is safe. Measured psfs will have a wide range of sizes.

@@ -165,7 +165,10 @@ class ImageReducerSubtaskConfig(pexConfig.Config):
"sum": """add pixels from overlaps (probably never wanted; used for testing)
into correct location in new exposure""",
"average": """same as copy, but also average pixels from overlapped regions
(NaNs ignored)"""
(NaNs ignored)""",
Copy link
Contributor

Choose a reason for hiding this comment

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

On line 31 above, afwMath is imported but not used.

@@ -115,19 +115,19 @@ def makeFakeImages(xim=None, yim=None, svar=0.04, tvar=0.04, psf1=3.3, psf2=2.2,
print(np.sqrt(psf1[0]**2 - psf2[0]**2))
print('Offset:', offset)

xim = np.arange(-256, 256, 1) if xim is None else xim
xim = np.arange(-128, 128, 1) if xim is None else xim
Copy link
Contributor

Choose a reason for hiding this comment

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

Please define a variable to store the value 128, and reference that here (and line 195)

import lsst.daf.base as dafBase
import testImageDecorrelation as testID # for makeFakeImages

from lsst.ip.diffim.zogy import (ZogyTask, ZogyConfig, ZogyMapReduceConfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this import need to be a tuple?

n_sources=10, psf_yvary_factor=varyPsf,
seed=666, verbose=False)
# Create an array corresponding to the "expected" subtraction (noise only)
np.random.seed(666)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're setting this seed and the keyword seed on line 74 above to the same value, you should define seed = 666 as a variable and reference that in both places.

Bug fixes; return an Exposure

D, S calc in Fourier/Real space all working

Refactor astrometric variance calc

Add debug features to imageMapReduce

Zogy/ImageMapperSubtask working

Refactor some params into config

Add docstrings

Initial start of zogy unit tests

Small bug fixes to image-space found due to tests

Completed all unit tests

Add kwargs to propagate varAst params

Make test images smaller; noise reproduceable

Simplify simulated image size parameterization

Updates; improve fakeImage func; remove nan/inf before FFT

Update Kr,Kn kernel filtering
@djreiss djreiss merged commit 9647295 into master May 9, 2017
@ktlim ktlim deleted the tickets/DM-8145 branch August 25, 2018 06:44
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.

None yet

2 participants