Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

Reproducing the Velador Experiment

Home Experiment Goals FAQ Theoretical Thermal Refraction Measuring Thermal Refraction Lateral Beam Deflection Vertical Beam Deflection Measuring Beam Deflection Optimum Beam Section Laser Camera Support Beam Mount Filter Camera & Laser Cells Components Experimental Controls Cell Installation Assembly Photos Calibration Photos Measuring the Images False Signal Simulation Phase 1 Experimental Procedure My First Trial Speculation for Phase 1 Trial 4 Trial 6 Trial 8 Dr. Osadchey's 6-11-07 Trial Trial 9 Trial 10 Trial 11 Trial 12 Trial 13 Trial 14 Trial 15 Trial 16 Conclusions for Phase 1 Trial 18 Trial 21 Trial 22 Trial 23 Trial 24 Dr. Osadchey's 11-5-07 Trial Trial 25 Trial 26 Trial 27 Trial 28 Trial 29 Trial 30 Dr. Osadchey's 12/9/07 Trials Trial 31 Trial 32 Trial 33 Results for Phase 1-B Sidereal Index Links More Links Speculation for Phase 2 Trial 34 Trial 35 Trial 36 Trial 37 Trial 39 Trial 40 Trial 41 Trial 42 Trial 43 Trial 44 Trial 45 Trial 46 Trial 47 Trial 48 Trial 50 Trial 51 Trial 52 Trial 53 Trial 54 Trial 55 Trial 56 Trial 57 Trial 58 Trial 59 Trial 60 (Denham Springs, LA) Trial 63 Trial 64A Trial 65A Trial 65B Custom Rich-Text Page Custom Rich-Text Page

Statistical Measures of Position

Initial calibration photos for this project have been primarily measured manually using MS Paint and other image viewer software.  However, the volume of images required for the current experimental plan (which must be expanded even further after initial trials, to avoid undersampling for controls) requires some automation of the measurement process.  Otherwise, data analysis alone could require up to two weeks for each 20 minute trial.  A program is required to compute statistical measures of position for each image.

Analysis Software

An internet search for freeware and shareware suitable for this purpose revealed that software for astronomical analysis, such as Astrometrica (See www.astrometrica.com, last accessed 5/11/07), has some of the necessary features to perform the desired analysis, but tends to be oriented toward analysis of point sources and lacks some of the statistical tools for evaluating the image distortions which I now believe to be inevitable with the Velador.  Thus, while Astrometrica can tell me how much my image is moving, if I want to know how much it’s smearing and in which direction, I’ll need something different.

 

Thus far, I haven’t found the required features in an existing package available for download online.  So, I patched together something of my own. 

 

This initial version of the program is written in Qbasic.  It is based on a Windows bitmap reading routine available at this web site:

 

http://www.petesqbsite.com/sections/tutorials/zines/qbcm/12-bmps.html

 

I patched in a statistical analysis routine to compute Mean, Median, and Modal position, with Standard Deviation of position, and I was in business.

 

'header

TYPE BMPheaderType

 ID AS STRING * 2            'Should be 'BM' for a windows BMP.

 FileSize AS LONG            'Size of the whole file.

 Reserved AS STRING * 4

 ImageOffset AS LONG         'Offset of image data in file.

 InfoHeaderLength AS LONG    'The BitmapInfoHeader starts directly               

                             'after this header. It could be:

                             '       12 bytes - OS/2 1.x format, or

                             '       40 bytes - Windows 3.x format, or

                             '       64 bytes - OS/2 2.x format.

 ImageWidth AS LONG          'Width and height of the image, in pixels.

 ImageHeight AS LONG         ' -

 NumPlanes AS INTEGER        'Number of planes.

 BPP AS INTEGER              'Bits per pixel, the colour depth. Could

                             'be:

                             '       4 bit - 16 colours.

                             '       8 bit - 256 colours.

                             '       24 bit - A lot more colours.

 CompressionType AS LONG     'Type of compression.

                             '       0 - uncompressed,

                             '       1 - RLE 8-bit/pixel

                             '       2 - RLE 4-bit/pixel

 ImageSize AS LONG           'Size of image data in bytes.

 xRes AS LONG                'Horizontal and vertical resolution of the

 yRes AS LONG                '   image.

 NumColsUsed AS LONG         'Number of used colours and number of

 NumColsImportant AS LONG    '   important colours.

END TYPE

 

'recover information

DIM SHARED BMPheader AS BMPheaderType

 

'Screen mode and open I/O files for analysis

CLS : SCREEN 12

bmpfile$ = "c:\analysis\photos\img_18~1.bmp"

savefile$ = "c:\analysis\stats.csv"

 

OPEN bmpfile$ FOR BINARY AS #1

 GET #1, , BMPheader

 

OPEN savefile$ FOR APPEND AS #2

'x and y Distributions

DIM ydistrib(BMPheader.ImageHeight)

DIM xdistrib(BMPheader.ImageWidth)

'Display Scale

scale = 480 / BMPheader.ImageHeight

 

'Set Up Palette

  'Reset the VGA palette ports.

  '

  OUT &H3C8, 0

  'Template strings, so QB knows how many bytes to get out of the file

  'at a time.

  '

     Red$ = " ": Green$ = " ": Blue$ = " "

     byte$ = " "

 

     '2 ^ BMPheader.BPP is the number of colours used in the file.

     '

     FOR i = 1 TO 2 ^ BMPheader.BPP

       

      'Because the BMP stores the palette BGR, and the VGA takes it in

      'as RGB, we need to get all the palette values for the colour and

      'give them to the VGA one at a time, in reverse order (not

      'forgetting the byte of filler):

      '

      GET #1, , Blue$

      GET #1, , Green$

      GET #1, , Red$

      GET #1, , byte$

 

      'All the colour attributes must be divided by 4, as they go 0-255

      'whereas the VGA card prefers 0-63.

      '

      OUT &H3C9, ASC(Red$) \ 4

      OUT &H3C9, ASC(Green$) \ 4

      OUT &H3C9, ASC(Blue$) \ 4

     NEXT i

 

'Load Palette into String

 DIM SHARED Pal AS STRING * 768

 

 'Reset the palette string.

 '

 Pal = ""

 

 Red$ = " ": Green$ = " ": Blue$ = " ": byte$ = " "

 

 FOR i = 1 TO 2 ^ BMPheader.BPP

  GET #1, , Blue$

  GET #1, , Green$

  GET #1, , Red$

  GET #1, , byte$

  Pal = Pal + CHR$(ASC(Red$) \ 4)

  Pal = Pal + CHR$(ASC(Green$) \ 4) + CHR$(ASC(Blue$) \ 4)

 NEXT i

 

'get data

 byte$ = " "

 'Compute mean and median

 count& = 0

 minx% = BMPheader.ImageWidth

 miny% = BMPheader.ImageHeight

 FOR y% = BMPheader.ImageHeight - 1 TO 1 STEP -1

     FOR x% = 0 TO BMPheader.ImageWidth - 1

         spot& = x% + y% * (BMPheader.ImageWidth)

         GET #1, spot&, byte$

         col% = (ASC(byte$) / 16 - INT(ASC(byte$) / 16)) * 16

         IF col% = 10 THEN

          count& = count& + 1

          meanx = meanx + x%

          meany = meany + y%

          IF x% > maxx% THEN maxx% = x%

          IF y% > maxy% THEN maxy% = y%

          IF x% < minx% THEN minx% = x%

          IF y% < miny% THEN miny% = y%

          ydistrib(y%) = ydistrib(y%) + 1

          xdistrib(x%) = xdistrib(x%) + 1

         END IF

         PSET (x% * scale, y% * scale), col%

     NEXT

    NEXT

 meanx = meanx / count&

 meany = meany / count&

 medianx% = (maxx% + minx%) / 2

 mediany% = (maxy% + miny%) / 2

 

 'compute mode

 modex% = 0

 modey% = 0

 FOR y% = miny% TO maxy%

  IF ydistrib(y%) > modey% THEN modey% = ydistrib(y%)

 NEXT y%

 FOR x% = minx% TO maxx%

  IF xdistrib(x%) > modex% THEN modex% = xdistrib(x%)

 NEXT x%

        

 'compute variance

 FOR y% = BMPheader.ImageHeight - 1 TO 1 STEP -1

     FOR x% = 0 TO BMPheader.ImageWidth - 1

         spot& = x% + y% * (BMPheader.ImageWidth)

         GET #1, spot&, byte$

         col% = (ASC(byte$) / 16 - INT(ASC(byte$) / 16)) * 16

         IF col% = 10 THEN

             variancey = variancey + (y% - meany) * (y% - meany)

             variancex = variancex + (x% - meanx) * (x% - meanx)

 

         END IF

         PSET (x% * scale, y% * scale), col%

     NEXT

 NEXT

 

 variancex = (variancex / count&)

 variancey = (variancey / count&)

 stdevx = SQR(variancex)

 stdevy = SQR(variancey)

 

 LOCATE 1, 1: PRINT "MEAN"; meanx, meany

 LOCATE 2, 1: PRINT "STD DEV"; stdevx, stdevy

 LOCATE 3, 1: PRINT "MEDIAN"; medianx%, mediany%

 LOCATE 4, 1: PRINT "MODE"; modex%, modey%

 PRINT #2, bmpfile$

 PRINT #2, meanx; ","; meany; ",";

 PRINT #2, stdevx; ","; stdevy; ",";

 PRINT #2, medianx%; ","; mediany%; ",";

 PRINT #2, modex%; ","; modey%;

 CLOSE #1

 CLOSE #2

 END

  

This simplistic program requires scrubbing the image first.  The *.JPG image downloaded from the camera must be converted to 256 color bitmap format, and the area of interest (the central peak of the image) must be highlighted in color 10 (Light Green, Fifth from the left in the default MS Paint 256 color bitmap pallet).  This can be done using the “Fill With Color” function in MS Paint.  Further scrubbing of the image is desirable by selecting and editing out all regions of the image which are not color 10 to save processing time.  (It’s also made necessary by a bug in the program version listed above, which reads every color with a remainder of 0.625 after division by 16 as color 10.  Thus far, it hasn’t been necessary to fix it, just work around it.  I susbscribe to the “use a bigger hammer” school of debugging, and it’s not like I expect to develop it anyway.  I will revise it as needed.)  

 

The mean x position is taken by adding up all the x values with color 10 and taking the average. 

 

xavg = Σxi / n

 

the mean y position is computed similarly. 

 

Variation in the mean position and other statistical measures of image position between images implies motion of the image.  The center of the image range is located at the median position, while the image is widest/tallest at the modal position.  The standard deviation computed is partly determined by the noise at the central peak boundary, but is a better measure of the central peak size than noise at the boundary.  Variation in the computed standard deviation between images reflects changes in size due to smearing, increased noise, and other distortions of the image.

 

Analysis using this software has revealed that the central peak of the image is indeed the only reliable portion of the image for assessing deflection of the laser beam.  Changes in the angle of the laser beam create slight changes in the surrounding interference rings due to the difference in angle of incidence on the CCD, internal reflection within the laser aperture and camera CCD chamber, and internal reflection within the CCD chip itself.  Reproducible changes in the interference pattern can be caused simply by adjusting the laser mounting cell.  That’s problematic, because portions of the interference rings may not be separable from the central peak in some images.  However, I believe that this can be sufficiently compensated to preserve accuracy. 

 

Below is a table of computed statistical measures for some calibration images, all taken with the same orientation.  The first image (image 6) was taken with slight pressure against the camera cell.  The others were all taken without any external loading.

 
 MeanStd DevMedianMode
Imagexyxyxyxy
6542.8112487.8855137.7369116.2768542502445578
11551.3033460.9974139.5226113.5131547476435582
12551.2676460.9391139.3873113.379548476434583
13551.8746460.6311139.387113.5175548476435581
14551.5699460.6011139.281113.4441548476435580
15551.4931460.5126139.4045113.5438548476435585
16551.6842460.2592139.1705113.4129548475434582
17552.2171460.4806139.0302113.4389549476435582
18552.2429460.4363139.2085113.514548476435583

 The following is a data set taken without proper allowance for damping in the mount, as discussed in the section on Measuring Beam Deformation.

Calibration Run 2
ImageMEANStd DevMedianMode
xyxyxyxy
South1313.7844465.1552367.0934121.0986640476445510
East1278.7082479.7363226.9978119.8264640490444536
North1276.9335472.0731170.7715119.0419640482446542
West1347.4396466.6916133.2548117.8484334476441555
South2417.7161480.5315134.0123117.8534403489438555
East2364.6642483.6656133.9948118.0966354494440557
North2331.2129486.6432132.7668118.6879320496443555
West2348.6731488.3358133.6611118.514336500440552
South3399.2028483.2316134.0558117.8885388493438556

The motion of the mount manifests as seamingly random variations in the motion of the image.  Only the last five images (last turn of the calibration trial) were given proper damping time.  Although these values are consistent with circular motion of the image, they also show possible smearing and are less than 60% of the trial data.  No significance can be assigned.