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-13260: Support construction of new HSC calibs #109

Merged
merged 8 commits into from
Jan 29, 2018
1 change: 1 addition & 0 deletions config/assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
config.doMaskBrightObjects = True
config.removeMaskPlanes.append("CROSSTALK")
config.doNImage = True
config.badMaskPlanes += ["SUSPECT"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there anything else we currently flag as SUSPECT? We will now be masking those, maybe we should have also been doing it before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SUPSECT is also used to mask pixels that are beyond linearity but not saturated. I don't think that there are actually such pixels in practise in HSC, but they should always be masked.


from lsst.pipe.tasks.selectImages import PsfWcsSelectImagesTask
config.select.retarget(PsfWcsSelectImagesTask)
1 change: 1 addition & 0 deletions config/hsc/bias.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
config.isr.retarget(SubaruIsrTask)
config.isr.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "isr.py"))
config.isr.doBrighterFatter = False
config.isr.doStrayLight = False
1 change: 1 addition & 0 deletions config/hsc/dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
config.repair.cosmicray.min_DN = 50.0

config.isr.doBrighterFatter = False
config.isr.doStrayLight = False
1 change: 1 addition & 0 deletions config/hsc/flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
config.combination.vignette.load(os.path.join(getPackageDir("obs_subaru"), 'config', 'hsc', 'vignette.py'))

config.isr.doBrighterFatter = False
config.isr.doStrayLight = False
1 change: 1 addition & 0 deletions config/hsc/isr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
config.doDark = True # Required especially around CCD 33
config.doFringe = True
config.fringe.filters = ['y', 'N921', 'N926', 'N973', 'N1010']
config.fringe.stats.badMaskPlanes += ["SUSPECT"] # stray light correction unavailable
config.doWrite = False
config.doCrosstalk = True
config.doGuider = False
Expand Down
7 changes: 6 additions & 1 deletion python/lsst/obs/hsc/makeHscRawVisitInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ def setArgDict(self, md, argDict):
self.popAngle(md, "RA2000", units=astropy.units.h),
self.popAngle(md, "DEC2000"),
)
altitude = self.popAngle(md, "ALTITUDE")
if altitude > 90*degrees: # Sometimes during day observations, when not tracking
if self.log is not None:
self.log.warn("Clipping altitude (%f) at 90 degrees", altitude)
altitude = 90*degrees
argDict["boresightAzAlt"] = Coord(
self.popAngle(md, "AZIMUTH"),
self.popAngle(md, "ALTITUDE"),
altitude,
)
argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS")
argDict["observatory"] = self.observatory
Expand Down
16 changes: 12 additions & 4 deletions python/lsst/obs/subaru/isr.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,18 @@ def writeThumbnail(self, dataRef, dataset, exposure):
stats = afwMath.makeStatistics(binnedImage,
afwMath.MEDIAN | afwMath.STDEVCLIP | afwMath.MAX, statsCtrl)
low = stats.getValue(afwMath.MEDIAN) - self.config.thumbnailStdev*stats.getValue(afwMath.STDEVCLIP)
makeRGB(binnedImage, binnedImage, binnedImage, minimum=low, dataRange=self.config.thumbnailRange,
Q=self.config.thumbnailQ, fileName=filename,
saturatedBorderWidth=self.config.thumbnailSatBorder,
saturatedPixelValue=stats.getValue(afwMath.MAX))
try:
makeRGB(binnedImage, binnedImage, binnedImage, minimum=low, dataRange=self.config.thumbnailRange,
Q=self.config.thumbnailQ, fileName=filename,
saturatedBorderWidth=self.config.thumbnailSatBorder,
saturatedPixelValue=stats.getValue(afwMath.MAX))
except Exception as exc:
# makeRGB can fail with:
# SystemError: <built-in method flush of _io.BufferedWriter object at 0x2b2a0081c938>
# returned a result with an error set
# This unhelpful error comes from the bowels of matplotlib, so not much we can do about it
# except keep it from being fatal.
self.log.warn("Unable to write thumbnail for %s: %s", dataRef.dataId, exc)

def measureOverscan(self, ccdExposure, amp):
clipSigma = 3.0
Expand Down
10 changes: 8 additions & 2 deletions python/lsst/obs/subaru/strayLight/yStrayLight.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def run(self, sensorRef, exposure):
if filterName != 'y':
# No correction to be made
return
if sensorRef.dataId["ccd"] in range(104, 112):
# No correction data: assume it's zero
return

# The LEDs that are causing the Y straylight have not been covered yet (on 2017-11-27),
# but they will be covered in the near future.
Expand Down Expand Up @@ -113,9 +116,12 @@ def run(self, sensorRef, exposure):
amp = exposure.getDetector()[ii]
box = amp.getBBox()
isBad[box.getBeginY():box.getEndY(), box.getBeginX():box.getEndX()] = True
model[isBad] = numpy.median(model[~isBad])
mask = exposure.getMaskedImage().getMask()
mask.array[isBad] |= mask.getPlaneBitMask("BAD")
if numpy.all(isBad):
model[:] = 0.0
else:
model[isBad] = numpy.median(model[~isBad])
mask.array[isBad] |= mask.getPlaneBitMask("SUSPECT")

model *= exposure.getInfo().getVisitInfo().getExposureTime()
exposure.image.array -= model
Expand Down