-
Notifications
You must be signed in to change notification settings - Fork 0
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-17426 #1
base: master
Are you sure you want to change the base?
DM-17426 #1
Changes from 1 commit
7ce5656
b2ebc0a
832078c
773e3a2
a078e08
876d95d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ def makeCameraImage(camera, exposures, filename=None, binning=8): | |
class SkyCorrectionConfig(Config): | ||
"""Configuration for SkyCorrectionTask""" | ||
bgModel = ConfigField(dtype=FocalPlaneBackgroundConfig, doc="Background model") | ||
bgModel2 = ConfigField(dtype=FocalPlaneBackgroundConfig, doc="2nd Background model") | ||
sky = ConfigurableField(target=SkyMeasurementTask, doc="Sky measurement") | ||
maskObjects = ConfigurableField(target=MaskObjectsTask, doc="Mask Objects") | ||
doMaskObjects = Field(dtype=bool, default=True, doc="Mask objects to find good sky?") | ||
|
@@ -51,6 +52,7 @@ class SkyCorrectionConfig(Config): | |
def setDefaults(self): | ||
Config.setDefaults(self) | ||
self.maskObjects.doInterpolate = False | ||
self.bgModel2.doSmooth = True | ||
|
||
def validate(self): | ||
assert not self.maskObjects.doInterpolate | ||
|
@@ -99,7 +101,10 @@ def run(self, expRef): | |
algorithms. We optionally apply: | ||
|
||
1. A large-scale background model. | ||
This step removes very-large-scale sky such as moonlight. | ||
2. A sky frame. | ||
3. A medium-scale background model. | ||
This step removes residual sky (This is smooth on the focal plane). | ||
|
||
Only the master node executes this method. The data is held on | ||
the slave nodes, which do all the hard work. | ||
|
@@ -156,12 +161,30 @@ def run(self, expRef): | |
calibs = pool.mapToPrevious(self.collectSky, dataIdList) | ||
makeCameraImage(camera, calibs, "sky" + extension) | ||
|
||
exposures = self.smoothFocalPlaneSubtraction(camera, pool, dataIdList) | ||
|
||
# Persist camera-level image of calexp | ||
image = makeCameraImage(camera, exposures) | ||
expRef.put(image, "calexp_camera") | ||
|
||
pool.mapToPrevious(self.write, dataIdList) | ||
|
||
def smoothFocalPlaneSubtraction(self, camera, pool, dataIdList): | ||
'''Do 2nd Focal Plane subtraction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use numpydoc style for docstrings. |
||
|
||
After doSky, we get smooth focal plane image. | ||
(Before doSky, sky pistons remain in HSC-G) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is a bit too terse to understand what you mean. |
||
Now make smooth focal plane background and subtract it. | ||
''' | ||
bgModel = FocalPlaneBackground.fromCamera(self.config.bgModel2, camera) | ||
data = [Struct(dataId=dataId, bgModel=bgModel.clone()) for dataId in dataIdList] | ||
bgModelList = pool.mapToPrevious(self.accumulateModel, data) | ||
for ii, bg in enumerate(bgModelList): | ||
self.log.info("Background %d: %d pixels", ii, bg._numbers.array.sum()) | ||
bgModel.merge(bg) | ||
exposures = pool.mapToPrevious(self.subtractModel, dataIdList, bgModel) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same code as before (lines 138-143). Can you factor it into a common method so the code isn't duplicated? |
||
return exposures | ||
|
||
def loadImage(self, cache, dataId): | ||
"""Load original image and restore the sky | ||
|
||
|
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.
Why disable interpolation here? Because you don't want to destroy the image?
It sounds like
doInterpolate
shouldn't be a configuration parameter, but a functional parameter forMaskObjectsTask.run
.