This new WFS has an order of magnitude more sub-apertures than the webcam when the entire frame is used, so almost all of my files dealing with sensing has/d to be changed. Not only do they have to deal with the extra slope measurements, but just processing such large images quickly is turning out to be a challenge.
The new code for calculating the intensity centroids runs fairly quickly, around 8Hz, but I think looping over each sub-aperture in the image is unavoidable. Originally, I thought there might be some way to write the entire calculation as a single linear transformation, since loops in MATLAB run like frozen molasses in comparison. However because each centroid calculation requires a division by the total intensity across the sub-aperture, its clearly a nonlinear operation. As an obvious counterexample, if the image intensity was doubled while the phase was held constant, the calculated centroids should (theoretically) remain the same since each centroid calculation is normalized by the net intensity. Therefore, there is no matrix that maps the (vectorized) image to the slope vector. Even if there was, it'd be huge anyway.
Reconstructing the phase from the slope vector is turning out to be more of a challenge. Following the Southwell paper, there is definitely a linear model in this case, Hp=s, where p is a vector of phase points and s is the slope vector. H is is a matrix that averages the phases in some way to produce the slopes based on some geometry. The problem is that in my case H is a very large sparse matrix, around 4000x2000. Calculating the pseudo inverse takes several minutes, thus p=pinv(H)*s is not useful for real-time calculations. Using p=H\s works fairly quickly since it uses QR factorization, but it doesn't yield the minimum norm solution (pinv does).
It turns out that there are 2 phase patterns that yield zero slope, i.e. H is rank deficient by 2. Looking at the SVD of H, these 2 patterns correspond to a constant phase, and a checkerboard patten. The constant phase problem can be eliminated by requiring the phase to be zero mean (by adding a row of ones to H and a corresponding zero entry in s), but I'm not sure how to get around the checkerboard as its basically just a fact of the equations for averaging the phase points. Because of this, when p is not the minimum norm solution to Hp=s, some component in the null space of H is present, meaning that some of the checkerboard pattern shows up. This is annoying because its high frequency, and makes the reconstructed phase look quite jagged. Fortunately reconstructing the phase in real time isn't really required for control, so fixing this is a low priority for now.
I also wrote a simple little script to plot the x and y tilt components of the slope as a bar graph in real time. This is useful for aligning the tilt of the DM, especially since the AOS software that came bundled with the camera runs around 1hz if the entire frame is used (probably because of this phase reconstruction problem). I'm thinking of adding the projection of the slope onto the focus mode as well so I can correct that similarly.
Wednesday, April 15, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment