Skip to content

Commit be4928b

Browse files
committed
Updated PixelResponseNonUniformity docstring; updated test to conditionally assert plot creation based on PLOTS flag. (like in test_PSF.py)
1 parent ec11007 commit be4928b

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

scopesim/effects/electronic/noise.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,34 @@ def plot_hist(self, det, **kwargs):
135135

136136

137137
class PixelResponseNonUniformity(Effect):
138-
"""Per-pixel gain variation (PRNU).
138+
"""Pixel Response Non-Uniformity (PRNU).
139+
140+
Models the fixed pattern of per-pixel gain variations across the detector
141+
arising from manufacturing differences in quantum efficiency. Each pixel is
142+
multiplied by a gain factor drawn from N(1, ``prnu_std``) keyed by detector ID.
143+
The gain map is generated once per detector on first use and reused identically
144+
across all subsequent exposures.
145+
146+
Parameters
147+
----------
148+
prnu_std : float or dict
149+
Standard deviation of the per-pixel gain distribution.
150+
151+
prnu_seed : int, fixed
152+
153+
include: "!DET.include_prnu"
154+
155+
Example
156+
--------
157+
158+
- name: prnu
159+
description: Pixel response non-uniformity
160+
class: PixelResponseNonUniformity
161+
kwargs:
162+
prnu_std: 0.001
163+
prnu_seed: 42
164+
include: "!DET.include_prnu"
139165
140-
Multiplies each pixel by a gain factor drawn from N(1, prnu_std).
141-
The map is generated once per detector and reused across exposures.
142-
``prnu_std`` may be a float or a dict keyed by detector ID.
143166
"""
144167

145168
required_keys: ClassVar[set] = set()

scopesim/tests/tests_effects/test_prnu.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import matplotlib.pyplot as plt
1+
from matplotlib import pyplot as plt
22
import numpy as np
33
import pytest
44

55
from scopesim.detector import Detector
66
from scopesim.effects.electronic import PixelResponseNonUniformity
77
from scopesim.optics.image_plane_utils import header_from_list_of_xy
88

9+
PLOTS = False
910

1011
def make_detector(value=1000, size=10):
1112
hdr = header_from_list_of_xy([-size/2, size/2], [-size/2, size/2], 1, "D")
@@ -68,4 +69,5 @@ def test_plot_raises_before_simulation(self):
6869
def test_plot_returns_figure(self):
6970
prnu = PixelResponseNonUniformity(prnu_std=0.01, prnu_seed=42)
7071
prnu.apply_to(make_detector())
71-
assert isinstance(prnu.plot(), plt.Figure)
72+
if PLOTS:
73+
assert isinstance(prnu.plot(), plt.Figure)

0 commit comments

Comments
 (0)