Coverage for src/ufig/plugins/convert_photons_to_adu.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.10.5, created at 2025-08-27 15:54 +0000

1# Copyright (c) 2013 ETH Zurich, Institute of Astronomy, Lukas Gamper 

2# <lukas.gamper@usystems.ch> 

3""" 

4Created on Aug 19, 2014 

5@author: Chihway Chang 

6""" 

7 

8from ivy.plugin.base_plugin import BasePlugin 

9 

10 

11class Plugin(BasePlugin): 

12 """ 

13 Convert integer photon counts into float ADU's by multiplying the quantum efficiency 

14 and dividing gain. 

15 

16 :param gain: gain of CCD detector (e/ADU) 

17 :return: image that is rescaled to some specified zero point 

18 """ 

19 

20 def __call__(self): 

21 # rescale zero point 

22 self.ctx.image /= self.ctx.parameters.gain 

23 

24 if hasattr(self.ctx, "image_mask"): 

25 self.ctx.image[~self.ctx.image_mask] = 0 

26 

27 def __str__(self): 

28 return "convert photons to ADUs"