Skip to content

Commit

Permalink
Pass in a config to ContextNoiseReplacer
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Oct 31, 2024
1 parent cff96dd commit 8017ff8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion metadetect/lsst/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def run(self, mbexp, show=False):
sources = result.sources
self.deblend.run(detexp, sources)

with ContextNoiseReplacer(detexp, sources, self.rng) as replacer:
with ContextNoiseReplacer(
detexp, sources, self.rng, config=self.meas.config.noiseReplacer
) as replacer:

for source in sources:

Expand Down
11 changes: 6 additions & 5 deletions metadetect/lsst/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ContextNoiseReplacer(object):
# do something
"""

def __init__(self, exposure, sources, rng, noise_image=None):
def __init__(self, exposure, sources, rng, config=None, noise_image=None):
from lsst.meas.base import NoiseReplacerConfig, NoiseReplacer
import lsst.afw.detection as afw_det

Expand All @@ -40,11 +40,12 @@ def __init__(self, exposure, sources, rng, noise_image=None):
# making the field the same for all metacal images we reduce variance in
# the calculation of the response

config = NoiseReplacerConfig()
if config is None:
config = NoiseReplacerConfig()

# TODO DM needs to fix the crash
# config.noiseSource = 'variance'
config.noiseSeedMultiplier = rng.randint(0, 2**24)
# TODO DM needs to fix the crash
# config.noiseSource = 'variance'
config.noiseSeedMultiplier = rng.randint(0, 2**24)

if noise_image is None:
# TODO remove_poisson should be true for real data
Expand Down

0 comments on commit 8017ff8

Please sign in to comment.