lsst.ip.isr
g28faec7dd2+abea79d9cf
Toggle main menu visibility
Loading...
Searching...
No Matches
python
lsst
ip
isr
masking.py
Go to the documentation of this file.
1
# This file is part of ip_isr.
2
#
3
# Developed for the LSST Data Management System.
4
# This product includes software developed by the LSST Project
5
# (https://www.lsst.org).
6
# See the COPYRIGHT file at the top-level directory of this distribution
7
# for details of code ownership.
8
#
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <https://www.gnu.org/licenses/>.
21
# import os
22
23
__all__ = [
"MaskingConfig"
,
"MaskingTask"
,
"DECamEdgeBleedMaskConfig"
,
"DECamEdgeBleedMaskTask"
]
24
25
from
lsst.pex.config
import
Config, Field
26
from
lsst.pipe.base
import
Task
27
28
from
.
import
isrFunctions
29
30
31
class
MaskingConfig
(Config):
32
doSpecificMasking = Field(
33
dtype=bool,
34
doc=
"Masking configuration."
,
35
default=
False
,
36
)
37
38
39
class
MaskingTask
(Task):
40
"""Perform extra masking for detector issues such as ghosts and glints.
41
"""
42
ConfigClass = MaskingConfig
43
_DefaultName =
"isrMasking"
44
45
def
run
(self, exposure):
46
"""Mask a known bad region of an exposure.
47
48
Parameters
49
----------
50
exposure : `lsst.afw.image.Exposure`
51
Exposure to construct detector-specific masks for.
52
53
Returns
54
-------
55
status : scalar
56
This task is currently not implemented, and should be
57
retargeted by a camera specific version.
58
"""
59
return
60
61
62
class
DECamEdgeBleedMaskConfig(Config):
63
satMinArea = Field(
64
dtype=int,
65
doc=
"Minimum area (pixels) of a saturated footprint to be an edge bleed candidate."
,
66
default=10000,
67
)
68
satMaxArea = Field(
69
dtype=int,
70
doc=
"Maximum area (pixels, exclusive) of a saturated footprint to be an edge bleed candidate."
,
71
default=100000,
72
)
73
approachRows = Field(
74
dtype=int,
75
doc=
"Saturated footprint must come within this many rows of the read edge."
,
76
default=20,
77
)
78
nSigma = Field(
79
dtype=float,
80
doc=
"A pixel is counted as depressed if it is below sky by more than this many sigma."
,
81
default=5.0,
82
)
83
nRowsCheck = Field(
84
dtype=int,
85
doc=
"Number of rows from the read edge used to confirm an edge bleed."
,
86
default=20,
87
)
88
minLowPixelsPerRow = Field(
89
dtype=int,
90
doc=(
"Mean depressed pixels per row over the check rows required (exceeded) to confirm an "
91
"edge bleed. Read-edge rows with fewer usable pixels than this are skipped before the "
92
"check rows start."
),
93
default=30,
94
)
95
minLowPixelsExtent = Field(
96
dtype=int,
97
doc=(
"Depressed pixels a row must have (more than this) to count toward the edge bleed "
98
"height. Should be smaller than minLowPixelsPerRow."
),
99
default=10,
100
)
101
marginFraction = Field(
102
dtype=float,
103
doc=(
"Extra rows masked beyond the measured edge bleed height, as a fraction of that height "
104
"(plus one row)."
),
105
default=0.125,
106
)
107
saturatedMaskName = Field(
108
dtype=str,
109
doc=
"Name of mask plane holding saturated pixels; must match the parent ISR task."
,
110
default=
"SAT"
,
111
)
112
113
def
validate
(self):
114
super().
validate
()
115
if
self.
minLowPixelsExtent
>= self.
minLowPixelsPerRow
:
116
raise
ValueError(
"minLowPixelsExtent must be smaller than minLowPixelsPerRow."
)
117
118
119
class
DECamEdgeBleedMaskTask
(
MaskingTask
):
120
"""Mask DECam-style edge bleeds: depressed rows next to the read register
121
below a large saturated star.
122
123
Intended as a retarget for ``IsrTaskConfig.masking`` (enabled with
124
``doCameraSpecificMasking``). Must run after saturation masking.
125
"""
126
ConfigClass = DECamEdgeBleedMaskConfig
127
_DefaultName =
"decamEdgeBleedMask"
128
129
def
run
(self, exposure):
130
"""Mask edge bleeds in every amplifier of an exposure.
131
132
Parameters
133
----------
134
exposure : `lsst.afw.image.Exposure`
135
Assembled exposure with saturation already masked. The mask
136
plane is modified in place.
137
"""
138
isrFunctions.maskDECamEdgeBleed(
139
exposure,
140
satMinArea=self.config.satMinArea,
141
satMaxArea=self.config.satMaxArea,
142
approachRows=self.config.approachRows,
143
nSigma=self.config.nSigma,
144
nRowsCheck=self.config.nRowsCheck,
145
minLowPixelsPerRow=self.config.minLowPixelsPerRow,
146
minLowPixelsExtent=self.config.minLowPixelsExtent,
147
marginFraction=self.config.marginFraction,
148
saturatedMaskName=self.config.saturatedMaskName,
149
log=self.log,
150
)
lsst::ip::isr.masking.DECamEdgeBleedMaskConfig.minLowPixelsExtent
minLowPixelsExtent
Definition
masking.py:95
lsst::ip::isr.masking.DECamEdgeBleedMaskConfig.minLowPixelsPerRow
minLowPixelsPerRow
Definition
masking.py:88
lsst::ip::isr.masking.DECamEdgeBleedMaskConfig.validate
validate(self)
Definition
masking.py:113
lsst::ip::isr.masking.DECamEdgeBleedMaskTask
Definition
masking.py:119
lsst::ip::isr.masking.DECamEdgeBleedMaskTask.run
run(self, exposure)
Definition
masking.py:129
lsst::ip::isr.masking.MaskingConfig
Definition
masking.py:31
lsst::ip::isr.masking.MaskingTask
Definition
masking.py:39
lsst::ip::isr.masking.MaskingTask.run
run(self, exposure)
Definition
masking.py:45
lsst::pex::config
Generated on
for lsst.ip.isr by
1.17.0