Given below is a brief overview of calculating rms of spot position changes to test the accuracy/precision of the centroiding code. Centroids are obtained by summing over the array of size 30 by 30 around peak pixels, as opposed to the old method of using matlab built-in functions only. Still peak pixel positions were obtained by using builtin matlab function. Plese see the code detect_peaks_bygrid.m for bit more details.
My apologies for codes being well modularised and bit messy...
Please unzip the attached file to find the matlab codes.
The rest of this log is mainly put together by Kathryn.
(EDIT/PS) The attached codes were run with raw image data saved on the hard disk, but it should be relatively easy to edit the script to use images acquired real time. We are yet to play with real-time images, and still operating under Windows XP...
When calculating the rms, the code outputs the results of two
different methods. The "old" method is using the built-in matlab
method while the "new" method is one Won constructed and seems to
give a result that is closer to the expected value. In calculating
and plotting the rms, the following codes were used:
- centroid_statics_raw_bygrid.m (main script run to do the analysis)
- process_raw.m (takes raw image data and converts them into 2D array)
- detect_peaks_bygrid.m (returns centroids obtained by old and new methods)
- shuffle.m (used to shuffle the images before averaging)
The reference image frame was obtained by averaging 4000 image frames,
the test image frames were obtained by averaging 1, 2, 5, 10 ... 500,
1000 frames respectively, from the remaining 1000 images.
In order to convert rms values in units of pixels to wavefront
aberration, do the following:
aberration = rms * pixel_width * hole_spacing / lever_arm
pixel_width: 12 micrometer
hole_spacing: about 37*12 micrometer
lever_arm: 0.01 meter
rms of 0.00018 roughly corresponds to lambda over 10000.
Note: In order to get smaller rms values the images had to be shuffled
before taking averages. By setting shuffle_array (in
centroid_statics_raw_bygrid.m) to be false one can
turn off the image array shuffling.
fitted_slope = -0.481436501422376
Here are some plots:
Next logs will be about centroid testing with simulated images, and wavefront changes due to the change in the camera temperature!
(PS) I uploaded the same figure twice by accident, and the site does not let me remove a copy!...
From Won: (the zip file is also on the SVN /users/won/compiled_code/test_HS.zip)
Attached is test_HS.zip file, that contains
- test_HS.prj: project file created by Matlab Compiler. This file is not
required to run the application but I included it just in case someone's
- test_HS folder contains two subfolders src and distrib, each of which
contains the standalone application test_HS.
Usage: test_HS <path to the image folder>, for example
Make sure you create the folder prior to running the application, and the
folder name ends with "/". Running test_HS will take and save 10 images
using the camera (provided the frame grabber applications are installed in
/opt/EDTpdv), averages those 10 images and find centroids, then plots the
As I put in the eLOG, one needs MCRInstaller.bin and run it to install MCR
(probably 2008b 64bit version to test my files). If there are difficulties
getting MCRInstaller, let me know.