| 1 | /*  Caracteristique du CCD      Reza  03/95  -*- C++ -*- */ | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef DYNCCD_H_SEEN | 
|---|
| 4 | #define DYNCCD_H_SEEN | 
|---|
| 5 |  | 
|---|
| 6 | #include "machdefs.h" | 
|---|
| 7 | #include "pexceptions.h" | 
|---|
| 8 | #include "cimage.h" | 
|---|
| 9 | #include "ppersist.h" | 
|---|
| 10 |  | 
|---|
| 11 | namespace SOPHYA { | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | //! Readout and photon noise calculation for images | 
|---|
| 15 | class DynCCD | 
|---|
| 16 | { | 
|---|
| 17 | public : | 
|---|
| 18 | enum {kConstantNoise = 0, kPhotonNoise, kSigFondNoise, kSqrtADUNoise}; | 
|---|
| 19 |  | 
|---|
| 20 | int_4 TypNoise;      // Type de calcul du bruit | 
|---|
| 21 | r_8 MinADU,MaxADU;   // Valeur min et max des pixels | 
|---|
| 22 | r_8 Gain;            // Gain en electron/ADU | 
|---|
| 23 | r_8 RONoise;         // Bruit de lecture en electron | 
|---|
| 24 | r_8 RefFond;         // Fond de ciel de ref (TypNoise=2) | 
|---|
| 25 | r_8 RefSFond;        // Sigma du fond  (TypNoise=2) */ | 
|---|
| 26 |  | 
|---|
| 27 | /*    ===>  Les methodes   */ | 
|---|
| 28 | DynCCD(int_4 typ=0, r_8 min=-9.e19, r_8 max=9.e19, | 
|---|
| 29 | r_8 g=1., r_8 ron=0., r_8 rf=0., r_8 rfs=0.); | 
|---|
| 30 |  | 
|---|
| 31 | void Set(int_4 typ=0, r_8 min=-9.e19, r_8 max=9.e19, | 
|---|
| 32 | r_8 g=1., r_8 ron=0., r_8 rf=0., r_8 rfs=0.); | 
|---|
| 33 | void Print(); | 
|---|
| 34 | r_8 Noise(r_8 pixel) const; | 
|---|
| 35 | }; | 
|---|
| 36 |  | 
|---|
| 37 | } // Fin du namespace | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | //! Return an image corresponding to the noise described by \b dynccd | 
|---|
| 41 | template <class T> | 
|---|
| 42 | Image<T> NoiseImage(Image<T> const & pim, DynCCD const & dynccd); | 
|---|
| 43 |  | 
|---|
| 44 | //! Add noise to the image | 
|---|
| 45 | template <class T> | 
|---|
| 46 | void ImgAddNoise(Image<T>&, DynCCD const&); | 
|---|
| 47 |  | 
|---|
| 48 | // Les entrees-sortie | 
|---|
| 49 |  | 
|---|
| 50 | inline POutPersist& operator << (POutPersist& c, DynCCD const& data) | 
|---|
| 51 | { | 
|---|
| 52 | c.PutI4(data.TypNoise); | 
|---|
| 53 | c.PutR8s(&data.MinADU, 6); | 
|---|
| 54 | return c; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | inline | 
|---|
| 58 | PInPersist& operator >> (PInPersist& c, DynCCD& data) | 
|---|
| 59 | { | 
|---|
| 60 | c.GetI4(data.TypNoise); | 
|---|
| 61 | c.GetR8s(&data.MinADU, 6); | 
|---|
| 62 | return c; | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 | #endif | 
|---|