40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  TCS elog, Page 2 of 5  Not logged in ELOG logo
ID Date Author Type Categorydown Subject
  2   Thu Dec 10 22:23:47 2009 Not AidanLaserLaserTest

Yes.

Quote:

 Does this work?

  90   Tue Aug 17 16:31:55 2010 AidanThings to BuyLaserBought a laser diode from Thorlabs for HWS

http://www.thorlabs.com/thorProduct.cfm?partNumber=CPS180

I bought this laser diode from Thorlabs today to try the current modulation trick Phil and I discussed last Friday. 

That is:

  1. Accept that there will be interference fringes on the Hartmann sensor probe beam with a laser diode source (especially if the probe beam is the retro-reflection from a Michelson interferometer with a macroscopic arm length difference)
  2. Modulate the current of the laser diode source to vary its wavelength by a few hundreds on nm. Do this on a time scale that is much faster than the exposure time for a Hartmann sensor measurement
  3. The contrast of the interference fringes should average out and the exposure should appear to be the sum of two incoherent beams.

 

 

 

  93   Mon Aug 23 08:43:16 2010 AidanThings to BuyLaserBought a laser diode from Thorlabs for HWS

It arrived on Friday.

Quote:

http://www.thorlabs.com/thorProduct.cfm?partNumber=CPS180

I bought this laser diode from Thorlabs today to try the current modulation trick Phil and I discussed last Friday. 

That is:

  1. Accept that there will be interference fringes on the Hartmann sensor probe beam with a laser diode source (especially if the probe beam is the retro-reflection from a Michelson interferometer with a macroscopic arm length difference)
  2. Modulate the current of the laser diode source to vary its wavelength by a few hundreds on nm. Do this on a time scale that is much faster than the exposure time for a Hartmann sensor measurement
  3. The contrast of the interference fringes should average out and the exposure should appear to be the sum of two incoherent beams.

 

 

 

 

  107   Fri Feb 18 14:53:50 2011 PhilLaserLaserLTG laser delivering specified power

I got the LTG CO2 laser to deliver 50.02W as measured by the Thorlabs 200W power head today. This required running the Glassman HV supply at full power (30.0kV, 31.1mA), tweaking the end grating and output coupler alignments, and cleaning the ZnSe Brewster windows on the laser tubes, and it only lasted a few seconds before dropping back to ~48W, but the laser delivered the specified power. In the factory it delivered 55W at the 10.6 micron line I am using now- I checked it with the CO2 laser spectrum analyzer- so there is more work to do.

  110   Thu Feb 24 10:23:31 2011 Christopher GuidoLaserLaserLTG initial noise

Cheryl Vorvick, Chris Guido, Phil Willems

Attached is a PDF with some initial noise testing. There are 5 spectrum plots (not including the PreAmp spectrum) of the laser. The first two are with V_DC around 100 mV, and the other three are with V_DC around 200 mV. (As measured with the 100X gain preamplifier, so ideally 1 and 2 mV actual) We did one spectrum (at each power level)  with no attempt of noise reduction and one spectrum with the lights off and a make shift tent to reduce air flow. The 5th plot is at 200mv with the tent and the PZT on. (The other 4 have the PZT off).

 

The second plot is just the spectrums divided by their respectives V_DC to get an idea of the RIN.

Attachment 1: LTG_InitialTest.pdf
LTG_InitialTest.pdf LTG_InitialTest.pdf
  150   Thu May 26 11:56:46 2011 AidanElectronicsLaserGreen Laser Pointer beam profile

This measurement was made with the Thorlabs DCC1545M-GL camera with an RG850 3mm long-pass filter over the CCD.

The beam radius (w) is 191 pixels, where the beam intensity = exp[-2 (x/w)^2 ]

The pixel size is 5.2um. Hence the beam size is 993.2um, which is basically near enough to 1mm radius.

 

Attachment 1: green_laser_pointer.bmp
Attachment 2: green_laser_pointer.pdf
green_laser_pointer.pdf
Attachment 3: Screen_shot_2011-05-26_at_12.28.20_PM.png
Screen_shot_2011-05-26_at_12.28.20_PM.png
  207   Thu Feb 8 15:42:13 2018 AidanLaserLaserLow power CO2 laser [400mW] beam size measurement

I did a beam size/beam propagation measurement of the low power CO2 laser (Access Laser L3, SN:154507-154935)

 

Attachment 1: L3_CO2_laser_beam_size.m
% 400mW CO2 laser beam propagation measurement
% measurements of Access Laser L3 CO2 output power (at about 30% PWM)
% SN: 154507-154935
%
% Aidan Brooks, 8-Feb-2018

xposn = 10.5:-0.5:5.0;
dataIN = [25	113.2	113.2	112.7	112.3	110.2	108.6	98.2	74.6	40.6	13.5	2.3	0.3
50	114.5	114.5	114.9	115	114.9	112.1	100	74.2	38.8	12.5	2	-0.1
... 62 more lines ...
Attachment 2: L3_CO2_Laser_154507-154935.pdf
L3_CO2_Laser_154507-154935.pdf
  156   Tue Nov 29 09:13:49 2011 ranaMiscLIGO 3GSwitching from CO2 to shorter wavelength solid state laser

 Around a year ago, Phil and I discussed the possibility of using an OPO to possibly generate our own laser beam at ~2 microns for TCS. This was to avoid all of the usual hassle of the 10 micron CO2 laser.

As it turns out, the 1.5-3 micron range doesn't have enough absorption in fused silica: the absorption depth would be basically the whole thickness of the optics and this is not so useful when trying to correct surface heating.

During my recent trip to JILA, Jan Hall mentioned to me that it should be possible to operate instead at ~5 microns, where laser technology may be solid state and where we can use Si:As detectors instead of the inefficient HgCdTe ones which we use now.

JWST, in partnerships with industry, have developed some Si:As detectors:  http://www.jwst.nasa.gov/infrared.html   

Some internet searching shows that there are now several laser technologies for the mid-IR or MWIR range. Some are <1 W, but some are in the ~10 W range.

Of course, its possible that we'll switch to Silicon substrates, in which case we need to re-evaluate the goals and/or existence of TCS.

  159   Thu Jun 7 00:23:11 2012 Aditi MittalMiscLIGO 3GSummary June 5 and June 6, 2012

 June 5

-Discussed the actual project outline 

-Installed Comsol on the system

-Learned the basics of Comsol with the help of tutorials available on 40m wiki

and others.

 

June 6

-Made few simple models in Comsol 

-Studied LIGO GWADW slides for a better understanding of the project.

-Setup SVN to access remote repository.

 

 

 

  161   Thu Jun 7 23:24:56 2012 Aditi MittalMiscLIGO 3GSummary June 7, 2012

-Created a COMSOL model for variation of temperature in two mass system.

-Used the above model for cryogenic conditions.

-checked it analytically.

  163   Fri Jun 8 23:51:13 2012 Aditi MittalMiscLIGO 3GSummary June 8, 2012

-Created a COMSOL model for cryogenically shielded test mass with compensation plate.

-Analyzed the behavior of the model in different size configurations.

  165   Mon Jun 11 20:53:31 2012 Aditi MittalMiscLIGO 3GSummary June 11, 2012

 -Continued with the same cryogenic model created and varied the length of  outer shield and studied the temperature variation inside.

-Compared the temperature difference given by COMSOL with manually calculated one.

  167   Thu Jun 14 05:37:30 2012 Aditi MittalMiscLIGO 3GSummary June 13, 2012

-Derived formula for manual calculation of temperature due to total influx.

-Compared the results by COMSOL and by the formula.

  170   Mon Jun 18 23:42:39 2012 Aditi MittalMiscLIGO 3GCryogenic Shielding

 -Read about blue team design for maximum power budget.

-Read third generation talks to get a better understanding of the work. 

  173   Thu Jun 21 11:16:27 2012 Aditi MittalMiscLIGO 3GSummary June 19 and 20, 2012

 -Attented LIGO orientation meeting and safety session.

-Prepared 3 week report

 

Attachment 1: temp_of_test_mass.png
temp_of_test_mass.png
  175   Thu Jun 21 18:35:44 2012 Aditi MittalMiscLIGO 3GSummary June 21, 2012

 -Updated 3 week progress report with new additions and deletions.

-Attended LIGO lecture which was very interesting and full of information.

  176   Tue Jun 26 17:55:44 2012 Aditi MittalMiscLIGO 3GSummary June 26, 2012

- Discussed the further project with Dr. Brooks.

-Tried to derive formula for the test mass inside cryogenic shield(infinitely long shield from one side)

 

 

 

  179   Fri Jun 29 15:51:24 2012 Aditi MittalMiscLIGO 3GSummary June 28 and 29, 2012

 -Discussed the project outline for next 6 weeks.

-made a write up for the tasks. (attached)

-Analyzed the variation of temperature of the test mass with input power for different lengths of the shield. 

Attachment 1: pipelength_power.xlsx
Attachment 2: 6week_plan.doc
  17   Mon Apr 12 08:55:37 2010 AidanComputingHartmann sensorEDT frame grabber is here

 The EDT PCIe4 DV C-Link frame grabber arrived this morning. There is a CD of drivers and software with it that I'll back up to the wiki or 40m svn sometime soon.

  18   Mon Apr 12 17:25:01 2010 AidanElectronicsHartmann sensorFiber-Camera Link demonstration

 I installed the EDT PCIe4 DV C-Link frame grabber in a spare Windows XP PC and connected the Dalsa 1M60 camera directly to it via the CameraLink cable. In this configuration I was able to access the menu system in the camera using the supplied serial_cmd.exe routine.

PC --> Frame-Grabber --> Camera-Link Cable --> Dalsa 1M60: works OK

Next, I attached the RCX C-Link: Fiber to Camera Link converters to either end of a 300' fiber, plugged them into the PC and the Dalsa 1M60 and then supplied them with 5V of power. Once again, I was able to access the on-board menu system in the camera (as the attached screen-capture shows). I also did a quick-test using the in-built video display program and verified that I could get an image from the camera - by waving around my hand in front of the CCD I was able to modulate the light in the image on the computer. This, therefore, demonstrates that the camera can be easily accessed and run at a distance of at least 300' via optical fiber.

 

PC --> Frame-Grabber --> RCX C-Link --> 300' optical fiber --> RCX C-Link --> Dalsa 1M60works OK

The attached images:

 hartman_sensor.JPG: a screencap of the Dalsa 1M60 on-board menu system captured with the C-Link to fiber connector running

Fiber_Camera_Link_1.jpg: A RCX C-Link and one end of the 300' fiber connected to the Dalsa 1M60

 

Fiber_Camera_Link_3.jpg: A RCX C-Link and the other end of the 300' fiber connected to the PC

 

 

 

 
 
 
 
 
 
 
 
 

 

Attachment 1: hartmann_sensor.JPG
hartmann_sensor.JPG
Attachment 2: Fiber_Camera_Link_1.jpg
Fiber_Camera_Link_1.jpg
Attachment 3: Fiber_Camera_Link_3.jpg
Fiber_Camera_Link_3.jpg
  19   Thu Apr 15 01:47:47 2010 Won KimComputingHartmann sensorNotes on installing EDT PCIe4 DV frame grabber
* EDT PCIe4 DV frame grabber: installation notes for linux system 

(Note)

Main issue I encountered was the fact that most of the shell scripts
did not run by simply entering them. It's bit strange because if you
do ls -al to view the file lists they are made executable. So it's
possible that others don't encounter the same kind of problems as I
did.

However, if one executes the command "./linux.go", for example, and
receives the message saying

 bash: ./linux.go: /bin/sh: bad interpreter: Permission denied

then one may follow the steps I took as below.


1. Make a folder to put the content of CD, for example:

     mkdir ~/fgdriver

2. Copy the content of the CD-ROM to the folder.

3. Go to the folder.

     cd ~/fgdriver

4. Change or check the mode of the following script files (using the 
   command chmod) to be executable (using "chmod a+x filename"):

     linux.go

     ~/fgdriver/linux/EDTpdv/installpdv (this one should already be 
     executable)

     ~/fgdriver/linux/EDTpdv/pdv/setup.sh      

5. run ./linux.go and choose DV by clicking it.

(Note)

I am assuming that the programming language Tcl is already installed
in the machine. CentOS 5.4 that I have installed came with Tcl. If Tcl
is not installed, I think that linux.go will run cli_startmenu.sh
instead (located in the same directory as linux.go). So make sure
cli_startmenu.sh is executable (see step 4).

6. Choose default installation directory and start installation

(Note) 

In my first attempt to install the files, the installation message
window hung after displaying many lines of "........". That was
because the file setup.sh was not made executable (see step 4). So I
made setup.sh executable, ran linux.go again, then I could see further
messages flowing through (basically compiling c source files). I'm not
sure whether others will enounter the exactly same problem though.

7. After the installation completes, go to the /opt/EDTpdv folder.

     cd /opt/EDTpdv

8. Final Step: Make edt_load and edt_unload executable. (See step 4)

(Note)

Most of the other executables we need for running the frame
grabber/camera should already be executable at this point; but somehow
in my installation the above two files were not made executable. I
again do not know whether others will experience the same
problem. Since there are lots of executables generated when
installation completes, I advise that, whenever a certain command does
not run, one should check if that command file is executable or not.

----

Please let me know if you find any parts of the above confusing. I will
do my best to clarify.
  20   Tue Apr 20 18:05:24 2010 AidanComputingHartmann sensorImages off the Dalsa Camera in CentOS

 I installed CentOS on the machine with the EDT frame-grabber. I then installed the frame-grabber software from the CD.

In the /opt/EDTpdv/ directory the camconfig program was run and I entered "331" to start the frame-grabber and run with the Dalsa 1M60 settings ... this was necessary to get the frame grabber running, but didn't seem to force pdvshow, installed at a later point, to use this configuration file. At this point I could access the camera menu with the serial_cmd program.

 

After some effort, which will be detailed shortly, I managed to finally get the pdv_show GUI program compiled and installed. I found that trying to run that program with the dalsa_1m60.cfg configuration file resulted in a segmentation fault.

However, when I ran it with the default Dalsa configuration file, pantera11m4fr.cfg, and selected "Continuous Exposure" I got a stream of illuminated pixels on the screen. It was clear that the display was displaying the pixels coming back from the camera in the wrong way (for instance, trying to load a 1024x1024 image into a 1440x900 array), however, by changing the frame rate on the camera to 20Hz and waving my hand around in front of the camera I was able to modulate the intensity of the hash of pixels being displayed. This means that the frame-grabber is successfully getting data - it just isn't interpreting it correctly yet.

Here are a couple of images from pdv_show (hit Alt+PrtScrn to get a screenshot of the active window):

 1. Screenshot-PCI_DV_Display.png - the image on the computer with the camera running unobscured

2. Screenshot-PCI_DV_Display-1.png - the image on the computer with me covering the camera with my hand.

3. -opt-EDTpdv.png - the camera parameters at the time of this test (running serial_cmd)

 

Attachment 1: Screenshot-PCI_DV_Display.png
Screenshot-PCI_DV_Display.png
Attachment 2: Screenshot-PCI_DV_Display-1.png
Screenshot-PCI_DV_Display-1.png
Attachment 3: -opt-EDTpdv.png
-opt-EDTpdv.png
  23   Thu Apr 22 08:20:51 2010 AidanComputingHartmann sensorInstalled MATLAB and Windows XP Virtualization on Hartmann machine

I installed a Windows XP virtualization on the Hartmann machine. It can be accessed from the desktop, or by running virt-manager at the command line. Once the virtualization manager starts the virtualization of Windows needs to be started. It runs quite slowly.

I also installed MATLAB on this machine in /apps/. TThis was intended to be /apps/MATLAB/ but apparently the install program doesn't add a top directory called MATLAB as you might expect. I had to run a yum install libXp because it was complaining that "/apps/bin/glnxa64/MATLAB: error while loading shared libraries: libXp.so.6: cannot open shared object file: No such file or directory"

  27   Tue May 4 09:18:15 2010 AidanComputingHartmann sensorAdded aliases and icons for EPICS commands and dataviewer etc. to hartmann

I updated the .bashrc file in controls@hartmann to include aliases for the ezca EPICS commands and a few others. Details shown below:

Also added launchers to the top panel for MATLAB, sitemap, dataviewer and StripTool. The icons for the launchers are located in:

/cvs/users/ops/ligo-launchers/icons

Changes to .bashrc

alias dv="/cvs/opt/apps/Linux/dataviewer/dataviewer"
alias StripTool = "/cvs/opt/apps/Linux/medm/bin/StripTool"
alias medm="/cvs/opt/apps/Linux/medm/bin/medm"
alias sitemap='medm -x /cvs/cds/caltech/medm/c2/atf/C2ATF_MASTER.adl'

# EPICS aliases
alias ezcademod="/cvs/opt/apps/Linux/gds/bin/ezcademod"
alias ezcaread="/cvs/opt/apps/Linux/gds/bin/ezcaread"
alias ezcaservo="/cvs/opt/apps/Linux/gds/bin/ezcaservo"
alias ezcastep="/cvs/opt/apps/Linux/gds/bin/ezcastep"
alias ezcaswitch="/cvs/opt/apps/Linux/gds/bin/ezcaswitch"
alias ezcawrite="/cvs/opt/apps/Linux/gds/bin/ezcawrite"

  28   Tue May 4 10:30:07 2010 AidanComputingHartmann sensorEPICS and MEDM screen for Hartmann sensor

I added the Dalsa 1M60 temperature measurements to EPICS. The break down is as follows:

  Digitizer Board Temperature Sensor Board Temperature
Dalsa 1M60 menu command vt vt

Response from 1M60

Camera Temperature on Digitizer Board: 47.2 Celsius Camera Temperature on Sensor Board: 39.4 Celsius
Menu accessed via MATLAB: unix('/opt/EDTpdv/serial_cmd vt') MATLAB: unix('/opt/EDTpdv/serial_cmd vt')
Temperature stored in MATLAB: local variable called DBtemp (from the numerical sub-string) MATLAB: local variable called SBtemp (from the numerical sub-string)
EPICS channel written via MATLAB: unix(['ezcawrite {channel-name} ' num2str(DBtemp)]) MATLAB: unix(['ezcawrite {channel-name} ' num2str(SBtemp)])
EPICS channel defined in HWS.db HWS.db
Channel name C4:TCS-HWS_TEMP_DIGITIZER C4:TCS-HWS_TEMP_SENSOR

I added a softIoc called HWS to /cvs/cds/caltech/target/softIoc. It added the channels following channels: C4:TCS-HWS_TEMP_DIGITIZER and C4:TCS-HWS_TEMP_SENSOR. The ioc (input/output controller) is run with the following command:

 

/cvs/opt/epics-3.14.10-RC2-i386/base/bin/linux-x86/softIoc HWS.cmd

although this doesn't execute it in the background. The MATLAB routine /home/controls/matlab_scripts/read_dalsa_temperature_write_to_epics.m is run continuously to access the serial port, get the temperature data and to write it to the EPICS channels. These were then available to read in the Hartmann sensor MEDM screen which is shown below. Also shown is a StripTool monitoring the temperatures. I had just turned off a fan that was cooling the 1M60 which is why the temperature is rising.
 
 
 

 

 

Attachment 1: Screenshot-C4HWS_medm_21.adl_(edited).png
Screenshot-C4HWS_medm_21.adl_(edited).png
Attachment 2: Screenshot-StripTool_Graph_Window.png
Screenshot-StripTool_Graph_Window.png
Attachment 3: HWS.db
record(ai,"C4:TCS-HWS_TEMP_DIGITIZER")


record(ai,"C4:TCS-HWS_TEMP_SENSOR")
Attachment 4: HWS.cmd
dbLoadRecords "HWS.db"
iocInit
Attachment 5: read_dalsa_temperature_write_to_epics.m
% get the temperature off the 1M60
% written by Aidan Brooks. 22nd Apr 2010

% define aliases
ezcawrite = '/cvs/opt/apps/Linux/gds/bin/ezcawrite';


ii = 1;
while ii == 1
    [s, r] = unix('/opt/EDTpdv/serial_cmd vt');
... 54 more lines ...
  29   Tue May 4 13:35:13 2010 AidanComputingHartmann sensorHartmann temperature channels in frame builder

 I've added the digitizer and sensor board temperature readings from the HWS to the frames. This was done in the following way

1. Create a new file /cvs/cds/caltech/chans/daq/C4TCS.ini - with the channels in it - see below

2.  open /cvs/cds/caltech/target/fb1/master

3. add a line that includes the C4TCS.ini file when the frame builder starts

4. restart frame-builder by killing the daq daemon - kill <process id for daqd> (this is the only thing that needs to be entered as it will automatically restart)

 

C4TCS.ini

 

[default]

dcuid=4

datarate=16

gain=1.0

acquire=1

ifoid=0

datatype=4

slope=1.0

offset=0

units=NONE

 

 

 

[C4:TCS-HWS_TEMP_SENSOR]

[C4:TCS-HWS_TEMP_DIGITIZER]


 

 

 

  30   Wed May 5 09:04:01 2010 AidanComputingHartmann sensorAdded /home/controls/scripts/modules directory to PYTHONPATH on hartmann

 I added the following line to ~/.bashrc

 

export PYTHONPATH=/home/controls/scripts/modules:/usr/local/lib/python

This adds the above directory to PYTHONPATH and allows those modules in that directory to be access from anywhere.

 

  31   Wed May 5 18:45:51 2010 AidanComputingHartmann sensorPython code to interface the Dalsa1M60 and export the temperature to EPICS

Python script

I wrote a Python script, ~/scripts/dalsa_to_epics.py that reads the temperature off the camera using serial_cmd vt and then it writes this to the EPICS channels using ezcawrite. See attached. It is now running continuously in the background as dalsa_to_epics.

Dalsa1M60 baud rate

Also I accessed the menu of the 1M60 and changed the baud rate to 115200 using sbr 115200. Then I edited the dalsa_1m60.cfg file to set the baud rate to 115200 in that file. Finally, I changed the settings on the camera so that it will boot with the new baud rate when it is turned off and on again - this was with wus in the camera menu.

All the files are attached.

~/scripts/dalsa_to_epics.py

~/scripts/Dalsa1M60/VerifyTemperature.py

/opt/EDTpdv/camera_config/dalsa_1m60.cfg

Attachment 1: dalsa_to_epics.py
#!/usr/bin/python

# Import the Dalsa1M60 packzge
import Dalsa1M60, subprocess

# define the serial command location
serial_cmd_location = '/opt/EDTpdv/serial_cmd'

# start a loop that continually gets the temperatures
getTemperatures = 1
... 18 more lines ...
Attachment 2: VerifyTemperature.py
#!/usr/bin/python

# part of the Dalsa1M60 package
# a module for verifying the temperature of the Dalsa 1M60
#
# The serial command 'vt' is sent to the camera. The camera responds as follow
s
#    > vt
#    Camera Temperature on Digitzer Board: 47.2 Celsius
#    Camera Temperature on Sensor Board: 39.4 Celsius
... 65 more lines ...
Attachment 3: dalsa_1m60.cfg
#
# CAMERA_MODEL "Dalsa 1m60 config file (freerun)"
#

# camera name/description
#
camera_class:                  "Dalsa"
camera_model:                  "1M60"
camera_info:                   "12 bit dual channel camera link"

... 51 more lines ...
  32   Thu May 6 10:34:38 2010 AidanComputingHartmann sensorEPICS and MEDM screen for Hartmann sensor - part 2

I added the camera parameters to EPICS and the MEDM screen. These are available as channels now in EPICS and eventually there will be a python script that writes the EPICS value to those channels, but right now it is just a python script that reads the values off the Dalsa camera.

I updated the channels in /cvs/cds/caltech/chans/daq/C4TCS.ini so that these are saved to the daq and I also restarted the daq daemon.

The python script that gets the camera parameters is here: scripts/Dalsa1M60/GetCameraParameters.py and the script that writes the parameters to the EPICS channels is here scripts/dalsa_to_epics.py.

These are attached as is C4TCS.ini and HWS.db which defines the new channels.

Attachment 1: dalsa_to_epics.py
#!/usr/bin/python

# Import the Dalsa1M60 packzge
import Dalsa1M60, subprocess

# define the serial command location
serial_cmd_location = '/opt/EDTpdv/serial_cmd'

# start a loop that continually gets the temperatures
getTemperatures = 1
... 75 more lines ...
Attachment 2: GetCameraParameters.py
#!/usr/bin/python

# NAME
#       GetCameraParameters - a module for getting the Dalsa 1M60 parameters
#
# PACKAGE
#       Part of the Dalsa1M60 python package
#
# SYNOPSIS
#       GetCameraParameters( serial_cmd_location  )
... 412 more lines ...
Attachment 3: HWS.db
record(ai,"C4:TCS-HWS_TEMP_DIGITIZER")
record(ai,"C4:TCS-HWS_TEMP_SENSOR")
record(ai, "C4:TCS-HWS_TAP1GAIN")
record(ai, "C4:TCS-HWS_TAP2GAIN")
record(ai, "C4:TCS-HWS_PRETRIGGER")
record(ai, "C4:TCS-HWS_DATA_MODE")
record(ai, "C4:TCS-HWS_BINNING_MODE")
record(ai, "C4:TCS-HWS_GAIN_MODE")
record(ai, "C4:TCS-HWS_OUTPUT_CONFIG")
record(ai, "C4:TCS-HWS_EXPOSURE_MODE")
... 27 more lines ...
Attachment 4: C4TCS.ini
[default]
dcuid=4
datarate=16
gain=1.0
acquire=1
ifoid=0
datatype=4
slope=1.0
offset=0
units=NONE
... 14 more lines ...
  33   Thu May 6 12:32:11 2010 AidanComputingHartmann sensordalsa_to_epics Python script crashed ...

Here's the error:

 

 Traceback (most recent call last):

  File "./dalsa_to_epics.py", line 81, in ?
    stdout = subprocess.PIPE)    
  File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.4/subprocess.py", line 916, in _execute_child
    errpipe_read, errpipe_write = os.pipe()
OSError: [Errno 24] Too many open files

[2]+  Exit 1                  ./dalsa_to_epics.py  (wd: ~/scripts)
(wd now: /cvs/users/abrooks/advLigo/HWS)
 
  34   Thu May 6 21:32:26 2010 Won KimComputingHartmann sensorPeak detection and centroiding code

 

 

Attached is .m file of the custom function that I wrote and used to automatically detect peaks in a Hartmann image,
and calculate the centroid corrdinates of each of those peaks.

A simple example of its usage,  provided that myimage is a two-dimensional image array obtained from the camera, is

 

radius = 10;

peak_positions = detect_peaks_uml(myimage,radius);

no_of_peaks = length(peak_positions);

centroids_array = zeros(no_of_peaks);

for k = 1:no_of_peaks

  centroids_array(k,1) = peak_positions(k).WeightedCentroid(1);

  centroids_array(k,2) = peak_positions(k).WeightedCentroid(2);

end

 

I chose my value of radius by looking at spots in a sample image and counting the number of pixels across a peak. It may be 
more useful to automatically obtain a value for the
radius. I may run some tests to see how different choices of radius
affect the centroid calculations. 

I may also need to add some error checking and/or image validating codes, but so far I have not encountered any problems. 

Please let me know if anyone needs more explanation!

Won

Attachment 1: detect_peaks_uml.m
function ctr = detect_peaks_uml(image,radius)
% Usage example:
% positions = detect_peaks_uml(myimage,10);
% 
% total number of peaks detected: length(positions.WeightedCentroid)
% access the coordinates of the nth peak:
% positions(n).Weightedcentroid(1), positions(n).WeightedCentroid(2)

weighted_image = image .^ 2;
background = imopen(weighted_image,strel('disk',radius));
... 11 more lines ...
  35   Tue May 11 10:32:00 2010 AidanComputingHartmann sensorPeak detection and centroiding code - review

This looks really efficient! However, I think there's a systematic error in the calculation. I tested it on some simulated data and it had trouble getting the centroids exactly right. I need to better understand the functions that are called to get an idea of what might be the problem.

 

Quote:

 

 

Attached is .m file of the custom function that I wrote and used to automatically detect peaks in a Hartmann image,
and calculate the centroid corrdinates of each of those peaks.

A simple example of its usage,  provided that myimage is a two-dimensional image array obtained from the camera, is

 

radius = 10;

peak_positions = detect_peaks_uml(myimage,radius);

no_of_peaks = length(peak_positions);

centroids_array = zeros(no_of_peaks);

for k = 1:no_of_peaks

  centroids_array(k,1) = peak_positions(k).WeightedCentroid(1);

  centroids_array(k,2) = peak_positions(k).WeightedCentroid(2);

end

 

I chose my value of radius by looking at spots in a sample image and counting the number of pixels across a peak. It may be 
more useful to automatically obtain a value for the
radius. I may run some tests to see how different choices of radius
affect the centroid calculations. 

I may also need to add some error checking and/or image validating codes, but so far I have not encountered any problems. 

Please let me know if anyone needs more explanation!

Won

 

 

 

Attachment 1: test_centroid_code.m
% generate an blank image
imarr = zeros(1024, 1024);

% get the background and intensity levels
bckgrd = 700.0;
I1 = 56000.0;

% get the 2D coordinate arrays
x = 1:1024;
... 61 more lines ...
  36   Thu May 13 16:54:46 2010 AidanComputingHartmann sensorRunning MATLAB programs in C on CentOS - only use R2008b for less hassle

 After much effort trying to get a MATLAB routine to compile in C I discovered the following pieces of information.

1. CentOS will not install a gcc compiler more recent than 4.1.2 with yum install. This is circa 2007. If you want a more recent compiler it must be installed manually.

2. To compile and link C programs that call the MATLAB engine, they must be compiled in MATLAB using the mex command. Every version of MATLAB after R2008b requires the gcc compiler 4.2.3.

3. Building gcc 4.2.3 takes a lot more than 1 hour of compile time. I accidentally killed the build process and gave it up as a lost cause. 

 

  39   Thu May 20 08:20:54 2010 AidanComputingHartmann sensorCentroiding algorithm and code to generate simulated data

 Here's a copy of an email I distributed today that describes the centroid and simulation code I wrote.

Hi Won,

I've written some code that generates an image of Gaussian spots and provides you with the coordinates of the centers used to generate those spots. There is the facility to turn on i) photo-electron shot noise, ii) random displacement of the nominal positions of the centers from a regular array and iii) 12-bit digitization to more accurately model the output from a CCD.

I've included an example routine that calls this function and then centroids those spots using a variant of your centroiding algorithm.

You should be able to use this to generate reliable simulated data to test versions of your centroiding algorithm.

Cheers,
Aidan.

Attached files: 
1. test_spot_generation_and_centroiding.m     - the example routine. Run this first
2. generate_simulated_spots.m         - the function to generate the simulated spots in an image and as a set of positions
3. centroid_image.m - the function to centroid an image

Attachment 1: test_spot_generation_and_centroiding.m
% example usage of generate_simulated_spots and centroid_image

clear all
close all



%% example 1 - 
%----------------------------------------------------------
npixels = 1024;          % the number of pixels in the image
... 143 more lines ...
Attachment 2: generate_simulated_spots.m
function output = generate_simulated_spots(npixels, digitizeFLAG, ...
                          IntensityNoiseFLAG, positionNoiseFLAG)
%
% a function to generate an image of spots to centroid and to provide the original 
% locations of the spots. 
% 
% input
% -----
% npixels - pixels in output image
% digitizeFLAG:          0 - floating point array is output
... 160 more lines ...
Attachment 3: centroid_image.m
function centroids = centroid_image(image, centroids)
%
% This function centroids a supplied image. It returns a centroids structure
%
% 'centroids' structure
% --------------------
% centroids.image_background_level  - the background intensity of an image
%                                     with no illumination on it
%          .spot_radius             - the radius of a hartmann spot
%          .spot_threshold_level    - the minimum intensity of pixels used to
... 95 more lines ...
  42   Mon May 24 19:17:32 2010 AidanLaserHartmann sensorReplaced Brass Plate with Invar Hartmann Plate

I just replaced the brass Hartmann plate with the Invar one. The camera was off during the process but has been turned on again. The camera is now warming up again. I've manually set the temperature in the EPICS channels by looking at the on-board temperature via the serial communications.

 I also made sure the front plate was secured tightly.

  44   Wed May 26 14:58:04 2010 AidanMiscHartmann sensorHartmann sensor cooling fins added

14:55 -  Mindy stopped by with the copper heater spreaders and the cooling fins for the Hartmann sensor. We've set them all up and have turned on the camera to see what temperature above ambient is achieves.

17:10 - Temperature of the HWS with no active cooling( Digitizer = 44.1C, Sensor = 36.0C, Ambient = 21.4C)

 

Attachment 1: HWS_CONFIG1.jpg
HWS_CONFIG1.jpg
  45   Thu May 27 08:25:37 2010 AidanElectronicsHartmann sensorHartmann sensor cooling fins added - base piece removed

 8:10AM - I removed the base plate from the Hartmann sensor. I want to know what steady-state temperature the HWS achieves without the plate.

The photo below shows the current configuration.

11:22AM - (Digitizer - 52.2C, Sensor - 43.8C, Ambient - 21.8C)

Attachment 1: HWS_CONFIG2.jpg
HWS_CONFIG2.jpg
  46   Thu May 27 13:18:51 2010 AidanElectronicsHartmann sensorRemoved Cooling fins from Hartmann sensor

I removed the cooling fins from the Hartmann sensor to see what steady-state temperature it reached without any passive cooling elements. I also dropped the set-point temperature for the lab to help keep for getting too hot.

After nearly 3 hours the temperature is:

(Digitizer: 54.3C, Sensor: 46.6C, Ambient: 19.6C)

 

 

Attachment 1: HWS_CONFIG3.jpg
HWS_CONFIG3.jpg
  47   Thu May 27 15:42:06 2010 AidanElectronicsHartmann sensorHartmann sensor with just the base piece

I switched in just the base piece of the Hartmann sensor. The cooling fins are removed. I bolted the camera securely to the base plate and I bolted the plate securely to the table.

 5:00PM - (Digitizer = 41.9C, Sensor = 33.8C, Ambient = 19.3C)

 

Attachment 1: HWS_CONFIG4.jpg
HWS_CONFIG4.jpg
  48   Thu May 27 17:49:02 2010 AidanElectronicsHartmann sensorHartmann sensor cooling fins added - base piece added

 Back to Configuration 1 again - this time the fins were bolted very securely to the camera.

 7:25 PM - [about 2 hours later] - Digitizer = 39.7C, Sensor = 31.4C, Ambient = 19.0C

 

 

Attachment 1: HWS_CONFIG1-tight.jpg
HWS_CONFIG1-tight.jpg
  49   Tue Jun 15 16:30:10 2010 Peter VeitchMiscHartmann sensorSpot displacement maps - temperate sensitivity tests

Results of initial measurement of temperature sensitivity of Hartmann sensor

"Cold" images were taken at the following temperature:
| before | 32.3 | 45.3 | 37.0 |
| after  | 32.4 | 45.6 | 37.3 |

"Hot" Images were taken at the following temperature:

| before | 36.5 | 48.8 | 40.4 |
| after  | 36.4 | 48.8 | 40.4 |

"before" are the temperatures just before taking 5000 images, and "after" are
the temperatures just after taking the images. First column is the temperature
measured using the IR temp sensor pointed at the heat sink, the second column the
camera temperature, and the third column the sensor board temperature.

Temperature change produced by placing a "hat" over the top of the HP assembly and the top of the heatsinks.

Averaged images "cool" and "hot" were created using 200 frames (each).

Aberration parameter values are as follows:

Between cool and hot images (cool spots - hot spots)

     p: 4.504320557133363e-005
    al: 0.408248504544179
   phi: 0.444644135542724
     c: 0.001216006036395
     s: -0.002509569677737
     b: 0.054773177423349
    be: 0.794567342929695
     a: -1.030687344054648

Between cool images only

     p: 9.767143368103721e-007
    al: 0.453972584677992
   phi: -0.625590459774765
     c: 2.738206187344315e-004
     s: 1.235384158257808e-006
     b: 0.010135170457321
    be: 0.807948378729832
     a: 0.256508288049258

Between hot images only

     p: 3.352035441252169e-007
    al: -1.244075541477539
   phi: 0.275705676833192
     c: -1.810992355666772e-004
     s: 7.076678388064736e-005
     b: 0.003706221758158
    be: -0.573902879552339
     a: 0.042442307609231

Attached are two contour plots of the radial spot displacements, one between
cool and hot images, and the other between cool images only. The color
bars roughly indicate the values of maximum and minimum spot
displacements.

Possible causes:

1. anisotropy of the thermal expansion of the invar foil HP caused by the rolling

2. non-uniform clamping of the HP by the clamp plate

3. vertical thermal gradient produced by the temperature raising method

4. buckling of the HP due to slight damage (dent)

Attachment 1: spot_displacements_same_temp_0611.jpg
spot_displacements_same_temp_0611.jpg
Attachment 2: spot_displacements_diff_temp_0611.jpg
spot_displacements_diff_temp_0611.jpg
  50   Wed Jun 16 11:47:11 2010 AidanMiscHartmann sensorSpot displacement maps - temperate sensitivity tests - PRISM

I think that the second plot is just showing PRISM and converting it to its radial components. This is due to the fact that the sign of the spot displacement on the LHS is the opposite of the sign of the spot displacement on the RHS. For spherical or cylindrical power, the sign of the spot displacement should be the same on both the RHS and the LHS.

I've attached a Mathematica PDF that illustrates this.

 


Quote:

Results of initial measurement of temperature sensitivity of Hartmann sensor

"Cold" images were taken at the following temperature:
| before | 32.3 | 45.3 | 37.0 |
| after  | 32.4 | 45.6 | 37.3 |

"Hot" Images were taken at the following temperature:

| before | 36.5 | 48.8 | 40.4 |
| after  | 36.4 | 48.8 | 40.4 |

"before" are the temperatures just before taking 5000 images, and "after" are
the temperatures just after taking the images. First column is the temperature
measured using the IR temp sensor pointed at the heat sink, the second column the
camera temperature, and the third column the sensor board temperature.

Temperature change produced by placing a "hat" over the top of the HP assembly and the top of the heatsinks.

Averaged images "cool" and "hot" were created using 200 frames (each).

Aberration parameter values are as follows:

Between cool and hot images (cool spots - hot spots)

     p: 4.504320557133363e-005
    al: 0.408248504544179
   phi: 0.444644135542724
     c: 0.001216006036395
     s: -0.002509569677737
     b: 0.054773177423349
    be: 0.794567342929695
     a: -1.030687344054648

Between cool images only

     p: 9.767143368103721e-007
    al: 0.453972584677992
   phi: -0.625590459774765
     c: 2.738206187344315e-004
     s: 1.235384158257808e-006
     b: 0.010135170457321
    be: 0.807948378729832
     a: 0.256508288049258

Between hot images only

     p: 3.352035441252169e-007
    al: -1.244075541477539
   phi: 0.275705676833192
     c: -1.810992355666772e-004
     s: 7.076678388064736e-005
     b: 0.003706221758158
    be: -0.573902879552339
     a: 0.042442307609231

Attached are two contour plots of the radial spot displacements, one between
cool and hot images, and the other between cool images only. The color
bars roughly indicate the values of maximum and minimum spot
displacements.

Possible causes:

1. anisotropy of the thermal expansion of the invar foil HP caused by the rolling

2. non-uniform clamping of the HP by the clamp plate

3. vertical thermal gradient produced by the temperature raising method

4. buckling of the HP due to slight damage (dent)

 

Attachment 1: Prism_as_radial_vector.pdf
Prism_as_radial_vector.pdf Prism_as_radial_vector.pdf Prism_as_radial_vector.pdf
  51   Thu Jun 17 07:40:07 2010 James KMiscHartmann sensorSURF Log -- Day 1, Getting Started

 For Wednesday, June 16:

I attended the LIGO Orientation and first Introduction to LIGO lecture in the morning. In the afternoon, I ran a few errands (got keys to the office, got some Computer Use Policy Documentation done) and toured the lab. I then got Cygwin installed on my laptop along with the proper SSH packets and was successfully able to log in to and interact with the Hartmann computer in the lab through the terminal, from the office. I have started reading relevant portions of Dr. Brooks' thesis and of "Fundamentals of Interferometric Gravitational Wave Detectors" by Saulson.
  52   Thu Jun 17 22:03:51 2010 James KMiscHartmann sensorSURF Log -- Day 2, Getting Started

For Thursday, June 17:

Today I attended a basic laser safety training orientation, the second Introduction to LIGO lecture, a Summer Research Student Safety Orientation, and an Orientation for Non-Students living on campus (lots of mandatory meetings today). I met with Dr. Willems and Dr. Brooks in the morning and went over some background information regarding the project, then in the afternoon I got an idea of where I should progress from here from talking with Dr. Brooks. I read over the paper "Adaptive thermal compensation of test masses in advanced LIGO" and the LIGO TCS Preliminary Design document, and did some further reading in the Brooks thesis.

I'm making a little bit of progress with accessing the Hartmann lab computer with Xming but got stuck, and hopefully will be able to sort that out in the morning and progress to where I want to be (I wasn't able to get much further than that, since I can't access the Hartmann computer in the lab currently due to laser authorization restrictions). I'm currently able to remotely open an X terminal on the server but wasn't able to figure out how to then be able to log in to the Hartmann computer. I can do it via SSH on that terminal, of course, but am having the same access restrictions that I was getting when I was logging in to the Hartmann computer via SSH directly from my laptop (i.e. I can log in to the Hartmann computer just fine, and access the camera and framegrabber programs, but for the vast majority of the stuff on there, including MATLAB, I don't have permissions for some reason and just get 'access denied'). I'm sure that somebody who actually knows something about this stuff will be able to point out the problem and point me in the right direction fairly quickly (I've never used SSH or the X Window system before, which is why it's taking me quite a while to do this, but it's a great learning experience so far at least).

Goals for tomorrow: get that all sorted out and learn how to be able to fully access the Hartmann computer remotely and run MATLAB off of it. Familiarize myself with the camera program. Set the camera into test pattern mode and use the 'take' programs to retrieve images from it. Familiarize myself with the 'take' programs a bit and the various options and settings of them and other framegrabber programs. Get MATLAB running and use fread to import the image data arrays I take with the proper data representation (uint16 for each array entry). Then, set the camera back to recording actual images, take those images from the framegrabber and save them, then import them into MATLAB. I should familiarize myself with the various settings of the camera at this stage, as well.

 

--James

  53   Sat Jun 19 17:31:46 2010 James KMiscHartmann sensorSURF Log -- Day 3, Initial Image Analysis
For Friday, June 18:
(note that I haven't been working on this stuff all of Saturday or anything, despite posting it now. It was getting late on Friday evening so I opted to just type it up now, instead)

(all matlab files referenced can be found in /EDTpdv/JKmatlab unless otherwise noted)

I finally got Xming up and running on my laptop and had Dr. Brooks edit the permissions of the controls account, so now I can fully access the Hartmann computer remotely (run MATLAB, interact with the framegrabber programs, etc.). I was able to successfully adjust camera settings and take images using 'take', saving them as .raw files. I figured out how to import these .raws into MATLAB using fopen and display them as grayscale images using the Imshow command. I then wrote a program (readimgs.m, as attached) which takes inputs a base filename and number of images (n), then automatically loads the first 'n' .raw files located in /EDTpdv/JKimg/ with the inputted base file name, formatting them properly and saving them as a 1024x1024x(n) matrix.

After trying out the test pattern of the camera, I set the camera into normal operating mode. I took 200 images of the HWS illuminated by the OLED, using the following camera settings:

 
Temperature data from the camera was, unfortunately, not taken, though I now know how to take it.
 
The first of these 200 images is shown below:
 
hws0000.png

As a test exercise in MATLAB and also to analyze the stability of the HWS output, I wrote a series of functions to allow me to find and plot the means and standard deviations of the intensity of each pixel over a series of images. First, knowing that I would need it in following programs in order to use the plot functions on the data, I wrote "ar2vec.m" (as attached), which simply inputs an array and concatenates all of the columns into a single column vector.

Then, I wrote "stdvsmean.m" (as attached), which inputs a 3D array (such as the 1024x1024x(n) array of n image files), which first calculates the standard deviation and mean of this array along the 3rd dimension (leaving, for example, two 1024x1024 arrays, which give the mean and standard deviation of each pixel over the (n) images). It then uses ar2vec to create two column vectors, representing the mean and standard deviation of each pixel. It then plots a scatterplot of the standard deviation of each pixel vs. its mean intensity (with logarithmic axes), along with histograms of the mean intensities and standard deviation of intensities (with logarithmic y-axes).

"imgdevdat.m" (as attached) is simply a master function which combines the previous functions to input image files, format them, analyze them statistically and create plots.

Running this function for the first 20 images gave the following output:

(data from 20 images, over all 1024x1024 pixels)

Note that the background level is not subtracted out in this function, which is apparent from the plots. The logarithmic scatter plot looks pretty linear, as expected, but there are interesting features arising between the intensities of ~120 to ~130 (the obvious spike upward of standard deviation, followed immediately by a large dip downward).

MATLAB gets pretty bogged down trying to plot over a million data points at a time, to the point where it's very difficult to do anything with the plots. I therefore wrote the function "minimgstat.m" (as attached), which is very similar to imgdevdat.m except that before doing the analysis and plotting, it reduces the size of the image array to the upper-left NxN square (where N is an additional argument of the function).

Using this function, I did the same analysis of the upper-left 200x200 pixels over all 200 images:

(data from 200 images, over the upper-left 200x200 pixels)

The intensities of the pixels don't go as high this time because the upper portion of the images are dimmer than much of the rest of the image (as is apparent from looking at the image itself, and as I demonstrate further a little bit later on). Do note the change in axis scaling resulting from this when comparing the image. We do, however, see the same behavior in the ~120-128 intensity level region (more pronounced in this plot because of the change in axis scaling).

I was interested in looking at which pixels constituted this band, so I wrote a function "imgbandfind.m" (as attached), which inputs a 2D array and a minimum and maximum range value, goes through the image array pixel-by-pixel, determines which pixels are within the range, and then constructs an RGB image which displays pixels within the range as red and images outside the range as black.

I inputted the first image in the series into this function along with the range of 120-129, and got the following:

(pixels in intensity range of 120-129 in first image)

So the pixels in this range appear to be the pixels on the outskirts of each wavefront dot near the vertical center of the image. The outer circles of the dots on the lower and upper portions of the image do not appear, perhaps because the top of the image is dimmer and the bottom of the image is brighter, and thus these outskirt pixels would then have lower and higher values, respectively. I plan to investigate this and why it happens (what causes this 'flickering' and if it is a problem at all) further.

The fact that the background levels are lower nearer to the upper portion of the image is demonstrated in the next image, which shows all intensity levels less than 70:
(pixels in intensity range of 0-70 in first image)

So the background levels appear the be nonuniform across the CCD, as are the intensities of each dot. Again, I plan to investigate this further. (could it be something to do with stray light hitting the CCD nonuniformly, maybe? I haven't thought through all the possibilities)
 
The OLED has been turned off, so my next immediate step will be to investigate the background levels further by analyzing the images when not illuminated by the OLED.
 
In other news: today I also attended the third Intro to LIGO lecture, a talk on Artificial Neural Networks and their applications to automated classification of stellar spectra, and the 40m Journal Club on the birth rates of neutron stars (though I didn't think to learn how to access the wiki until a few hours right before, and then didn't actually read the paper. I fully intend to read the paper for next week before the meeting).
 
Attachment 2: ar2vec.m
function V = ar2vec(A)
%AR2VEC V=ar2vec(A)
%concenates the columns of 2D array A into a single column vector V

sz = size(A);
n=sz(1,2);
i=1;
V=[];

while i<(n+1)
... 7 more lines ...
Attachment 3: readimgs.m
function arr = readimgs(imn,n)
%readimgs('basefilename',n) 
%- A function to load a series of .raw files outputted by 'take'
%and stored in /opt/EDTpdv/JKimg/
%  Inputs: 'basefilename' is a string input (for example, for series of
%   images "testpat####.raw" input 'testpat'). "n" is the number of images,
%   so for testpat0000-testpat0004 input n=5

i=0;
arr=[];
... 32 more lines ...
Attachment 4: stdvsmean.m
function M = stdvsmean(A)
%STDVSMEAN takes a 3D array of image data and computes
%stdev vs. mean for each pixel

%find means/st devs between each image
astd = std(double(A),0,3);
armn = mean(double(A),3);

%convert into column vectors of pixel-by-pixel data
asvec=ar2vec(astd);
... 33 more lines ...
Attachment 5: imgdevdat.m
function imgdevdat(basefilename,imgnum)
%IMGDEVDAT Inputs base file name and number of images stored as .raw files
%in ../EDTpdv/JKimg/, automatically imports as 1024x1024x(n) matrix, finds
%the mean and standard deviation of each pixel in each image and plots
A=readimgs(basefilename,imgnum);
stdvsmean(A)
end

Attachment 6: minimgstat.m
function imgdevdat(basefilename,imgnum,size)
%IMGDEVDAT Inputs base file name and number of images stored as .raw files
%in ../EDTpdv/JKimg/, automatically imports as (size)x(size)x(n) matrix, finds
%the mean and standard deviation of each pixel in each image and plots
A=readimgs(basefilename,imgnum);
smA=A(1:size,1:size,:);
stdvsmean(smA)
end
Attachment 7: imgbandfind.m
function [HILT] = imgbandfind(img,minb,maxb)
%IMGBANDFIND inputs an image array and minimum and maximum value,
% then finds all values of the array within that range, then plots with
%values in range highlighted in red against a black background

img=double(img);
maxv=max(max(img));
sizm=size(img);
rows=sizm(1,1);
cols=sizm(1,2);
... 20 more lines ...
  54   Tue Jun 22 00:21:47 2010 James KMiscHartmann sensorSurf Log -- Day 4, Hartmann Spot Flickering Investigation

 I started out the day by taking some images from the CCD with the OLED switched off, to just look at the pattern when it's dark. The images looked like this:

 
Taken with camera settings:

The statistical analysis of them using the functions from Friday gave the following result:

 
At first glance, the distribution looks pretty Poissonian, as expected. There are a few scattered pixels registering a little brighter, but that's perhaps not so terribly unusual, given the relatively tiny spread of intensities with even the most extreme outliers. I won't say for certain whether or not there might be something unexpected at play, here, but I don't notice anything as unusual as the standard deviation 'spike' seen from intensities 120-129 as observed in the log from yesterday.
 
Speaking of that spike, the rest of the day was spent trying to investigate it a little more. In order to accomplish this, I wrote the following functions (all attached):
 
-spotfind.m -- inputs a 3D array of several Hartmann images as well as a starting pixel and threshold intensity level. analyzes the first image, scanning starting at the starting pixel until it finds a spot (with an edge determined by the threshold level), after which it finds a box of pixels which completely surrounds the spot and then shrinks the matrix down to this size, localizing the image to a single spot
 
-singspotcent.m -- inputs the image array outputted from spotfind, subtracts an estimate of the background, then uses the centroiding algorithm sum(x*P^2)/sum(P^2) to find the centroid (where x is the coordinate and P is the intensity level), then outputs the centroid location
 
-hemiadd.m -- inputs the image from spotfind and the centroid from singspotcent, subtracts an estimate of the background, then finds the sum total intensity in the top half of the image above the centroid, the bottom half, the left half and the right half, outputs these values as n-component vectors for an n-image input, subtracts from each vector its mean and then plots the deviations in intensity from the mean in each half of the image as a function of time
 
-edgeadd.m -- similar to hemiadd, except that rather than adding up all pixels on one half of the image, it inputs a threshold, determines how far to the right of the centroid that the spot falls past this treshold and uses it as a radial length, then finds the sum of the intensities of a bar of 3 pixels on this "edge" at the radial length away from the centroid.
 
-spotfft.m -- performs a fast fourier transform on the outputs from edgeadd, outputting the frequency spectrum at which the intensity of these edge pixels oscillate, then plotting these for each of the four edge vectors. see an example output below.
 
--halfspot_fluc.m and halfspot_edgefluc.m -- master functions which combine and automate the functions previous
 
Dr. Brooks has suggested that the observed flickering might perhaps be an effect resulting from the finite thickness of the Hartmann Plate. The OLED can be treated as a point source and thus can be approximated as emitting a spherical wavefront, and thus the light from it will hit this edge at an angle and be scattered onto the CCD. If the plate vibrates, then (which it certainly must to some degree) the wavefront will hit this edge at a different angle as the edge is displaced temporarily through vibration, and thus this light will hit the CCD at a different point, causing the flickering (which is, after all, observed to occur near the edge of the spot). This effect certainly must cause some level of noise, but whether it's the culprit for our 'flickering' spike in the standard deviation remains to be seen.

Here is the frequency spectrum of the edge intensity sums for two separate spots, found over 128 images:
Intensity Sum Amplitude Spectrum of Edge Fluctuations, 128 images, spot search point (100,110), threshold level 110

128 images, spot search point (100,100), threshold level 129
At first glance, I am not able to conclude anything from this data. I should investigate this further.

A few things to note, to myself and others:
--I still should construct a Bode plot from this data and see if I can deduce anything useful from it
--I should think about whether or not my algorithms are good for detecting what I want to look at. Is looking at a 3 pixel vertical or horizontal 'bar' on the edge good for determining what could possibly be a more spherical phenomenon? Are there any other things I need to consider? How will the settings of the camera affect these images and thus the results of these functions?
--Am I forgetting any of the subtleties of FFTs? I've confirmed that I am measuring the amplitude spectrum by looking at reference sine waves, but I should be careful since I haven't worked with these in a while
 
It's late (I haven't been working on this all night, but I haven't gotten the chance to type this up until now), so thoughts on this problem will continue tomorrow morning..

Attachment 1: spotfind.m
function [spotM,r0,c0] = spotfind(M,level,rs,cs)
%SPOTFIND Inputs a 3D array of hartmann spots and spot edge level
%and outputs a subarray located around a single spot located near (rs,cs)
cut=level/65535;
A=double(M(:,:,1)).*double(im2bw(M(:,:,1),cut));

%start at (rs,cs) and sweep to find spot
r=rs;
c=cs;
while A(r,c)==0
... 34 more lines ...
Attachment 2: singspotcent.m
function [rc,cc] = singspotcent(A)
%SINGSPOTCENT returns centroid location for first image in input 3D matrix
MB=double(A(:,:,1));
[rn cn]=size(MB);
M=MB-mean(mean(min(MB)));
r=1;
c=1;
sumIc=0;
sumIr=0;
while c<(cn+1)
... 26 more lines ...
Attachment 3: hemiadd.m
function [topsum,botsum,leftsum,ritsum] = hemiadd(MB,rcd,ccd)
%HEMIADD inputs a 3D image matrix and centroid location and finds the difference of
%the sums of the top half, bottom half, left half and right half at each time
%compared to their means over that time

%round coordinates of centroid
rc=round(rcd);
cc=round(ccd);

%subtract approximate background
... 51 more lines ...
Attachment 4: edgeadd.m
function [topsum,botsum,leftsum,ritsum] = edgeadd(MB,rcd,ccd,edgemax)
%HEMIADD inputs a 3D image matrix and centroid location and finds the difference of
%the sums of 3 edge pixels at radial distance "radial" from centroid for
%the top half, bottom half, left half and right half at each time
%compared to their means over that time

%round coordinates of centroid
rc=round(rcd);
cc=round(ccd);

... 59 more lines ...
Attachment 5: spotfft.m
function spotfft(t,b,l,r)
%SPOTFFT Does an fft and plots the frequency spectrum of four input vectors
%Specifically, this is to be used with halfspot_edgefluc to find the
%frequencies of oscillations about the edges of Hartmann spots
[n,m]=size(t);
NFFT=2^nextpow2(n);
T=fft(t,NFFT)/n;
B=fft(b,NFFT)/n;
L=fft(l,NFFT)/n;
R=fft(r,NFFT)/n;
... 30 more lines ...
Attachment 6: halfspot_fluc.m
function [top,bot,lft,rgt] = halfspot_fluc(M,spotr,spotc,thresh)
%HALFSPOT_FLUC Inputs a 3D array of Hartmann sensor images, along with an
%approximate spot location and intensity threshhold. Finds a spot on the
%first image near (spotc,spotr) and defines boundary of spot near an
%intensity of 'thresh'. Outputs fluctuations of the intensity sums of the
%top, bottom, left and right halves of the spot about their means, and
%graphs these against each other automatically.

[I,r0,c0]=spotfind(M,thresh,spotr,spotc);
[r,c]=singspotcent(I);
... 7 more lines ...
Attachment 7: halfspot_edgefluc.m
function [top,bot,lft,rgt] = halfspot_edgefluc(M,spotr,spotc,thresh,plot)
%HALFSPOT_FLUC Inputs a 3D array of Hartmann sensor images, along with an
%approximate spot location and intensity threshhold. Finds a spot on the
%first image near (spotc,spotr) and defines boundary of spot near an
%intensity of 'thresh'. Outputs fluctuations of the intensity sums of the
%top, bottom, left and right edges of the spot about their means, and
%graphs these against each other automatically.
%
%For 'plot', specify 'time' for the time signal or 'fft' for the frequency

... 10 more lines ...
  55   Tue Jun 22 22:30:24 2010 James KMiscHartmann sensorSURF Log -- Day 5, more Hartmann image preliminary analysis

 Today I spoke with Dr. Brooks and got a rough outline of what my experiment for the next few weeks will entail. I'll be getting more of the details and getting started a bit more, tomorrow, but today I had a more thorough look around the Hartmann lab and we set up a few things on the optical table. The OLED is now focused through a microscope to keep the beam from diverging quite as much before it hits the sensor, and the beam is roughly aligned to shine onto the Hartmann plate. The Hartmann images currently look like this (on a color scale of intensity):

hws.png

Where this image was taken with the camera set to exposure time 650 microseconds, frequency 58Hz. The visible 'streaks' on the image are believed to possibly be an artifact of the camera's data acquisition process.

I tested to see whether the same 'flickering' is present in images under this setup.

For frequency kept at 58Hz, the following statistics were found from a 200x200 pixel box within series of 10 images taken at different exposure times. Note that the range on the plot has been reduced to the region near the relevant feature, and that this range is not being changed from image to image:

750 microseconds:

750us.png

1000 microseconds:

1000us.png

1500 microseconds:

1500us.png

2000 microseconds:

2000us.png

3000 microseconds:

3000us.png

4000 microseconds:

4000us.png

5000 microseconds. Note that the background level is approaching the level of the feature:

5000us.png

6000 microseconds. Note that the axis setup is not restricted to the same region, and that the background level exceeds the level range of the feature. This demonstrates that the 'feature' disappears from the plot when the plot does not include the specific range of ~115-130:

8000us.png

 

When images containing the feature intensities are averaged over a greater number of images, the plot takes on the following appearance (for a 200x200 box within a series of 100 images, 3000us exposure time):

hws3k.png

This pattern changes a bit when averaged over more images. It looks as though this could, perhaps, just be the result of the decrease in the standard deviation of the standard deviations in each pixel resulting from the increased number of images being considered for each pixel (that is, the line being less 'spread out' in the y-axis direction). 

 

To demonstrate that frequency doesn't have any effect, I got the following plots from images where I set the camera to different frequencies then set the exposure time to 3000us (I wouldn't expect this to have any effect, given the previous images, but these appear to demonstrate that the 'feature' does not vary with time):

 

Set to 30Hz:

f30Hz.png

Set to 1Hz:

f1Hz.png

 

To make sure that something weird wasn't going on with my algorithm, I did the following: I constructed a 10-component vector of random numbers. Then, I concatenated that vector besides itself ten times. Then, I concatenated that vector into a 3D array by scaling the 2D vector with ten different integer multiples, ensuring that the standard deviations of each row would be integer multiples of each other when the standard deviation was found along the direction of the random change (I chose the integer multiples to ensure that some of these values would fall within the range of  115-130). Thus, if my function wasn't making any weird mistakes, I would end up with a linear plot of standard deviation vs. mean, with a slope of 1. When the array was inputted into the function with which the previous plots were found, the output plot was indeed observed to be linear, and a least squares regression of the mean/deviation data confirmed that the slope was exactly 1 and the intercept exactly 0. So I'm pretty certain that the feature observed in these plots is not any sort of 'artifact' of the algorithm used to analyze the data (and all the functions are pretty simple, so I wouldn't expect it to be, but it doesn't hurt to double-check).

 

I would conjecture from all of this that the observed feature in the plots is the result of some property of the CCD array or other element of the camera. It does not appear to have any dependence on exposure time or to scale with the relative overall intensity of the plots, and, rather, seems to depend on the actual digital number read out by the camera. This would suggest to me, at first glance, that the behavior is not the result of a physical process having to do with the wavefront.

 

EDIT: Some late-night conjecturing: Consider the following,

I don't know how the specific analog-to-digital conversion onboard the camera works, but I got to thinking about ADCs. I assume, perhaps incorrectly, that it works on roughly the same idea as the Flash ADCs that I dealt with back in my Digital Electronics class -- that is, I don't know if it has the same structure (a linear resistor ladder hooked up to comparators which compare the ladder voltages to the analog input, then uses some comb logic circuit which inputs the comparator outputs and outputs a digital level) but I assume that it must, at some level, be comparing the analog input to a number of different voltage thresholds, considering the highest 'threshold' that the analog input exceeds, then outputting the digital level corresponding to that particular threshold voltage.

Now, consider if there was a problem with such an ADC such that one of the threshold voltages was either unstable or otherwise different than the desired value (for a Flash ADC, perhaps this could result from a problem with the comparator connected to that threshold level, for example). Say, for example, that the threshold voltage corresponding to the 128th level was too low. In that case, an analog input voltage which should be placed into the 127th level could, perhaps, trip the comparator for the 128th level, and the digital output would read 128 even when the analog input should have corresponded to 127.

So if such an ADC was reading a voltage (with some noise) near that threshold, what would happen? Say that the analog voltage corresponded to 126 and had noise equivalent to one digital level. It should, then, give readings of 125, 126 or 127. However, if the voltage threshold for the 128th level was off, it would bounce between 125, 126, 127 and 128 -- that is, it would appear to have a larger standard deviation than the analog voltage actually possessed.

Similarly, consider an analog input voltage corresponding to 128 with noise equivalent to one digital level. It should read out 127, 128 and 129, but with the lower-than-desired threshold for 128 it would perhaps read out only 128 and 129 -- that is, the standard deviation of the digital signal would be lower for points just above 128.

This is very similar to the sort of behavior that we're seeing!

Thinking about this further, I reasoned that if this was what the ADC in the camera was doing, then if we looked in the image arrays for instances of the digital levels 127 and 128, we would see too few instances of 127 and too many instances of 128 -- several of the analog levels which should correspond to 127 would be 'misread' as 128. So I went back to MATLAB and wrote a function to look through a 1024x1024xN array of N images and, for every integer between an inputted minimum level and maximum level, find the number of instances of that level in the images. Inputting an array of 20 Hartmann sensor images, along with minimum and maximum levels of 50 and 200, gave the following:

levelinstances.png

Look at that huge spike at 128! This is more complex of behavior than my simple idea which would result in 127 having "too few" values and 128 having "too many", but to me, this seems consistent with the hypothesis that the voltage threshold for the 128th digital level is too low and is thus giving false output readings of 128, and is also reducing the number of correct outputs for values just below 128. And assuming that I'm thinking about the workings of the ADC correctly, this is consistent with an increase in the standard deviation in the digital level for values with a mean just below 128 and a lower standard deviation for values with a mean just above 128, which is what we observe.

 

This is my current hypothesis for why we're seeing that feature in the plots. Let me know what you think, and if that seems reasonable.

 

  56   Wed Jun 23 06:49:48 2010 AidanMiscHartmann sensorSURF Log -- Day 5, more Hartmann image preliminary analysis

Nice work!

 

Quote:

 Today I spoke with Dr. Brooks and got a rough outline of what my experiment for the next few weeks will entail. I'll be getting more of the details and getting started a bit more, tomorrow, but today I had a more thorough look around the Hartmann lab and we set up a few things on the optical table. The OLED is now focused through a microscope to keep the beam from diverging quite as much before it hits the sensor, and the beam is roughly aligned to shine onto the Hartmann plate. The Hartmann images currently look like this (on a color scale of intensity):

hws.png

Where this image was taken with the camera set to exposure time 650 microseconds, frequency 58Hz. The visible 'streaks' on the image are believed to possibly be an artifact of the camera's data acquisition process.

I tested to see whether the same 'flickering' is present in images under this setup.

For frequency kept at 58Hz, the following statistics were found from a 200x200 pixel box within series of 10 images taken at different exposure times. Note that the range on the plot has been reduced to the region near the relevant feature, and that this range is not being changed from image to image:

750 microseconds:

750us.png

1000 microseconds:

1000us.png

1500 microseconds:

1500us.png

2000 microseconds:

2000us.png

3000 microseconds:

3000us.png

4000 microseconds:

4000us.png

5000 microseconds. Note that the background level is approaching the level of the feature:

5000us.png

6000 microseconds. Note that the axis setup is not restricted to the same region, and that the background level exceeds the level range of the feature. This demonstrates that the 'feature' disappears from the plot when the plot does not include the specific range of ~115-130:

8000us.png

 

When images containing the feature intensities are averaged over a greater number of images, the plot takes on the following appearance (for a 200x200 box within a series of 100 images, 3000us exposure time):

hws3k.png

This pattern changes a bit when averaged over more images. It looks as though this could, perhaps, just be the result of the decrease in the standard deviation of the standard deviations in each pixel resulting from the increased number of images being considered for each pixel (that is, the line being less 'spread out' in the y-axis direction). 

 

To demonstrate that frequency doesn't have any effect, I got the following plots from images where I set the camera to different frequencies then set the exposure time to 3000us (I wouldn't expect this to have any effect, given the previous images, but these appear to demonstrate that the 'feature' does not vary with time):

 

Set to 30Hz:

f30Hz.png

Set to 1Hz:

f1Hz.png

 

To make sure that something weird wasn't going on with my algorithm, I did the following: I constructed a 10-component vector of random numbers. Then, I concatenated that vector besides itself ten times. Then, I concatenated that vector into a 3D array by scaling the 2D vector with ten different integer multiples, ensuring that the standard deviations of each row would be integer multiples of each other when the standard deviation was found along the direction of the random change (I chose the integer multiples to ensure that some of these values would fall within the range of  115-130). Thus, if my function wasn't making any weird mistakes, I would end up with a linear plot of standard deviation vs. mean, with a slope of 1. When the array was inputted into the function with which the previous plots were found, the output plot was indeed observed to be linear, and a least squares regression of the mean/deviation data confirmed that the slope was exactly 1 and the intercept exactly 0. So I'm pretty certain that the feature observed in these plots is not any sort of 'artifact' of the algorithm used to analyze the data (and all the functions are pretty simple, so I wouldn't expect it to be, but it doesn't hurt to double-check).

 

I would conjecture from all of this that the observed feature in the plots is the result of some property of the CCD array or other element of the camera. It does not appear to have any dependence on exposure time or to scale with the relative overall intensity of the plots, and, rather, seems to depend on the actual digital number read out by the camera. This would suggest to me, at first glance, that the behavior is not the result of a physical process having to do with the wavefront.

 

EDIT: Some late-night conjecturing: Consider the following,

I don't know how the specific analog-to-digital conversion onboard the camera works, but I got to thinking about ADCs. I assume, perhaps incorrectly, that it works on roughly the same idea as the Flash ADCs that I dealt with back in my Digital Electronics class -- that is, I don't know if it has the same structure (a linear resistor ladder hooked up to comparators which compare the ladder voltages to the analog input, then uses some comb logic circuit which inputs the comparator outputs and outputs a digital level) but I assume that it must, at some level, be comparing the analog input to a number of different voltage thresholds, considering the highest 'threshold' that the analog input exceeds, then outputting the digital level corresponding to that particular threshold voltage.

Now, consider if there was a problem with such an ADC such that one of the threshold voltages was either unstable or otherwise different than the desired value (for a Flash ADC, perhaps this could result from a problem with the comparator connected to that threshold level, for example). Say, for example, that the threshold voltage corresponding to the 128th level was too low. In that case, an analog input voltage which should be placed into the 127th level could, perhaps, trip the comparator for the 128th level, and the digital output would read 128 even when the analog input should have corresponded to 127.

So if such an ADC was reading a voltage (with some noise) near that threshold, what would happen? Say that the analog voltage corresponded to 126 and had noise equivalent to one digital level. It should, then, give readings of 125, 126 or 127. However, if the voltage threshold for the 128th level was off, it would bounce between 125, 126, 127 and 128 -- that is, it would appear to have a larger standard deviation than the analog voltage actually possessed.

Similarly, consider an analog input voltage corresponding to 128 with noise equivalent to one digital level. It should read out 127, 128 and 129, but with the lower-than-desired threshold for 128 it would perhaps read out only 128 and 129 -- that is, the standard deviation of the digital signal would be lower for points just above 128.

This is very similar to the sort of behavior that we're seeing!

Thinking about this further, I reasoned that if this was what the ADC in the camera was doing, then if we looked in the image arrays for instances of the digital levels 127 and 128, we would see too few instances of 127 and too many instances of 128 -- several of the analog levels which should correspond to 127 would be 'misread' as 128. So I went back to MATLAB and wrote a function to look through a 1024x1024xN array of N images and, for every integer between an inputted minimum level and maximum level, find the number of instances of that level in the images. Inputting an array of 20 Hartmann sensor images, along with minimum and maximum levels of 50 and 200, gave the following:

levelinstances.png

Look at that huge spike at 128! This is more complex of behavior than my simple idea which would result in 127 having "too few" values and 128 having "too many", but to me, this seems consistent with the hypothesis that the voltage threshold for the 128th digital level is too low and is thus giving false output readings of 128, and is also reducing the number of correct outputs for values just below 128. And assuming that I'm thinking about the workings of the ADC correctly, this is consistent with an increase in the standard deviation in the digital level for values with a mean just below 128 and a lower standard deviation for values with a mean just above 128, which is what we observe.

 

This is my current hypothesis for why we're seeing that feature in the plots. Let me know what you think, and if that seems reasonable.

 

 

  57   Wed Jun 23 22:57:22 2010 James KMiscHartmann sensorSURF Log -- Day 6, Centroiding

 So in addition to taking steps towards starting to set stuff up for the experiment in the lab, I spent a good deal of the day figuring out how to use the pre-existing code for finding the centroids in spot images. I spent quite a bit of time trying to use an outdated version of the code that didn't work for the actual captured images, and then once I was directed towards the right version I was hindered for a little while by a bug.

The 'bug' turns out to be something very simple, yet relatively subtle. In the function centroid_images.m in '/opt/EDTpdv/hartmann/src/', the function was assuming a threshold of 0 with my images, even though it has not long before been working with an image that Dr. Brooks loaded. Looking through the code, I noticed that before finding the threshold using the MATLAB function graythresh, several adjustments were made so as to subtract out the background and normalize the array. After estimating and subtracting a background, the function divides the entries of the image array by the maximum value in the image so as to normalize this. For arrays composed of numbers represented as doubles, this is fine. However, the function that I wrote to import my image arrays into MATLAB outputs an image array with integer data. So when the function divided my integer image arrays by the maximum values in the array, it rounded every value in the array to the nearest integer -- that is, the "normalized" array only contained ones and zeros. The function graythresh views this as a black and white image, and thus outputs a threshold of 0.

To remedy this, I edited centroid_images.m to convert the image array into an array of doubles near the very beginning of the function. The only new line is simply "image=double(image);", and I made a note of my edit in a comment above that line. The function started working for me after I did that.

 

I then wrote a function which automatically centroids an input image and then plots the centroids as scatter-plot of red circles over the image. For an image taken off of the Hartmann camera, it gave the following:

centroidplot_nozoom.png

Zoomed in on the higher-intensity peaks, the centroids look good. They're a little offset, but that could just be an artifact of the plotting procedure; I can't say for certain either way. They all appear offset by the same amount, though:

centroidplot_zoom.png

One problem is that, for spots with a much lower relative intensity than the maximum intensity peak, the centroid appears to be offset:

centroidplot_zoom2.png

Better centering of the beam and more even illumination of the Hartmann plate could mitigate this problem, perhaps.

 

I also wrote a function which inputs two image matrices and outputs vector field plots representing the shift in each centroid from the first to the second images. To demonstrate that I could use this function to display the shifting of the centroids from a change in the wavefront, I translated the fiber mount of the SLED in the direction of the optical axis by about 6 turns of the z-control knob  (corresponding to a translation of about 1.9mm, according to the user's guide for the fiber aligner). This gave the following images:

 

Before the translation:

6turn_before.png

After:

6turn_after.png

 This led to a displacement of the centroids shown as follows:

6turnDisplacementVectors.png

Note that the magnitudes of the actual displacements are small, making the shift difficult to see. However, when we scale the displacement vectors up, we can get much more readily visible Direction vectors (having the same direction as the actual displacement vectors, but not the same magnitude):

6turnDirectionVectors.png

This was a very rough sort of measurement, since exposure time, focus of the microscope optic, etc. were not adjusted, and the centroids are compared between single images rather than composite images, meaning that random noise could have quite an effect, especially for the lower-magnitude displacements. However, this plot appears to show the centroids 'spreading out', which is as expected for moving the SLED closer to the sensor along the optical axis.

 

The following MATLAB functions were written for this (both attached):

centroidplot.m -- calls centroid_image and plots the data

centroidcompare.m -- calls centroid_image twice for two inputs matrices, using the first matrix's centroid output structure as a reference for the second. Does a vector field plot from the displacements and reference positions in the second output centroids structure.

Attachment 5: 6turn_before.png
6turn_before.png
Attachment 9: centroidplot.m
function centroiddata=centroidplot(M,N)
%a function to read the image matrix M and plot the centroids of each plot
%on the image
H=M(:,:,N);
cd /opt/EDTpdv/hartmann/src/
centroiddata = centroid_image(H);
cd /opt/EDTpdv/JKmatlab/

v=centroiddata.current_centroids;
r=v(:,1);
... 6 more lines ...
Attachment 10: centroidcompare.m
function centroiddata=centroidcompare(A,B,M,N)
%compares the Mth image in 3D image matrix A to Nth in B
H=A(:,:,M);
I=B(:,:,N);
cd /opt/EDTpdv/hartmann/src/
cent0=centroid_image(H);
centroiddata=centroid_image(I,cent0);
cd /opt/EDTpdv/JKmatlab
v=centroiddata.reference_centroids;
dv=centroiddata.displacement_of_centroids;
... 16 more lines ...
  58   Fri Jun 25 00:11:13 2010 James KMiscHartmann sensorSURF Log -- Day 7, SLED Beam Characterization

BACKGROUND:


In order to conduct future optical experiments with the SLED and to be able to predict the behavior of the beam as it propagates across the table and through various optics, it is necessary to know the properties of the beam. The spot size, divergence angle, and radius of curvature are all of interest if we wish to be able to predict the pattern which should appear on the Hartmann sensor given a certain optical layout.

It was therefore necessary to conduct an experiment to measure these properties. The wavefront emanating from the SLED is assumed to be approximately Gaussian, and thus has an intensity of the form:

 

where A is some amplitude, w is the spot size, x and y are the coordinates transverse to the optical axis, and x0 is the displacement of the optical axis in the x-direction from the optical axis. The displacement of the optical axis in the y-direction is assumed to be zero (that is, y0=0). A and w are both functions of z, which is the coordinate of displacement parallel to the optical axis.

 

Notice that the total intensity read by a photodetector reading the entire beam would be the double integral from negative infinity to infinity for both x and y. If a opaque plate was placed such that the the beam was blocked from some x=xm to x=inf (where xm is the location of the edge of the plate), then the intensity read by a photodetector reading the entire non-blocked portion of the beam would be:

 

Mathematica was used to simplify this integral, and it showed it to be equivalent to:

where Erfc() is the complementary error function. Note that for fixed z, this intensity is a function only of xm. If an experiment was carried out to measure the intensity of the beam blocked by a plate from x=-inf to x=xm for multiple values of xm, it would therefore be possible via regression analysis to compute the best-fit values of A, w, and x0 for the measured values of Ipd and xm. This would give us A, w and x0 for that z-value. By repeating this process for multiple values of z, we could therefore find the behavior of these parameters as a function of z.

Furthermore, we know that at z-values well beyond the Rayleigh range, w should be linear with respect to z. Assuming that our measurements are done in the far-field (which, for the SLED, they almost certainly would be) we could therefore find the divergence angle by knowing the slope of the linear relation between w and z. Knowing this, we could further calculate such quantities as the Rayleigh range, the minimum spot size, and the radius of curvature of the SLED output (see p.490 of "Lasers" by Milonni and Eberly for the relevant functional relationships for Gaussian beams).


EXPERIMENT:

An experiment was therefore carried out to measure the intensity of of beam blocked from x~=-inf to x=xm, for multiple values of xm, for multiple values of z. A diagram of the optical layout of the experiment is below:

 

(top view)


The razor blade was mounted on a New Focus 9091 Translational Stage, the relative displacement of which in the x-direction was measured with the Vernier micrometer mounted on the base. Tape was placed on the front of the razor so as to block light from passing through any of its holes. The portion of the beam not blocked by the razor then passed through a lens which was used to focus the beam back onto a PDA1001A Large Area Silicon Photodiode, the voltage output of which was monitored using a Fluke digital multimeter. The ruler stayed securely clamped onto the optical table (except when it was translated in the x-direction once during the experiment, as described later).

The following is a picture of this layout, as constructed:

 

 
The procedure of the experiment was as follows: first, the translational stage was clamped securely with the left-most edge of its base lined up with the desired z-value as measured on the ruler. The z-value as measured on the ruler was recorded. Then, the translational stage was moved in the negative x-direction until there was no change in the voltage measured on the DMM (which is directly proportional to the measured intensity of the beam). When no further DMM readout change was yielded from -x translation, it was assumed that the the razor was no longer blocking the beam. Then, the stage was moved in the +x direction until the voltage output on the DMM just began to change. The micrometer and DMM values were both recorded. The stage was then moved inward until the DMM read a voltage which was close to the nearest multiple of 0.5V, and this DMM voltage and micrometer reading were recorded. The stage was then translated until the DMM voltage dropped by approximately 0.5V, the micrometer and DMM readings were recorded, and this process was repeated until the voltage reached ~0.5V. The beam output was then covered by a card so as to completely block it, and the voltage output from the DMM was recorded as the intensity from the ambient light from that measurement. The stage was then unclamped and moved to the next z-value, and this process was repeated for 26 different values of z, starting at z=36.5mm and then incrementing z upwards by ~4mm for the first ten measurements, then by increments of ~6mm for the remaining measurements.
 
The data from these measurements can be found on the attached spreadsheet.
 
A few notes on the experiment:
 
The vernier micrometer has a measurement limit of 13.5mm. After the tenth measurement, the measured xm values began to exceed this limit. It was therefore necessary to translate the ruler in the negative x-direction without translating it in the z-direction. Plates were clamped snugly to either side of the ruler such that the ruler could not be translated in the z-direction, but could be moved in the x-direction when the ruler was unclamped. After securing these plates, the ruler was moved in the negative x-direction by approximately 5mm. The ruler was then clamped securely in place at its new x location. In order to better estimate the actual x-translation of the ruler, I took the following series of measurements: I moved the stage to z-values at which sets of measurements were previously taken. Then, I moved the razor out of the beam path and carefully moved it back inwards until the output on the DMM matched exactly the DMM output of the first measurement taken previously at that z-value. The xm value corresponding to this voltage was then read. The translation of the stage should be approximately equal to the difference of the measured xm values for that DMM voltage output at that z-value. This was done for 8 z-values, and the average difference was found to be 4.57+-0.03mm, which should also be the distance of stage translation (this data and calculation is included in the "x translation" sheet of the attached excel workbook).
 
At this same point, I started using two clamps to attach the translational stage to the table for each measurement set, as I was unhappy with the level of secureness which one clamp provided. I do not, however, believe that the use of one clamp compromised the quality of previous sets of measurements.

 

RESULTS:


A MATLAB function 'gsbeam.m' was written to replicate the function:

and then another function 'beamdata.m' was written to input each dataset, fit the data to a curve of the functional form of the previous function for each set of data automatically, and then output PDF files plotting all of the fit curves against each other, each individual fit curve against the data from that measurement, and a plot showing the widths w as a function of z. Linear regression was done on w against z to find the slope of the w(z) (which, for these measurements, is clearly shown by the plot that the beam was measured in the far-field and thus w is approximately a linear function of z). An array of the z-location of the ruler, the fit parameters A, x0, x, and the 2-norm of the residual of the fit is also outputted, and is shown below for the experimental data:

 

z(ruler) A x0 w 2normres
36.5 7.5915 11.089 0.8741 0.1042
39.9 5.2604 11.1246 1.048 0.1013
44 3.8075 11.1561 1.2332 0.1164
48 2.777 11.1628 1.4479 0.0964
52 2.1457 11.1363 1.6482 0.1008
56 1.6872 11.4206 1.858 0.1029
60 1.3831 11.2469 2.0523 0.1021
64 1.1564 11.1997 2.2432 0.1059
68 0.972 11.1851 2.4483 0.0976
72 0.8356 11.1728 2.6392 0.1046
78 0.67 6.8821 2.9463 0.0991
84 0.5559 6.7548 3.2375 0.1036
90 0.4647 6.715 3.5402 0.0958
96 0.3993 6.7003 3.8158 0.1179
112 0.2719 6.8372 4.6292 0.0924
118 0.2398 6.7641 4.925 0.1029
124 0.2117 6.7674 5.2435 0.1002
130 0.189 6.8305 5.5513 0.0965
136 0.1709 6.8551 5.8383 0.1028
142 0.1544 6.8243 6.1412 0.0981
148 0.1408 6.7993 6.4313 0.099
154 0.1286 6.8062 6.7322 0.0948
160 0.1178 6.9059 7.0362 0.1009
166 0.1089 6.904 7.3178 0.0981
172 0.1001 6.8817 7.6333 0.1025
178 0.0998 6.711 7.6333 0

 

All outputted PDF's are included in the .zip file attached. The MATLAB functions themselves are also attached.The plots of the fit curves and the plot of the widths vs. the ruler location are also included below:

 

(note that I could probably improve on the colormap that I chose for this. note also that the 'gap' is because I temporarily forgot how to add integers while taking the measurements, and thus went from 96mm on the ruler to 112mm on the ruler despite going by a 6mm increment otherwise in that range. Also, note that all of these fit curves were automatically centered at x=0 for the plot, so they wouldn't necessarily intersect so neatly if I tried to include the difference in the estimated 'beam centers')

(note that the width calculated from the 26th measurement is not included in the regression calculation or included on this plot. The width parameter was calculated as being exactly the same as it was for the 25th measurement, despite the other parameters varying between the measurements. I suspect that the beam size was starting to exceed the dimensions blocked by the razor and that this caused this problem, and that would be easy to check, but I have yet to do it. Regardless, the fit looks good from just the other 25 measurements)

These results are as expected: that the beam spot-size should increase as a function of z and that it should do so linearly in the far-field. My next step will be to use the results of this experiment to calculate the properties of the SLED beam, characterizing the beam and thusly enabling me to predict its behavior within further optical systems.

 

Attachment 1: BeamData.xlsx
Attachment 2: beam_pdfs.zip
Attachment 3: beamdata.m
function D=beamdata(M,guess)
%Imports array of beam characterization measurements. Structure of M is 
% [z, x, I, a] where z is the displacement of the beam blockage along
% the optical axis, x is the coordinate of razor edge, I is the measured
% output of the photodetector and a is the ambient light level
%and guess is an estimate of the parameters [Amplitude x0 width] for the
%first measurement
%Output Structure [z A x0 w residual_2norm]
thisfile=mfilename('fullpath');
thisdir=strrep(thisfile,mfilename(),'');
... 105 more lines ...
Attachment 4: gsbeam.m
function I=gsbeam(x,xdat)
I=pi/4*x(1)*x(3)^2*erfc(sqrt(2)*(x(2)-xdat)/x(3));
end
ELOG V3.1.3-