DIMM Centroiding Notes

Algorithm

1. To determine the "rough peaks", it uses 3x3 areas of the image:
threshold = median of the image + 3 * stdev

2. Ignore peaks that have a "center of light" with any boundary (any corner of the 30x30 is outside the image)
this effectively throws out the edge pixels that are bad

3. Capture background stats on the 30x30 (configurable value, Dimm.centroidSize ) area around each peak, not including a 5x5 region at the centroid (875 pixels in the background calc)

4. Centroid is any peak with the mean of the 9 pixels (3x3) greater than twice the mean of the background stats

5. Throw out weaker centroids within 15 pixels of each other. (half of Dimm.centroidSize )

Calculation for the pixel number in a 1D array from a 1D array, in 2 loops (outer and inner):
innerloopcounter * maxouterloop + outerloopcounter
To get the DIMM FITS image correct, we need our 2D array to be:
 array[width][height] 
 using outer loop as width, inner loop as height

Solutions

  1. Implement the hot pixel map
    • how do we generate it from dark images? Barry created one for us from darks.
    • do we zero the pixel? or set it to the average of the rest? zero it for now
  2. Minimum threshold will by itself get rid of some of these hot pixels    initially, created a configurable peakLowerLimit value currently set to 5, but this value is too low. See notes below
  3. Potentially add a geometry solution if it comes up with more than 2 centroids. We know the separation in pixels, in which direction - don't allow the top two pixels to not have the right geometry.
    what would we do if they modified focus and our geometry is off now? need to be able to re-measure this while measuring with a good focus

Testing To Do

  1. Test with 1.x mag star to see if we get artifacts, like ghosts
  2. Are we getting the FITS headers filled in on the acq FITS files? actually, I think this isn't a problem - just broken in the extra files created

Notes

  • Found a bug in the background calculation - it was building the list continually, instead of separate set of background pixels for each "peak".

  • There are at least two hot pixels causing a lot of the problems:   73.0,256.0 and   538.0,304.0
    The initial peak threshold is too low.
    The mean for the 9 pixels in that case is almost always only 4.4.
    Do we ever see a flux value this low that we would want to keep? Maybe the initial threshold should be clipped at 5??

  • The ghosts problem is trickier - maybe we get around this by just choosing the top 2 centroids. Maybe it's not a ghost?

Here's a case that failed after the "center star" command.
Initial threshold is 4, background is nothing 0.62, so the mean is easily over twice that.
Actually, this is the hot pixel problem at 537,303.

07/02/2015 04:26:56.128 - DimmImageHandler::findStars - SrcImageInfo min:0 max:119 mean:0.796326 median:1 dev:1.209577 var:1.463076 thresh:4
07/02/2015 04:26:56.184 - DimmImageHandler::findCentroids - : peaks[0] x,y: 538.0,304.0 mean: 4.44 background mean: 0.62 dev: 0.99
07/02/2015 04:26:58.901 - DimmImageHandler::findCentroids - : adding peak x,y: 537.3,303.3 mean:4.44
07/02/2015 04:26:58.902 - DimmImageHandler::findCentroids - : adding peak x,y: 660.6,495.7 mean:100.44
07/02/2015 04:26:58.902 - DimmImageHandler::findCentroids - : adding peak x,y: 717.6,498.6 mean:52.78
07/02/2015 04:26:58.902 - DimmImageHandler::findCentroids - : findCentroids returning 3 
07/02/2015 04:26:58.903 - Warning: Didn't find two stars after centerStar, not measuring

Another problem occurred before more debug was there and when the FITS file was incorrect. Only a single centroid, but the max flux on the image is 248.
Threw away all but one of the peaks because they're all within 15 pixels of each other, it picked the "strongest centroid" in the bunch. The other real one should be within 50 pixels in X of the selected one, but there's nothing in the data for 410 or 510 in X.
   06/29/2015 08:09:20.467 - DimmImageHandler::findStars - SrcImageInfo min:0 max:248 mean:0.810657 median:1 dev:1.481724 var:2.195506 thresh:5

   06/29/2015 08:09:22.115 - DimmImageHandler::findCentroids - : adding peak x,y: 460.0,783.2 mean:184.78

others:
   06/29/2015 08:09:20.524 - DimmImageHandler::findCentroids - : peaks[5] x,y: 454.0,781.0 mean: 34.22 background mean: 12.77 dev: 35.18
   06/29/2015 08:09:20.649 - DimmImageHandler::findCentroids - : peaks[6] x,y: 454.0,784.0 mean: 40.00 background mean: 12.87 dev: 35.25
   06/29/2015 08:09:20.762 - DimmImageHandler::findCentroids - : peaks[9] x,y: 457.0,781.0 mean: 86.89 background mean: 13.14 dev: 35.17
   06/29/2015 08:09:20.874 - DimmImageHandler::findCentroids - : peaks[10] x,y: 457.0,784.0 mean: 112.67 background mean: 13.06 dev: 34.85
   06/29/2015 08:09:20.986 - DimmImageHandler::findCentroids - : peaks[11] x,y: 457.0,787.0 mean: 27.78 background mean: 13.15 dev: 34.91
   06/29/2015 08:09:21.098 - DimmImageHandler::findCentroids - : peaks[13] x,y: 460.0,781.0 mean: 155.22 background mean: 13.11 dev: 34.44
   06/29/2015 08:09:21.210 - DimmImageHandler::findCentroids - : peaks[14] x,y: 460.0,784.0 mean: 184.78 background mean: 12.95 dev: 33.87
   06/29/2015 08:09:21.322 - DimmImageHandler::findCentroids - : peaks[15] x,y: 460.0,787.0 mean: 36.89 background mean: 13.01 dev: 33.94
   06/29/2015 08:09:21.435 - DimmImageHandler::findCentroids - : peaks[18] x,y: 463.0,781.0 mean: 122.11 background mean: 13.14 dev: 33.95
   06/29/2015 08:09:21.548 - DimmImageHandler::findCentroids - : peaks[19] x,y: 463.0,784.0 mean: 135.22 background mean: 13.07 dev: 33.72
   06/29/2015 08:09:21.662 - DimmImageHandler::findCentroids - : peaks[23] x,y: 466.0,781.0 mean: 65.22 background mean: 13.27 dev: 34.05
   06/29/2015 08:09:21.774 - DimmImageHandler::findCentroids - : peaks[24] x,y: 466.0,784.0 mean: 75.11 background mean: 13.27 dev: 34.07
   06/29/2015 08:09:21.888 - DimmImageHandler::findCentroids - : peaks[27] x,y: 469.0,781.0 mean: 30.22 background mean: 13.36 dev: 34.29
   06/29/2015 08:09:22.000 - DimmImageHandler::findCentroids - : peaks[28] x,y: 469.0,784.0 mean: 43.22 background mean: 13.36 dev: 34.34

Hot Pixels

Barry has created a hot pixel map with many more points in it. As of January-2016, we're using that. I added one hot pixel in June-2016 to the map.

Once I got a FITS file that matched the DIMM output for x,y pixel values, I could look for hot pixels. Using this one ( 20150707045547-dimm-acq-corrected.fits ), I see hot pixels (over 18 flux) at :

DS9 DIMM standalone
75, 258 74,257
409, 900 408,899
540, 306 539,305
1224, 613 1223, 612
1379, 1 1378, 0

2016-June

After adding auto-acquisition, we found DIMM struggling, picking up 3 centroids (instead of 2) sometimes when nothing's really there. The floor threshold of 5 is too high. Bumped it up to 10. See spreadsheet in /home/ksummers/dimm/peakMeans201606.csv

20150707

Had some problems on 20150707. Started with 2.73 mag star at 04:17.

07/07/2015 04:17:54.558 - DimmImageHandler::findStars - SrcImageInfo min:0 max:106 mean:0.807013 median:1 dev:1.247531 var:1.556335 thresh:4
07/07/2015 04:17:54.615 - DimmImageHandler::findCentroids - : peaks[0] x,y: 73.0,256.0 mean: 4.22 background mean: 0.81 dev: 1.14
07/07/2015 04:17:57.829 - DimmImageHandler::findCentroids - : adding peak x,y: 72.2,255.2 mean:4.22
07/07/2015 04:17:57.829 - DimmImageHandler::findCentroids - : adding peak x,y: 649.3,480.3 mean:84.78
07/07/2015 04:17:57.829 - DimmImageHandler::findCentroids - : adding peak x,y: 699.1,481.0 mean:54.11
07/07/2015 04:17:57.829 - DimmImageHandler::findCentroids - : findCentroids returning 3 
07/07/2015 04:17:57.830 - Warning: Didn't find two stars after centerStar, not measuring

07/07/2015 04:19:01.625 - DimmImageHandler::findStars - SrcImageInfo min:0 max:104 mean:0.805530 median:1 dev:1.214176 var:1.474224 thresh:4
07/07/2015 04:19:01.683 - DimmImageHandler::findCentroids - : peaks[0] x,y: 538.0,304.0 mean: 4.11 background mean: 0.87 dev: 1.17
07/07/2015 04:19:04.192 - DimmImageHandler::findCentroids - : adding peak x,y: 537.7,304.0 mean:4.11
07/07/2015 04:19:04.192 - DimmImageHandler::findCentroids - : adding peak x,y: 645.8,459.6 mean:88.78
07/07/2015 04:19:04.192 - DimmImageHandler::findCentroids - : adding peak x,y: 693.9,462.4 mean:48.56
07/07/2015 04:19:04.192 - DimmImageHandler::findCentroids - : findCentroids returning 3 

Slew to 3.19 mag star:
07/07/2015 04:19:51.367 - Slew to  27Kap Oph  RA: 16.961186, DEC: 9.375000,   dist from LBT:8.43. mag: 3.19
--- hot pixel
07/07/2015 04:20:23.380 - DimmImageHandler::findStars - SrcImageInfo min:0 max:35 mean:0.787332 median:1 dev:1.126242 var:1.268420 thresh:4
07/07/2015 04:20:25.599 - DimmImageHandler::findCentroids - : peaks[19] x,y: 538.0,304.0 mean: 4.22 background mean: 1.85 dev: 3.58
07/07/2015 04:20:25.711 - DimmImageHandler::findCentroids - : adding peak x,y: 240.8,550.0 mean:27.33
07/07/2015 04:20:25.711 - DimmImageHandler::findCentroids - : adding peak x,y: 291.5,549.7 mean:22.11
07/07/2015 04:20:25.711 - DimmImageHandler::findCentroids - : adding peak x,y: 537.3,303.5 mean:4.22
07/07/2015 04:20:25.711 - DimmImageHandler::findCentroids - : findCentroids returning 3 

Slew to 1.85 mag star. This one only found only hot pixels before and after centering only 1 of the hot pixels:
07/07/2015 04:33:05.931 - Slew to  85Eta UMa  RA: 13.792375, DEC: 49.313056,   dist from LBT:9.28. mag: 1.85
07/07/2015 04:35:11.720 - DimmImageHandler::findStars - SrcImageInfo min:0 max:31 mean:0.785944 median:1 dev:1.117007 var:1.247705 thresh:4
07/07/2015 04:35:11.775 - DimmImageHandler::findCentroids - : peaks[0] x,y: 73.0,256.0 mean: 4.44 background mean: 0.82 dev: 1.11
07/07/2015 04:35:11.900 - DimmImageHandler::findCentroids - : peaks[1] x,y: 538.0,304.0 mean: 4.44 background mean: 0.78 dev: 1.08
07/07/2015 04:35:12.012 - DimmImageHandler::findCentroids - : adding peak x,y: 71.9,255.4 mean:4.44
07/07/2015 04:35:12.012 - DimmImageHandler::findCentroids - : adding peak x,y: 537.4,304.0 mean:4.44
07/07/2015 04:35:12.012 - DimmImageHandler::findCentroids - : findCentroids returning 2 
.. center star
07/07/2015 04:35:14.265 - DimmImageHandler::findStars - SrcImageInfo min:0 max:29 mean:0.788840 median:1 dev:1.116876 var:1.247412 thresh:4
07/07/2015 04:35:14.444 - DimmImageHandler::findCentroids - : adding peak x,y: 537.3,303.2 mean:4.22
07/07/2015 04:35:14.444 - DimmImageHandler::findCentroids - : findCentroids returning 1 

This one is one of the ghosts from the real stars, flux of 22, background 6. The other ghost is too dim to be seen.
07/07/2015 04:37:54.243 - DimmImageHandler::findStars - SrcImageInfo min:0 max:189 mean:0.805980 median:1 dev:1.383059 var:1.912853 thresh:5
07/07/2015 04:37:55.551 - DimmImageHandler::findCentroids - : peaks[29] x,y: 553.0,478.0 mean: 22.56 background mean: 6.43 dev: 19.35
07/07/2015 04:37:57.253 - DimmImageHandler::findCentroids - : adding peak x,y: 531.5,513.3 mean:125.78
07/07/2015 04:37:57.253 - DimmImageHandler::findCentroids - : adding peak x,y: 552.5,477.7 mean:22.56
07/07/2015 04:37:57.253 - DimmImageHandler::findCentroids - : adding peak x,y: 579.3,516.9 mean:119.44
07/07/2015 04:37:57.253 - DimmImageHandler::findCentroids - : findCentroids returning 3 
07/07/2015 04:37:57.254 - Warning: Found 3 centroids, need exactly 2.  Try again or move on.

The centroids and the ghosts:
07/07/2015 04:38:21.397 - DimmImageHandler::findStars - SrcImageInfo min:0 max:314 mean:0.814954 median:1 dev:1.845564 var:3.406106 thresh:6
07/07/2015 04:38:22.840 - DimmImageHandler::findCentroids - : peaks[37] x,y: 565.0,475.0 mean: 38.56 background mean: 10.54 dev: 27.70
07/07/2015 04:38:25.016 - DimmImageHandler::findCentroids - : peaks[72] x,y: 604.0,475.0 mean: 29.11 background mean: 11.20 dev: 32.72
07/07/2015 04:38:25.254 - DimmImageHandler::findCentroids - : adding peak x,y: 543.2,507.7 mean:179.11
07/07/2015 04:38:25.254 - DimmImageHandler::findCentroids - : adding peak x,y: 564.6,474.4 mean:38.56
07/07/2015 04:38:25.254 - DimmImageHandler::findCentroids - : adding peak x,y: 583.4,508.2 mean:227.22
07/07/2015 04:38:25.254 - DimmImageHandler::findCentroids - : adding peak x,y: 606.5,474.6 mean:36.44

--- Flux on the second ghost only about half of the other, so it wasn't enough to get over the background.
07/07/2015 04:40:38.745 - DimmImageHandler::findStars - SrcImageInfo min:0 max:157 mean:0.794955 median:1 dev:1.377974 var:1.898812 thresh:5
07/07/2015 04:40:40.428 - DimmImageHandler::findCentroids - : peaks[30] x,y: 610.0,472.0 mean: 24.67 background mean: 6.28 dev: 17.00
07/07/2015 04:40:42.971 - DimmImageHandler::findCentroids - : peaks[70] x,y: 649.0,478.0 mean: 13.22 background mean: 6.72 dev: 17.42
07/07/2015 04:40:42.977 - DimmImageHandler::findCentroids - : adding peak x,y: 585.9,511.1 mean:116.33
07/07/2015 04:40:42.977 - DimmImageHandler::findCentroids - : adding peak x,y: 609.4,471.8 mean:24.67
07/07/2015 04:40:42.977 - DimmImageHandler::findCentroids - : adding peak x,y: 627.3,508.6 mean:99.56
07/07/2015 04:40:42.978 - Warning: Found 3 centroids, need exactly 2.  Try again or move on.

--- Both ghosts found here.
07/07/2015 04:41:53.485 - DimmImageHandler::findStars - SrcImageInfo min:0 max:112 mean:0.797887 median:1 dev:1.212461 var:1.470062 thresh:4
07/07/2015 04:41:57.042 - DimmImageHandler::findCentroids - : adding peak x,y: 378.4,522.5 mean:85.00
07/07/2015 04:41:57.042 - DimmImageHandler::findCentroids - : adding peak x,y: 399.6,486.7 mean:8.89
07/07/2015 04:41:57.042 - DimmImageHandler::findCentroids - : adding peak x,y: 418.0,517.1 mean:55.00
07/07/2015 04:41:57.042 - DimmImageHandler::findCentroids - : adding peak x,y: 438.6,483.6 mean:14.33
07/07/2015 04:41:57.317 - Warning: Found 4 centroids, need exactly 2.  Try again or move on.

Try new star, 3.46 magnitude.
07/07/2015 04:43:54.848 - Slew to  49Del Boo  RA: 15.258361, DEC: 33.315000,   dist from LBT:3.66. mag: 3.46
07/07/2015 04:44:28.529 - Start measurement.
07/07/2015 04:44:29.686 - DimmImageHandler::findStars - SrcImageInfo min:0 max:83 mean:0.787766 median:1 dev:1.178400 var:1.388627 thresh:4
07/07/2015 04:44:32.225 - DimmImageHandler::findCentroids - : adding peak x,y: 402.5,396.5 mean:59.44
07/07/2015 04:44:32.225 - DimmImageHandler::findCentroids - : adding peak x,y: 439.0,393.9 mean:66.22
07/07/2015 04:44:32.226 - DimmServiceI::measureDimm: Two stars found. Setting the region-of-interest.

--- Hot pixel 
07/07/2015 04:44:34.999 - DimmImageHandler::findStars - SrcImageInfo min:0 max:68 mean:0.778129 median:1 dev:1.156284 var:1.336993 thresh:4
07/07/2015 04:44:38.000 - DimmImageHandler::findCentroids - : adding peak x,y: 538.2,302.7 mean:4.22
07/07/2015 04:44:38.000 - DimmImageHandler::findCentroids - : adding peak x,y: 658.5,496.3 mean:43.89
07/07/2015 04:44:38.000 - DimmImageHandler::findCentroids - : adding peak x,y: 699.8,498.1 mean:47.11
07/07/2015 04:44:38.001 - Warning: Didn't find two stars after centerStar, not measuring

07/07/2015 04:55:48.119 - DimmImageHandler::findStars - SrcImageInfo min:0 max:34 mean:0.795750 median:1 dev:1.131960 var:1.281333 thresh:4
07/07/2015 04:55:50.664 - DimmImageHandler::findCentroids - : adding peak x,y: 669.5,547.1 mean:21.67
07/07/2015 04:55:50.664 - DimmImageHandler::findCentroids - : adding peak x,y: 708.3,546.4 mean:25.89
07/07/2015 04:55:50.665 - DimmServiceI::measureDimm: Two stars found. Setting the region-of-interest.
07/07/2015 04:55:52.633 - DimmImageHandler::findStars - SrcImageInfo min:0 max:31 mean:0.807994 median:1 dev:1.130400 var:1.277804 thresh:4
--- Hot pixel 
07/07/2015 04:55:54.725 - DimmImageHandler::findCentroids - : adding peak x,y: 537.8,303.5 mean:4.11
07/07/2015 04:55:54.725 - DimmImageHandler::findCentroids - : adding peak x,y: 669.8,514.1 mean:19.33
07/07/2015 04:55:54.725 - DimmImageHandler::findCentroids - : adding peak x,y: 711.6,513.4 mean:13.11
07/07/2015 04:55:54.726 - Warning: Didn't find two stars after centerStar, not measuring

--- Hot pixel 
07/07/2015 04:56:07.270 - DimmImageHandler::findStars - SrcImageInfo min:0 max:88 mean:0.788978 median:1 dev:1.176667 var:1.384546 thresh:4
07/07/2015 04:56:10.716 - DimmImageHandler::findCentroids - : adding peak x,y: 72.5,255.7 mean:4.22
07/07/2015 04:56:10.716 - DimmImageHandler::findCentroids - : adding peak x,y: 447.9,516.3 mean:46.56
07/07/2015 04:56:10.716 - DimmImageHandler::findCentroids - : adding peak x,y: 486.7,516.2 mean:62.78
07/07/2015 04:56:10.717 - Warning: Found 3 centroids, need exactly 2.  Try again or move on.
07/07/2015 04:57:05.286 - Start measurement.
--- Hot pixel 
07/07/2015 04:57:13.227 - DimmImageHandler::findStars - SrcImageInfo min:0 max:32 mean:0.801127 median:1 dev:1.131314 var:1.279872 thresh:4
07/07/2015 04:57:15.750 - DimmImageHandler::findCentroids - : adding peak x,y: 456.3,507.8 mean:25.00
07/07/2015 04:57:15.750 - DimmImageHandler::findCentroids - : adding peak x,y: 494.9,508.0 mean:18.89
07/07/2015 04:57:15.750 - DimmImageHandler::findCentroids - : adding peak x,y: 537.5,303.4 mean:4.44
07/07/2015 04:57:16.461 - Warning: Found 3 centroids, need exactly 2.  Try again or move on.
--- Hot pixel 
07/07/2015 05:03:04.738 - DimmImageHandler::findStars - SrcImageInfo min:0 max:72 mean:0.783788 median:1 dev:1.152529 var:1.328324 thresh:4
07/07/2015 05:03:07.503 - DimmImageHandler::findCentroids - : adding peak x,y: 72.7,256.1 mean:4.22
07/07/2015 05:03:07.503 - DimmImageHandler::findCentroids - : adding peak x,y: 396.9,507.6 mean:51.11
07/07/2015 05:03:07.503 - DimmImageHandler::findCentroids - : adding peak x,y: 438.8,507.2 mean:41.33
07/07/2015 05:03:07.505 - Warning: Found 3 centroids, need exactly 2.  Try again or move on.

Gave up for awhile, and then good success with 2.22 magnitude star for awhile. Then hot pixel again:
07/07/2015 08:05:09.515 - Slew to  64Nu  Oph  RA: 17.983778, DEC: -8.226667,   dist from LBT:5.44. mag: 3.32
07/07/2015 08:06:13.410 - Start measurement.
07/07/2015 08:06:13.688 - DimmImageHandler::findStars - SrcImageInfo min:0 max:79 mean:0.800997 median:1 dev:1.171290 var:1.371921 thresh:4
07/07/2015 08:06:16.345 - DimmImageHandler::findCentroids - : adding peak x,y: 1182.5,336.5 mean:72.33
07/07/2015 08:06:16.345 - DimmImageHandler::findCentroids - : adding peak x,y: 1233.7,336.5 mean:41.11
07/07/2015 08:06:16.345 - DimmImageHandler::findCentroids - : findCentroids returning 2 
07/07/2015 08:06:16.346 - DimmServiceI::measureDimm: Two stars found. Setting the region-of-interest.
07/07/2015 08:06:16.375 - centerStar New position [deg]: ud 5.042448 lr -2.145103
07/07/2015 08:06:18.993 - DimmImageHandler::findStars - SrcImageInfo min:0 max:66 mean:0.801625 median:1 dev:1.162268 var:1.350867 thresh:4
07/07/2015 08:06:22.884 - DimmImageHandler::findCentroids - : adding peak x,y: 537.7,303.2 mean:4.11
07/07/2015 08:06:22.884 - DimmImageHandler::findCentroids - : adding peak x,y: 691.2,510.2 mean:31.44
07/07/2015 08:06:22.884 - DimmImageHandler::findCentroids - : adding peak x,y: 747.8,511.2 mean:52.44
07/07/2015 08:06:22.884 - DimmImageHandler::findCentroids - : findCentroids returning 3 
07/07/2015 08:06:22.885 - Warning: Didn't find two stars after centerStar, not measuring

20150227

On this night, I was recording the image statistics even when measuring, so I have 122K samples. Why do we see max values as high as 4000, and average max of 103, but the mean is always around 1????

AVG MAX : 103.185489
MAX MAX : 4095
AVG mean: 0.957755174

ROI Setting with Exposure Time

There is code in the setting of the ROI that was not executing before I fixed a bug in the exposureTime method. I commented it out so it could be tested before we used it. It sets the exposure time much higher than we are currently using.

    //The camera readout procedure reduces the exposure time for subframes.
    //After a talk with DVC this is the current solution.
    if ( _rec.width == 200 && _rec.height == 200 )
    {
        if ( currentExpTime == 1 )
        {
            pdv_serial_command ( m_pdvDev, "EXP 134" );
            m_Logger->trace ( "CameraEdt::setROI subframe 200x200 ", "EXP 134" );
        }
        else if ( currentExpTime == 2 )
        {
            pdv_serial_command ( m_pdvDev, "EXP 281" );
            m_Logger->trace ( "CameraEdt::setROI subframe 200x200 ", "EXP 281" );
        }
        else if ( currentExpTime == 5 )
        {
            pdv_serial_command ( m_pdvDev, "EXP 593" );
            m_Logger->trace ( "CameraEdt::setROI subframe 200x200 ", "EXP 593" );
        }
        else if ( currentExpTime == 10 )
        {
            pdv_serial_command ( m_pdvDev, "EXP 645" );
            m_Logger->trace ( "CameraEdt::setROI subframe 200x200 ", "EXP 645" );
            
        }
    }
What was this meant to do? Increase the exposure time when we go to smaller ROI. In the old code, it was hard-coded to use 10ms for exposure time when you start measuring -- full frame. Then, it should go through this code when it finds the start and bump up to 145ms !

But, it never would have returned any of these value (1,2,5,10), so it wouldn't have executed this code.

We modified DIMM to have two configurable values - one for spiral search and one for measuring. (25ms and 15ms)

Code

ImageInfo DimmImageHandler::findStars ( std::vector<ushort> &_data, int _width, int _height, bool _acquisition )
{

       ...
        Statistics<ushort> stats ( _data );

        m_SrcImageInfo.width = _width;
        m_SrcImageInfo.height = _height;
        m_SrcImageInfo.min = stats.min();
        m_SrcImageInfo.max = stats.max();
        m_SrcImageInfo.mean = stats.mean();
        m_SrcImageInfo.median = stats.median();
        m_SrcImageInfo.deviation = stats.deviation();
        m_SrcImageInfo.variance = stats.variance();
        m_SrcImageInfo.threshold = ( ushort ) ( stats.median() + 3 * m_SrcImageInfo.deviation );
        m_SrcImageInfo.centroidSize.width = 30;    //TODO: Make this static values available in the configfile
        m_SrcImageInfo.centroidSize.height = 30;

06/20/2015 04:30:55.996 - DimmImageHandler::findStars - SrcImageInfo min:0 max:88 mean:0.814103 median:1 dev:1.187916 var:1.411144 thresh:4

        ...

        //Find the interesting 3x3 areas on the image
        roughPeakList = findRoughPeaks();
                  a peak is defined as the center (x,y) of a 9 pixel region (3x3) for which the mean of the flux for the 9 pixels is above the "threshold"

        //Check all peaks, if the hold a star
        m_SrcImageInfo.centroids = findCentroids ( roughPeakList );
                  for each of the peaks, get a 30x30 area around it
                      within the 30x30, calculate the background as the flux around a 5x5 area
  06/20/2015 04:30:56.052 - DimmImageHandler::findCentroids - : peaks[0] mean: 4.111111 background mean: 0.806857 dev: 1.163105
                   if peak[i].mean > 2*background_status.mean
                       bias this centroid position by the 30x30 image
                       calculate center of light for the 30x30 reduced image
                       set the centroid to be the center of light value and add to the list

        return m_SrcImageInfo;

The question is: When it fails, which of the checks is it failing?
  1. are the deviations too high for the images that fail?
  2. is the mean too low? should we have a minimum value?


FITS Notes

FINALLY, really. Made a program to read the FITS file and rewrite as the same FITS. To get it right, took many iterations and finally I see what's wrong with the DIMM version. The program is in /home/ksummers/dev/fits/ReadWriteSameFITS.cpp and the correct way to put it into FITS from 1D is:

           long naxes[2] = { width, height };   // used in the create_img FITS call
           short array2[width][height];                               
            for (y = 0; y < height; y++)                           
                for (x = 0; x < width; x++)                          
                    array2[x][y] = pixels[x*height+y]; 

The correct version is /home/ksummers/dev/fits/20150707045713-dimm-acq-corrected.fits which was created using the rwFITS program on the non-2 version from 20150707. I thought the -2- versions were right on that night, and so on 20150708 that's all that is produced. BUT - running the other one through the rwFITS to rearrange it gives just what we want -- the ds9 is right and the standalone program doesn't require the x,y swap that way.
so - how do I make that file directly??

screen snap at 20150457

Screenshot201507070457-DIMMpreview.png


FITS file pic of 201507070457-2-dimm-acq.fits
note the X,Y axes are flipped from what DIMM thinks of x (1388) and y (1024)
ds9-20150707045713-2-dimm.png

FITS file pic of 201507070457-dimm-acq-corrected.fits
note that the X,Y axes are in the same places as the DIMM preview

DS9-20150707045713-dimm-corrected.png


20150708
finally, last night on-sky, the fits files are right and produce the same answers between the standalone and DIMM.

20150707
The -2 files this night are correct this night (but swapped). The corrected (using rwFITS) -dimm-acq.fits files look better - the X,Y match to DIMM dimensions and centroids.

20150629
The FITS files with the name -dimm-acq were re-created to be correct with the program /home/ksummers/dev/fits/rwFITS and renamed with corrected in the filename.
Are the 2 files ok this night? my notes say the standalone processing worked on these, but the ds9 images are definitely not right.

20150620
The night that caused IT5618 to be opened. FITS files were not right at this time, so all dates before this time as well. I think the data is actually repeated, and so we're missing some real data. I don't think these are recoverable by just manipulating the FITS file.
I Attachment Action Size Date Who Comment
DS9-20150707045713-dimm-corrected.pngpng DS9-20150707045713-dimm-corrected.png manage 137 K 23 Jul 2015 - 18:40 UnknownUser DS9 snapshot 20150707045713-dimm-acq-corrected.fits
Screenshot201507070457-DIMMpreview.pngpng Screenshot201507070457-DIMMpreview.png manage 44 K 23 Jul 2015 - 18:38 UnknownUser DIMM camera preview screenshot at 201507070457
ds9-20150707045713-2-dimm.pngpng ds9-20150707045713-2-dimm.png manage 100 K 23 Jul 2015 - 18:39 UnknownUser DS9 snapshot 20150707045713-2-dimm-acq.fits
Topic revision: r17 - 20 Jun 2016, KelleeSummers
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback