CFEL - ASG Software Suite  2.5.0
CASS
pixel_detector_calibration.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Lutz Foucar
2 
3 /**
4  * @file pixel_detector_calibration.h processors that do calibrations on pixel
5  * detector data
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _PIXELDETECTORCALIBRATION_H_
11 #define _PIXELDETECTORCALIBRATION_H_
12 
13 #include <valarray>
14 
15 #include "processor.h"
16 
18 
19 namespace cass
20 {
21 //forward declaration
22 class CASSEvent;
23 
24 /** pixel detector calibrations
25  *
26  * @PPList "330": pixel detector calibrations
27  *
28  * @see Processor for a list of all commonly available cass.ini
29  * settings.
30  *
31  * @cassttng Processor/\%name\%/{RawImage} \n
32  * the raw image of the pixel detector
33  * @cassttng Processor/\%name\%/{OutputFilename} \n
34  * the name of the file where the calibration will be written to.
35  * Default is "NotSet", in which case a filename will be automatically
36  * generated from the time and name of the Processor and a link to
37  * the autogenerated file name will be created which has the same name
38  * but without the time.
39  * @cassttng Processor/\%name\%/{WriteCal} \n
40  * Flag to tell whether the calibration should be written. Default is
41  * true.
42  * @cassttng Processor/\%name\%/{Train} \n
43  * Flag to tell whether training should be done. Default is true
44  * @cassttng Processor/\%name\%/{NbrTrainingImages} \n
45  * The Number of images used for the training. Default is 200
46  * @cassttng Processor/\%name\%/{SNR} \n
47  * The signal to noise value that indicates whether a pixel is an
48  * outlier of the distribution of pixels in the trainingset and
49  * should not be considered. Default is 4.
50  * @cassttng Processor/\%name\%/{SNRNoiseAutoBoundaries} \n
51  * The signal to noise ratio for determining the boundary values of
52  * bad pixels from the noise map. If this value is negative the manual
53  * set values will be taken from the values below. Otherwise the mean
54  * value and the standart deviation of all noise values will be
55  * calculated and boundaries are set to
56  * \f$ bound_{upper} = mean + (SNRNoiseAutoBoundaries * stdv) \f$
57  * \f$ bound_{lower} = mean - (SNRNoiseAutoBoundaries * stdv) \f$
58  * Default is 4.
59  * @cassttng Processor/\%name\%/{SNRNoiseAutoBoundariesStat} \n
60  * In case of using auto generation of the boundaries this signal to \
61  * noise ratio determines which values will be taken when calculating
62  * the mean and stdv of the distribution. Default is 4.
63  * @cassttng Processor/\%name\%/{NoiseLowerBoundary|NoiseUpperBoundary} \n
64  * In case the SNRNoiseAutoBoundaries is negative these values will be
65  * taken to determine the bad pixels from the noise map.
66  * Default is 0|3.
67  * @cassttng Processor/\%name\%/{SNROffsetAutoBoundaries} \n
68  * The signal to noise ratio for determining the boundary values of
69  * bad pixels from the offset map. If this value is negative the manual
70  * set values will be taken from the values below. Otherwise the mean
71  * value and the standart deviation of all noise values will be
72  * calculated and boundaries are set to
73  * \f$ bound_{upper} = mean + (SNROffsetAutoBoundaries * stdv) \f$
74  * \f$ bound_{lower} = mean - (SNROffsetAutoBoundaries * stdv) \f$
75  * Default is -1.
76  * @cassttng Processor/\%name\%/{SNROffsetAutoBoundariesStat} \n
77  * In case of using auto generation of the boundaries this signal to \
78  * noise ratio determines which values will be taken when calculating
79  * the mean and stdv of the distribution. Default is 4.
80  * @cassttng Processor/\%name\%/{OffsetLowerBoundary|OffsetUpperBoundary} \n
81  * In case the SNROffsetAutoBoundaries is negative these values will
82  * be taken to determine the bad pixels from the offset map.
83  * Default is -1e20|1e20.
84  * @cassttng Processor/\%name\%/{MinNbrPixels} \n
85  * The minimum amount of pixels of the trainingset that are required
86  * for the individual pixel. The value is given in percent of the total
87  * amount of pixels available. If the amount is lower than this value,
88  * the pixel will be marked as bad. Default is 90
89  * @cassttng Processor/\%name\%/{InputFilename} \n
90  * The input filname of the calibration file. If it is "NotSet" it
91  * assumes a filename of "\%name\%.lnk" and tries to find the link
92  * target. If it can't find it, it will skip loading of the calibration
93  * file. This also happens if another filename is given, but the file
94  * can't be opened or the size of the images in the file and the
95  * Rawimages differ. Program execution won't be stopped only an error
96  * is written into the log file. Default is "NotSet"
97  * @cassttng Processor/\%name\%/{ResetBadPixels} \n
98  * When set to true, it will reset a bad pixel to good if the pixel is
99  * within the checks for beeing good (with in the Noise range and enough
100  * good values). Default is false, which keeps it marked as bad.
101  * @cassttng Processor/\%name\%/{UpdateCalibration} \n
102  * Flag to tell whether after the training has completed that the
103  * calibration should be updated with more images. Default is true.
104  * @cassttng Processor/\%name\%/{UpdateCalibrationType} \n
105  * The type of update used. Default value is "cummulative". Possible
106  * values are:
107  * - "cummulative": A cummulative update
108  * - "moving": A exponential moving update
109  * @cassttng Processor/\%name\%/{NbrOfImages} \n
110  * In case of using the moving update type, this tells how many images
111  * should be considered in the exponential moving average and standart
112  * deviation estimation.
113  * @cassttng Processor/\%name\%/{UpdateBadPixPeriod} \n
114  * After how many received images should the bad pixel map be updated
115  * If negative, no updates will be made. Default is -1.
116  * @cassttng Processor/\%name\%/{WritePeriod} \n
117  * When automagically updating the dark, this gives the time in
118  * seconds between two writings of the darkcalibration file. Note
119  * that a manual call to the training will force writing even though
120  * the time between two writes has not ellapsed.
121  * Default is 0, which causes no auto writing
122  *
123  * @author Lutz Foucar
124  */
126 {
127 public:
128  /** constructor. */
129  pp330(const name_t&);
130 
131  /** overwrite default behaviour don't do anything */
132  virtual void process(const CASSEvent&, result_t&);
133 
134  /** load the settings of this pp */
135  virtual void loadSettings(size_t);
136 
137  /** write the calibrations before quitting */
138  virtual void aboutToQuit();
139 
140  /** react on when the gui clients tell this to start the calibration
141  *
142  * @param command The command that was issued by the gui clients
143  */
144  virtual void processCommand(std::string command);
145 
146 protected:
147  /** write the calibration data to file */
148  void loadCalibration();
149 
150  /** write the calibration data to file */
151  void writeCalibration();
152 
153  /** set up the bad pixel map */
154  void setBadPixMap();
155 
156  /** a cummulative average and variance calculation
157  *
158  * @param[in] image reference to the image array
159  * @param[in/out] meanAr iterator to the beginning of the mean part of the output
160  * @param[in/out] stdvAr iterator to the beginning of the stdv part of the output
161  * @param[in/out] nValsAr iterator to the beginning of the counter part of the output
162  * @param[in] sizeOfImage the number of pixels in the image
163  */
165  result_t::iterator meanAr,
166  result_t::iterator stdvAr,
167  result_t::iterator nValsAr,
168  const size_t sizeOfImage);
169 
170  /** a moving exponential average and variance calculation
171  *
172  * taken from
173  * http://mathforum.org/kb/message.jspa?messageID=1637905
174  *
175  * @param[in] image reference to the image array
176  * @param[in/out] meanAr iterator to the beginning of the mean part of the output
177  * @param[in/out] stdvAr iterator to the beginning of the stdv part of the output
178  * @param[in/out] nValsAr iterator to the beginning of the counter part of the output
179  * @param[in] sizeOfImage the number of pixels in the image
180  */
182  result_t::iterator meanAr,
183  result_t::iterator stdvAr,
184  result_t::iterator nValsAr,
185  const size_t sizeOfImage);
186 
187 private:
188  /** define the function */
189  typedef std::tr1::function<void(result_t::const_iterator,
193  const size_t)> updateFunc_t;
194 
195  /** the function that will update the statistics */
196  updateFunc_t _updateStatistics;
197 
198 private:
199  /** define the position of the beginning of the different maps */
201 
202  /** the offset to the first point of the mean array in the result */
204 
205  /** the offset to one beyond the last point of the mean array in the result */
207 
208  /** the offset to the first point of the stdv array in the result */
210 
211  /** the offset to one beyond the last point of the stdv array in the result */
213 
214  /** the offset to the first point of the bad pixels array in the result */
216 
217  /** the offset to one beyond the last point of the bad pixels array in the result */
219 
220  /** the offset to the first point of the counts array in the result */
222 
223  /** the offset to the first point of the counts array in the result */
225 
226  /** the lower noise boundary when determining bad pixels */
228 
229  /** the upper noise boundary when determining bad pixels */
231 
232  /** the signal to noise ratio that determines the noise boundaries in case of
233  * automatically determining the boundaries from the noise values statistics
234  */
236 
237  /** the signal to noise ratio that determines which values will be taken into
238  * account when automatically determining the boundaries from the noise
239  * values statistics
240  */
242 
243  /** the lower offset boundary when determining bad pixels */
245 
246  /** the upper offset boundary when determining bad pixels */
248 
249  /** the signal to noise ratio that determines the offset boundaries in case of
250  * automatically determining the boundaries from the noise values statistics
251  */
253 
254  /** the signal to noise ratio that determines which values will be taken into
255  * account when automatically determining the boundaries from the offset
256  * values statistics
257  */
259 
260  /** minimum number of pixels in the trainig set that are part of the distribution */
262 
263  /** the raw image */
265 
266  /** flag telling whether training is needed */
267  bool _train;
268 
269  /** the storage for the training images */
270  std::vector< result_t::shared_pointer > _trainstorage;
271 
272  /** the minimum nbr of images necessary for training */
274 
275  /** flag to tell whether the calibration should be written */
276  bool _write;
277 
278  /** the value above which outliers are removed from the distribution */
279  float _snr;
280 
281  /** the filename that is used to save the calibration */
282  std::string _filename;
283 
284  /** the filename that is used to load the calibration */
285  std::string _infilename;
286 
287  /** flag to tell when the bad pixel should be reset */
289 
290  /** counter to count the total amount of images */
291  size_t _counter;
292 
293  /** flag to tell whether the calibration should be updated after the training
294  * has completed.
295  */
296  bool _update;
297 
298  /** the period after which the data should be autosaved */
300 
301  /** the alpha value for the moving average and stdv */
302  float _alpha;
303 
304  /** the time_t value of the last time the calibration was written */
305  uint32_t _lastwritten;
306 
307  /** the update time period in s */
309 };
310 
311 
312 
313 
314 
315 /** pixel detector gain calibrations
316  *
317  * @PPList "331": pixel detector gain calibrations
318  *
319  * @see Processor for a list of all commonly available cass.ini
320  * settings.
321  *
322  * The output of this Processor consits of 3 images stiched together along
323  * the y (slow) coordinate. The ouput has the same x width as the input, but 3
324  * times the y width as the input.
325  *
326  * Y from 0 * y_input .. 1 * y_input-1: The calculated Gain Map
327  * Y from 1 * y_input .. 2 * y_input-1: The photons counts map
328  * Y from 2 * y_input .. 3 * y_input-1: The Average value of the photons of
329  * interest in that pixel
330  *
331  * @cassttng Processor/\%name\%/{Image} \n
332  * the image of the pixel detector
333  * @cassttng Processor/\%name\%/{Filename} \n
334  * the name of the file where the calibration will be written to.
335  * Default is out.cal
336  * @cassttng Processor/\%name\%/{WriteCal} \n
337  * Flag to tell whether the calibration should be written. Default is
338  * true.
339  * @cassttng Processor/\%name\%/{ADURangeLow|ADURangeHigh} \n
340  * The adu range that indicates that one photon has hit the pixel.
341  * Default is 0|0
342  * @cassttng Processor/\%name\%/{MinimumNbrPhotons} \n
343  * The minimum number of photons that a pixel should have seen before
344  * the gain is calulated for this pixel. Default is 200
345  * @cassttng Processor/\%name\%/{DefaultGainValue} \n
346  * The gain value that will be assinged to the pixels that haven't
347  * seen enough photons. Default is 1.
348  * @cassttng Processor/\%name\%/{NbrOfFrames} \n
349  * The number of frames after which the gain map will be calculated.
350  * Default is -1, which sais that it will never be calulated during
351  * running and only when the program ends.
352  * @cassttng Processor/\%name\%/{IsPnCCDNoCTE}\n
353  * If the detector is a pnCCD and one doesn't want to correct for the
354  * CTE this option will calcultate the gain for a column of a quadrant
355  * of the detector. Default is false
356  *
357  * @author Lutz Foucar
358  */
360 {
361 public:
362  /** constructor. */
363  pp331(const name_t&);
364 
365  /** overwrite default behaviour don't do anything */
366  virtual void process(const CASSEvent&, result_t&);
367 
368  /** load the settings of this pp */
369  virtual void loadSettings(size_t);
370 
371  /** write the calibrations before quitting */
372  virtual void aboutToQuit();
373 
374  /** receive commands from the gui */
375  virtual void processCommand(std::string command);
376 
377 protected:
378  /** write the calibration data to file */
379  void loadCalibration();
380 
381  /** write the calibration data to file */
382  void writeCalibration();
383 
384  /** write the calibration data to file */
385  void calculateGainMap(result_t& gainmap);
386 
387 private:
388  /** the raw image */
390 
391  /** definition of the statistic */
392  typedef std::pair<size_t,double> statistic_t;
393 
394  /** defintion of the statistics */
395  typedef std::vector<statistic_t> statistics_t;
396 
397  /** the statistics for each pixel */
398  statistics_t _statistics;
399 
400  /** the number of photons that a pixel should have seen before calculating the gain */
402 
403  /** define the range type */
404  typedef std::pair<float,float> range_t;
405 
406  /** the range of adu that indicates whether a pixel contains a photon */
407  range_t _aduRange;
408 
409  /** the gain value that will be assinged to the pixel that one could not
410  * calculate the gain for
411  */
412  float _constGain;
413 
414  /** flag to tell whether the calibration should be written */
415  bool _write;
416 
417  /** the filename that is used to save the calibration */
418  std::string _filename;
419 
420  /** the number of frames after which the gain map is calculted */
421  int _nFrames;
422 
423  /** counter to count how many times this has been called */
424  int _counter;
425 
426  /** offset to the gain part */
427  size_t _gainOffset;
428 
429  /** offset to the counts part */
430  size_t _countOffset;
431 
432  /** offset to the average part */
433  size_t _aveOffset;
434 
435  /** the size of the input image */
436  size_t _sizeOfImage;
437 
438  /** flag to tell whether its a pnCCD we are not interested in correction the cte */
440 };
441 
442 
443 
444 
445 
446 
447 
448 
449 
450 
451 /** pixel detector hot pixel detection
452  *
453  * @PPList "332": pixel detector hot pixel detection
454  *
455  * @see Processor for a list of all commonly available cass.ini
456  * settings.
457  *
458  * @cassttng Processor/\%name\%/{Image} \n
459  * the image of the pixel detector
460  * @cassttng Processor/\%name\%/{Filename} \n
461  * the name of the file where the calibration will be written to.
462  * Default is out.cal
463  * @cassttng Processor/\%name\%/{WriteCal} \n
464  * Flag to tell whether the calibration should be written. Default is
465  * true.
466  * @cassttng Processor/\%name\%/{ADURangeLow|ADURangeUp} \n
467  * The adu range that indicates that one photon has hit the pixel.
468  * Default is 0|0
469  * @cassttng Processor/\%name\%/{MaximumConsecutiveFrames} \n
470  * The maximum number of frames that a pixel should have an adu value
471  * in the range before the pixel is mased as hot. Default is 5
472  * @cassttng Processor/\%name\%/{MaxADUValue} \n
473  * If a pixel ever exceeds this value it will be masked as bad.
474  * Default is 1e6
475  * @cassttng Processor/\%name\%/{NbrOfFrames} \n
476  * The number of frames after which the gain map will be calculated.
477  * Default is -1, which sais that it will never be calulated during
478  * running and only when the program ends.
479  *
480  * @author Lutz Foucar
481  */
483 {
484 public:
485  /** constructor. */
486  pp332(const name_t&);
487 
488  /** overwrite default behaviour don't do anything */
489  virtual void process(const CASSEvent&, result_t&);
490 
491  /** load the settings of this pp */
492  virtual void loadSettings(size_t);
493 
494  /** write the calibrations before quitting */
495  virtual void aboutToQuit();
496 
497 protected:
498  /** write the calibration data to file */
499  void loadHotPixelMap();
500 
501  /** write the calibration data to file */
502  void writeHotPixelMap();
503 
504 private:
505  /** define the output mask type */
506  typedef char mask_t;
507 
508  /** the image to create the hotpixel map from */
510 
511  /** the number of times a pixel is high before masking it as hot pixel */
513 
514  /** define the range type */
515  typedef std::pair<float,float> range_t;
516 
517  /** the range of adu that indicates whether a pixel is hot */
518  range_t _aduRange;
519 
520  /** the maximum allowed adu value */
521  float _maxADUVal;
522 
523  /** flag to tell whether the calibration should be written */
524  bool _write;
525 
526  /** the filename that is used to save the calibration */
527  std::string _filename;
528 
529  /** the number of frames after which the gain map is calculted */
530  int _nFrames;
531 
532  /** counter to count how many times this has been called */
533  int _counter;
534 };
535 
536 
537 
538 
539 
540 
541 
542 /** pixel detector common mode background calculation
543  *
544  * @PPList "333": pixel detector common mode background calculation
545  *
546  * @see Processor for a list of all commonly available cass.ini
547  * settings.
548  *
549  * @cassttng Processor/\%name\%/{Image} \n
550  * the image of the pixel detector
551  * @cassttng Processor/\%name\%/{Width} \n
552  * The width of the subpart of the detector for which the common
553  * mode level needs to be calculated.
554  * @cassttng Processor/\%name\%/{CalculationType} \n
555  * The type of calculation used to calculate the common mode level.
556  * Default is "mean". Possible values are:
557  * - "mean": Iterative retrieval of the mean value of distribution of
558  * pixels. In each iteration the outliers of the distribution
559  * are remove from the distribution.
560  * - "median": Calculates the mean of the distribution of pixels.
561  * @cassttng Processor/\%name\%/{SNR} \n
562  * In case of using the mean calculator the signal to noise ratio is
563  * indicating which values to remove from the distribution before
564  * recalculating the mean. Default is 4
565  *
566  * @author Lutz Foucar
567  */
568 class pp333 : public Processor
569 {
570 public:
571  /** constructor. */
572  pp333(const name_t&);
573 
574  /** overwrite default behaviour don't do anything */
575  virtual void process(const CASSEvent&, result_t&);
576 
577  /** load the settings of this pp */
578  virtual void loadSettings(size_t);
579 
580 protected:
581  /** function to calulate the common mode level as mean value
582  *
583  * @return the commonmode level
584  * @param begin iterator to the beginning of the distribution
585  * @param end iterator to the end of the distribution
586  */
589 
590  /** function to calulate the common mode level via the median value
591  *
592  * @return the commonmode level
593  * @param begin iterator to the beginning of the distribution
594  * @param end iterator to the end of the distribution
595  */
598 private:
599  /** the image to create the hotpixel map from */
601 
602  /** the number of times a pixel is high before masking it as hot pixel */
603  size_t _width;
604 
605  /** the signal to noise ratio in case one uses the mean calculator */
606  float _snr;
607 
608  /** the function that calculates the commond mode level */
609  std::tr1::function<float(result_t::const_iterator,
611 };
612 
613 
614 
615 
616 
617 
618 
619 /** pixel detector common mode background calculation
620  *
621  * @PPList "334": pixel detector common mode calc using histograms
622  *
623  * @see Processor for a list of all commonly available cass.ini
624  * settings.
625  *
626  * @cassttng Processor/\%name\%/{Image} \n
627  * the image of the pixel detector
628  * @cassttng Processor/\%name\%/{Width} \n
629  * when using the histogram option this is the width of the 0 photons
630  * peak that the CsPAD typically has. Default is 30
631  * @cassttng Processor/\%name\%/{MaxDistance} \n
632  * How much should the histogram value differ at the most from the
633  * unbonded pixel value, before the value of the unbonded pixel is
634  * taken. Default is 5
635  * @cassttng Processor/\%name\%/{EnableChecks} \n
636  * Switch that allows to enable checks by outputting the histograms,
637  * and the found maxima. Default is false.
638  *
639  * @author Lutz Foucar
640  */
641 class pp334 : public Processor
642 {
643 public:
644  /** constructor. */
645  pp334(const name_t&);
646 
647  /** overwrite default behaviour don't do anything */
648  virtual void process(const CASSEvent&, result_t&);
649 
650  /** load the settings of this pp */
651  virtual void loadSettings(size_t);
652 
653 private:
654  /** the image to create the hotpixel map from */
656 
657  /** the number of times a pixel is high before masking it as hot pixel */
658  float _width;
659 
660  /** the maximum distance between the value of the unbonded pxiels and the hist */
661  float _maxDist;
662 
663  /** enable output that allow to check the parameters */
664  bool _checks;
665 };
666 
667 }//end namespace cass
668 #endif
storage_t::const_iterator const_iterator
a const iterator on the storage
Definition: result.hpp:338
bool _write
flag to tell whether the calibration should be written
std::vector< statistic_t > statistics_t
defintion of the statistics
size_t _aveOffset
offset to the average part
float _autoNoiseSNR
the signal to noise ratio that determines the noise boundaries in case of automatically determining t...
Event to store all LCLS Data.
Definition: cass_event.h:32
char mask_t
define the output mask type
pp332(const name_t &)
constructor.
float _snr
the value above which outliers are removed from the distribution
pp333(const name_t &)
constructor.
std::tr1::function< float(result_t::const_iterator, result_t::const_iterator)> _calcCommonmode
the function that calculates the commond mode level
std::string _filename
the filename that is used to save the calibration
pp331(const name_t &)
constructor.
uint32_t _lastwritten
the time_t value of the last time the calibration was written
pp334(const name_t &)
constructor.
void movingUpdate(result_t::const_iterator image, result_t::iterator meanAr, result_t::iterator stdvAr, result_t::iterator nValsAr, const size_t sizeOfImage)
a moving exponential average and variance calculation
virtual void loadSettings(size_t)
load the settings of this pp
void loadCalibration()
write the calibration data to file
int _nFrames
the number of frames after which the gain map is calculted
virtual void loadSettings(size_t)
load the settings of this pp
float _autoNoiseSNRStat
the signal to noise ratio that determines which values will be taken into account when automatically ...
pp330(const name_t &)
constructor.
pixel detector gain calibrations
bool _write
flag to tell whether the calibration should be written
float _NoiseLowerBound
the lower noise boundary when determining bad pixels
std::vector< result_t::shared_pointer > _trainstorage
the storage for the training images
shared_pointer _image
the raw image
float _maxADUVal
the maximum allowed adu value
virtual void processCommand(std::string command)
receive commands from the gui
size_t _countOffset
offset to the counts part
std::pair< float, float > range_t
define the range type
std::string _filename
the filename that is used to save the calibration
virtual void loadSettings(size_t)
load the settings of this pp
std::tr1::function< void(result_t::const_iterator, result_t::iterator, result_t::iterator, result_t::iterator, const size_t)> updateFunc_t
define the function
void writeCalibration()
write the calibration data to file
size_t _bPixBeginOffset
the offset to the first point of the bad pixels array in the result
float _snr
the signal to noise ratio in case one uses the mean calculator
std::pair< size_t, double > statistic_t
definition of the statistic
int _updatePeriod
the period after which the data should be autosaved
size_t _stdvBeginOffset
the offset to the first point of the stdv array in the result
bool _train
flag telling whether training is needed
virtual void process(const CASSEvent &, result_t &)
overwrite default behaviour don't do anything
size_t _minTrainImages
the minimum nbr of images necessary for training
uint32_t _updateWritePeriod
the update time period in s
pixel detector hot pixel detection
std::string _infilename
the filename that is used to load the calibration
virtual void process(const CASSEvent &, result_t &)
overwrite default behaviour don't do anything
virtual void process(const CASSEvent &, result_t &)
overwrite default behaviour don't do anything
int _counter
counter to count how many times this has been called
base class for processors.
Definition: processor.h:39
size_t _width
the number of times a pixel is high before masking it as hot pixel
float _constGain
the gain value that will be assinged to the pixel that one could not calculate the gain for ...
size_t _meanEndOffset
the offset to one beyond the last point of the mean array in the result
virtual void loadSettings(size_t)
load the settings of this pp
pixel detector common mode background calculation
size_t _sizeOfImage
the size of the input image
float _minNbrPixels
minimum number of pixels in the trainig set that are part of the distribution
void calculateGainMap(result_t &gainmap)
write the calibration data to file
shared_pointer _image
the image to create the hotpixel map from
size_t _counter
counter to count the total amount of images
void cummulativeUpdate(result_t::const_iterator image, result_t::iterator meanAr, result_t::iterator stdvAr, result_t::iterator nValsAr, const size_t sizeOfImage)
a cummulative average and variance calculation
virtual void aboutToQuit()
write the calibrations before quitting
float meanCalc(result_t::const_iterator begin, result_t::const_iterator end)
function to calulate the common mode level as mean value
range_t _aduRange
the range of adu that indicates whether a pixel is hot
statistics_t _statistics
the statistics for each pixel
float _alpha
the alpha value for the moving average and stdv
void writeHotPixelMap()
write the calibration data to file
shared_pointer _image
the image to create the hotpixel map from
bool _isPnCCDNoCTE
flag to tell whether its a pnCCD we are not interested in correction the cte
void loadCalibration()
write the calibration data to file
file contains processors baseclass declaration
updateFunc_t _updateStatistics
the function that will update the statistics
size_t _nValBeginOffset
the offset to the first point of the counts array in the result
range_t _aduRange
the range of adu that indicates whether a pixel contains a photon
size_t _minPhotonCount
the number of photons that a pixel should have seen before calculating the gain
size_t _maxConsecutiveCount
the number of times a pixel is high before masking it as hot pixel
size_t _bPixEndOffset
the offset to one beyond the last point of the bad pixels array in the result
virtual void process(const CASSEvent &, result_t &)
overwrite default behaviour don't do anything
virtual void aboutToQuit()
write the calibrations before quitting
virtual void loadSettings(size_t)
load the settings of this pp
pixel detector common mode background calculation
size_t _stdvEndOffset
the offset to one beyond the last point of the stdv array in the result
storage_t::iterator iterator
a iterator on the storage
Definition: result.hpp:335
contains declarations of statistic calculators
float _OffsetLowerBound
the lower offset boundary when determining bad pixels
float _NoiseUpperBound
the upper noise boundary when determining bad pixels
float _autoOffsetSNR
the signal to noise ratio that determines the offset boundaries in case of automatically determining ...
std::pair< float, float > range_t
define the range type
int _counter
counter to count how many times this has been called
bool _update
flag to tell whether the calibration should be updated after the training has completed.
virtual void processCommand(std::string command)
react on when the gui clients tell this to start the calibration
float medianCalc(result_t::const_iterator begin, result_t::const_iterator end)
function to calulate the common mode level via the median value
void writeCalibration()
write the calibration data to file
an accumulating processor
Definition: processor.h:289
float _autoOffsetSNRStat
the signal to noise ratio that determines which values will be taken into account when automatically ...
pixel detector calibrations
size_t _gainOffset
offset to the gain part
size_t _meanBeginOffset
the offset to the first point of the mean array in the result
virtual void process(const CASSEvent &, result_t &)
overwrite default behaviour don't do anything
float _maxDist
the maximum distance between the value of the unbonded pxiels and the hist
int _nFrames
the number of frames after which the gain map is calculted
std::string name_t
define the name type
Definition: processor.h:46
bool _resetBadPixel
flag to tell when the bad pixel should be reset
float _OffsetUpperBound
the upper offset boundary when determining bad pixels
std::tr1::shared_ptr< Processor > shared_pointer
a shared pointer of this
Definition: processor.h:43
float _width
the number of times a pixel is high before masking it as hot pixel
size_t _nValEndOffset
the offset to the first point of the counts array in the result
bool _write
flag to tell whether the calibration should be written
std::string _filename
the filename that is used to save the calibration
bool _checks
enable output that allow to check the parameters
shared_pointer _image
the raw image
virtual void aboutToQuit()
write the calibrations before quitting
void setBadPixMap()
set up the bad pixel map
void loadHotPixelMap()
write the calibration data to file
shared_pointer _image
the image to create the hotpixel map from