13#include "../../improc/imageTransforms.hpp"
14#include "../../math/randomT.hpp"
16#include "wavefront.hpp"
33template <
typename _realT>
83 void qe(
const realT &q );
87 void darkCurrent(
const realT &dc );
91 void ron(
const realT &r );
95 void cic(
const realT &c );
99 void gain(
const realT &g );
103 void expTime(
const realT &dt );
107 void rows(
const int &r );
111 void cols(
const int &c );
113 void setSize(
const int &r,
const int &c );
117 void noNoise(
bool nn );
130 template<
typename imageTout,
typename imageTin>
136template <
typename realT>
137ccdDetector<realT>::ccdDetector()
169template <
typename realT>
175template <
typename realT>
181template <
typename realT>
182realT ccdDetector<realT>::darkCurrent()
184 return m_darkCurrent;
187template <
typename realT>
188void ccdDetector<realT>::darkCurrent(
const realT &dc )
193template <
typename realT>
194realT ccdDetector<realT>::ron()
199template <
typename realT>
200void ccdDetector<realT>::ron(
const realT &r )
205template <
typename realT>
206realT ccdDetector<realT>::cic()
211template <
typename realT>
212void ccdDetector<realT>::cic(
const realT &c )
217template <
typename realT>
218realT ccdDetector<realT>::gain()
223template <
typename realT>
224void ccdDetector<realT>::gain(
const realT &g )
229template <
typename realT>
230realT ccdDetector<realT>::expTime()
235template <
typename realT>
236void ccdDetector<realT>::expTime(
const realT &dt )
241template <
typename realT>
242int ccdDetector<realT>::rows()
247template <
typename realT>
248void ccdDetector<realT>::rows(
const int &r )
253template <
typename realT>
254int ccdDetector<realT>::cols()
259template <
typename realT>
260void ccdDetector<realT>::cols(
const int &c )
265template <
typename realT>
266void ccdDetector<realT>::setSize(
const int &r,
const int &c )
272template <
typename realT>
273bool ccdDetector<realT>::noNoise()
278template <
typename realT>
279void ccdDetector<realT>::noNoise(
bool nn )
284template <
typename realT>
285template<
typename imageTout,
typename imageTin>
289 using poisson_param_t =
typename std::poisson_distribution<int>::param_type;
290 using gamma_param_t =
typename std::gamma_distribution<realT>::param_type;
294 out.resize( m_rows, m_cols );
305 for(
int j = 0; j < m_cols; ++j )
307 for(
int i = 0; i < m_rows; ++i )
309 realT charge = ( out( i, j ) * m_qe + m_darkCurrent ) * m_expTime + m_cic;
313 out( i, j ) = charge + m_normVar * sqrt( charge );
317 m_poissonVar.distribution.param( poisson_param_t{ charge } );
318 out( i, j ) = m_poissonVar;
323 m_gammaVar.distribution.param( gamma_param_t{ out( i, j ), m_gain } );
325 out( i, j ) = m_gammaVar;
330 out( i, j ) += m_normVar * m_ron;
335 out( i, j ) /= m_gain;
A simulated CCD detector.
realT m_ron
The readout noise, electrons per pixel per read #include "mx/randomT.hpp".
realT m_darkCurrent
The dark current, per pixel per second.
realT m_qe
The quantum efficiency.
realT qe()
Get the current value of qe.
realT m_cic
EMCCD clock induced charge, electrons per pixel per read.
int m_cols
The detector size, in columns.
void exposeImage(imageTout &out, imageTin &in)
Rebin and add noise to the input image, placing the result in the output image.
realT m_expTime
The exposure time, in seconds.
norm_distT m_normVar
Gets normal-distributed variates.
gamma_distT m_gammaVar
Gets gamma distributed variates.
int m_rows
The detector size, in rows.
poisson_distT m_poissonVar
Gets Poisson distributed variates.
bool m_noNoise
If true no noise is added to the exposed image.
realT m_gain
Electron multiplication gain. If >1, then EMCCD is modeled.
A random number type, which functions like any other arithmetic type.
constexpr units::realT c()
The speed of light.
Structure containing the phase and amplitude of a wavefront.