<blockquote>
  <p>Why are Shack-Hartmann sensors so expensive (4k+ USD)?</p>
</blockquote>

<p>I had the same feeling the first time I saw their prices. In principle they are just an array of microlenses one focal length in front of a CCD or CMOS imaging chip. It can even be a pinhole array in some specific cases, depending on what you need to resolve and the nature of your incoming wavefront.</p>

<p>Here are some examples of  being used to analyze the optical performance of astronomical telescopes:</p>

<ul>
<li>In preparation for the Nasmyth focus of one of the VLT unit telescopes: <a href="https://www.eso.org/sci/libraries/SPIE2008/7012-124.pdf" rel="nofollow noreferrer">Design and pe rformances of the Shac k-Ha rtmann sensor within
the A ctive Phasing E xpe riment</a></li>
<li>ResearchGate: <a href="https://www.researchgate.net/publication/227199650_Shack-Hartmann_wavefront_sensor_for_testing_the_quality_of_the_optics_of_the_25-m_SAI_telescope" rel="nofollow noreferrer">Shack-Hartmann wavefront sensor for testing the quality of the optics of the 2.5-m SAI telescope</a></li>
<li>Alcor System: <a href="http://www.alcor-system.com/new/SH/Shackscope40x40.html" rel="nofollow noreferrer">Shack-Hartman</a></li>
<li>Spot Optics: <a href="http://www.spot-optics.com/downloads/pdf/telsc_cassegrainfocus.pdf" rel="nofollow noreferrer">Shack-Hartmann wavefront sensor test of a telescope at Cassegrain
focus</a></li>
</ul>

<p>If the 4k+ is well outside the range you'd like to spend on this application, then consider building your own for some simple tests. After trying that a while you may discover that your results are off, or non-repeatable, or getting the software to reliably extract a reasonable wavefront shape is harder than you thought.</p>

<p>But yes, <em>in principle</em> it's just a dark box with an array of lenses or holes and a CCD or CMOS imaging array, and <em>a bunch of software</em> that you'd have to write from scratch.</p>

<p>You'll have to mount the array and the sensor rigidly, take care to manage every bit of stray light (especially any with spatial structure!) think about thermal expansion, write the capture, processing, and wavefront-extraction software, etc yourself. </p>

<hr>

<p>There are several things that drive the price up higher than you would initially expect. There's quality in workmanship, a warrantee, a guaranteed spec that it will meet, software, support, accessible repair, a large installed base and track record, etc. In the end these add up to the costs that you encounter. Add to that the idea that if they made a low-end sensor, people wouldn't be forced to buy the expensive one! </p>

<p><a href="https://i.sstatic.net/ihieV.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ihieVm.jpg" alt="Shack-Hartmann sensor Alcor-Systems"></a> Source: <a href="http://www.alcor-system.com/new/SH/Shackscope40x40.html" rel="nofollow noreferrer">Alcor-Systems</a></p>

CC BY-SA 4.0
2019-07-09T06:47:36.740Z
2019-07-09T06:58:30.647Z
2019-07-09T06:58:30.647Z
uhoh
<p>I have been deeply involved in both Shack-Hartmann and lateral-shear polarization interferometers. Now I want something simple and slow for hobby projects and had the same question. I don’t think such a project is as daunting as might be imagined.  One would like 12 bits in the camera, the Sony CMOS cameras are so good, the last bit is nearly noise free.
The camera need not be expensive: Any amateur telescope web store will have dozens for less than $400.  You want monochrome, preferably USB 3, with the largest diagonal focal plane size you can afford.  A Global shutter is nice if you have a dynamic situation. Rolling shutters are generally lower noise.</p>
<p>A lens array will be expensive.  Thorlabs, Seuss, and RPC Photonics, and others sell them for \$400-\$600.  The Thorlabs arrays are mounted.  In the end you want the focal spot to be at least 2 pixels across. Choose your micro lens F/# accordingly, usually quite slow, F/20 or more. Likely you want the closest pitch you can find as this sets the spatial resolution. A 4 x 5 mm focal plane will view 40 x 50 micro lens spots. Good enough.</p>
<p>You will need to craft a mount that mates the camera and the lenslet array at the micro lens focus distance.  They are slow, so the depth of field should be forgiving.</p>
<p>The real crux is the software.  There is public domain software that is close (git has AOtools) and there may be more. You will need to take a dark exposure for the shutter time used (I typically take 100 frames and average them).  Then the reaL GOTCHA issue: What to use as a reference?  You can use a shear plate to focus a collimated light source (a single mode VCSEL works well), but you are unlikely to have a shear plate about.  Place the VCSEL or other point source bright enough to see (an LED?) as far away in a dark room as you can manage.  Don’t use a mirror or lenses, turn off heating and cooling, etc. This gives you a known curvature. for 100 μm lenslets at F/20 the focal length is 2mm so a tilt of 1/2 a subaperture (to keep things easy) or 50 μm is only 25 milliradians (mr), something over a degree.  The edge of the camera must see the source as no larger than this angle.  So if you have 50 subapertures across your camera the edge is 2.5 mm from the middle.  Thus 2.5e-3 meters / d = 2.5e-3 radians so the source needs to be more than a meter away.  Easy!  With the distance from the source to the focal plane known you can now easily calculate the tilt distribution (should look spherical).</p>
<p>Use openCV or your favorite utility to get images into your computer and a) subtract background b) make sure the camera does not saturate (adjust exposure time, retake the dark background and try again) c) calculate the peak intensity of each spot and which pixel coordinates that is in d) Draw a box around each focal spot which is several spot diameters across each spot e) calculate the centroid of each spot using only pixels in the box (the rule is add no pixels that do not contribute to your signal, the centroid). You can play with the box size.  An F/20 blue-green 500 nm wavelength spot from a 100 μm lenslet will be about lambda F/# across (just 20 wavelengths, about 10 μm) which should be 3 to 4 pixels so a box 16 x 16 pixels should be a good place to start.  The centroids should be good to a small fraction of a pixel.  I have done better than 1/100 pixel with a really good focal plane array and 1/20 pixel for standard cameras such as the above. Now you can calculate the centroid location within the box, and reference that to the whole array.  A plot across a slice will give you a linear function which is somewhat less than the lenslet pitch.  Do this in both X and Y.  You may have a rotation in the spot coordinates. You can physically correct this, or use math.  The slope in X and Y should be the same.  If not, the lens array is tilted.  If you move the light further away, the spots should move to be more directly behind the lenslets.</p>
<p>In passing I would note that I found the accuracy of the lithography on the imager, and used to make the lenslet array was better than my best tilt calibration! Thus for a 3.5 μm pixel and 100 μm lenslet the spots should be 100/3.5 pixels apart.  This will be independent of focus etc.  I also found trying to uniformly illuminate the array to correct for the variation in responsivity pixel by pixel generated more noise, not less.  Silicon is awfully good.</p>
<p>The last calibration needed is to define where zero tilt is.  This should be close to normal to the focal plane array, so pick the middle lenslet and the pixel you declare is on boresight. Now you have the subaperture tilts calibrated.</p>
<p>The last messy task is to convert from wavefront subaperture tilt to wavefront.  There are books written on the subject. Notionally if you start at your zero tilt and add up the subaperture tilts as you move across the array, subtracting the zero tilt position of each subaperture, you have wavefront.  Note you can take <em>any</em> path from the center to the subaperture you want to know and add up the X and Y tilts and you should get the same answer.  Ideally you want to take the average of all possible paths (that are illuminated) as that would be the best average value you could get.  This is referred to as the minimum RMS error.  There are many ways to calculate this.  If you think of the tilts as the gradient in phase, and calculate the divergence of the gradients, you have a measure of the wavefront curvature.  It is also simply Laplace’s equation which can be solved by successive over-relaxation, or if you like fancy algorithms, use a multigrid method (it’s <em>way</em> faster). Greg Allen’s thesis has another approach, <a href="https://dspace.mit.edu/bitstream/handle/1721.1/120381/1084482108-MIT.pdf?sequence=1&amp;isAllowed=y" rel="noreferrer">https://dspace.mit.edu/bitstream/handle/1721.1/120381/1084482108-MIT.pdf?sequence=1&amp;isAllowed=y</a> .   There are many more.</p>
<p>In summary, you can build a Shack-Hartmann wavefront sensor for about $1000 and a lot of software development.  The Thorlabs sensor seems cheap given the effort, at least until someone comes up with an open source sensor and software.</p>
<p>Jon</p>

CC BY-SA 4.0
2021-04-28T20:58:54.293Z
Great answer! Could you please explain some more on why it is so expensive?
WarpPrime
CC BY-SA 4.0
2021-04-30T19:31:26.893Z
Thanks for your elaborate answer. So the conclusion about the expensive price is in software. I think the calibration pipeline could be further simplfied, because wavefront is only relevant to relative spot movements between reference and measurement. That said, as long as the light source is fixed for both calibration and measurement, then the algorithm should work.
WDC
CC BY-SA 4.0
2021-04-28T19:57:04.273Z
2021-04-28T23:20:48.683Z
2021-04-28T23:20:48.683Z
Jon Twichell
<p>Recently I am searching for a Shack-Hartmann wavefront sensor for university laboratory usage. I was expecting my target sensor to be cheap, which is:</p>

<ul>
<li><p>Low spatial wavefront resolution (50 x 50) for beam measurement;</p></li>
<li><p>Low frame rate;</p></li>
<li><p>Portable design, and easy to use.</p></li>
</ul>

<p>Most quotations are beyond my expectation. On ThorLabs it costs 4k USD (which is, "cheaper" compared to most competitors):
<a href="https://www.thorlabs.com/thorproduct.cfm?partnumber=WFS30-5C" rel="noreferrer">https://www.thorlabs.com/thorproduct.cfm?partnumber=WFS30-5C</a></p>

<p>Following reasons may to blame for this high price:</p>

<ul>
<li><p>Expensive industrial sensors. But for <a href="https://www.flir.com/products/grasshopper3-usb3/?model=GS3-U3-14S5M-C" rel="noreferrer">https://www.flir.com/products/grasshopper3-usb3/?model=GS3-U3-14S5M-C</a> it takes only 1.7k USD for a high performance sensor.</p></li>
<li><p>Microlens array (MLA) fabrication?</p></li>
<li><p>MLA-sensor alignment?</p></li>
<li><p>Software development? (SDK &amp; GUI)</p></li>
</ul>

<p>But I am not convinced by myself. </p>

<p>Any ideas why a Shack-Hartmann sensor is so expensive?</p>

CC BY-SA 4.0
2019-07-08T14:16:33.410Z
There are several things that drive the price up higher than you would initially expect. There's quality in workmanship, a warrantee, a guaranteed spec that it will meet, software, support, accessible repair, a large installed base and track record, etc. In the end these add up to the costs that you encounter. Add to that the idea that if they made a low-end sensor, people wouldn't be forced to buy the expensive one!
uhoh
CC BY-SA 4.0
2019-07-08T14:18:08.603Z
You certainly may be able to build your own using a cheap microlens array or even a pinhole array in some specific cases, depending on what you need to resolve and the nature of your incoming wavefront. You'll have to mount the array and the sensor rigidly, take care to manage every bit of stray light (especially any with spatial structure!) think about thermal expansion, write your own analysis software, etc. If you have the time it might be quite fun!
uhoh
CC BY-SA 4.0
2019-07-08T21:39:49.330Z
I'm voting to close this question as off-topic because it's really about business economics, not astronomy.
StephenG - Help Ukraine
CC BY-SA 4.0
2019-07-09T06:54:37.287Z
@StephenG **I'm voting to keep this question open!** We talk about the price difference between cheap and expensive telescopes here, and what it is that makes the expensive one expensive, you wouldn't want to close all of those too now would you? A Shack-Hartmann sensor is a standard Optical metrology tool and has application in telescope building and characterization, I don't think this question is off-topic here.
uhoh
CC BY-SA 4.0
2019-07-09T10:07:33.607Z
@uhoh Questions like this are not only time limited in usefulness, but also *region* limited in usefulness.  It's just not a good fit for SE's model.  Ultimately something costs what it does because that's what someone decided to charge for it.
StephenG - Help Ukraine
CC BY-SA 4.0
2019-07-09T17:02:58.750Z
What is the intended use? The astronomers here think purely in terms of mounting on a 'scope, but if all you are doing is measuring a wavefront in a lab, and at low update rates as well, the task gets a lot easier.  Then the major cost is for the software package that facilitates analysis. "Stitching" the subaperture phase front data into a continuous pattern is nontrivial.
Carl Witthoft
CC BY-SA 4.0
2019-07-10T06:50:36.547Z
@CarlWitthoft The purpose is to use the sensor to measure beam collimation/wavefront smoothness. Yes it is true the task is simple (for software part, there are even open source code everywhere on github) so I am wondering why it costs so much for a commercial one.
WDC
<optics><adaptive-optics>
Why are Shack-Hartmann sensors so expensive (4k+ USD)?
WDC
# Why are Shack-Hartmann sensors so expensive (4k+ USD)?

(Asked by: username_0 on 2019-07-08)

Recently I am searching for a Shack-Hartmann wavefront sensor for university laboratory usage. I was expecting my target sensor to be cheap, which is:

* Low spatial wavefront resolution (50 x 50) for beam measurement;
* Low frame rate;
* Portable design, and easy to use.

Most quotations are beyond my expectation. On ThorLabs it costs 4k USD (which is, "cheaper" compared to most competitors):
<https://www.thorlabs.com/thorproduct.cfm?partnumber=WFS30-5C>

Following reasons may to blame for this high price:

* Expensive industrial sensors. But for <https://www.flir.com/products/grasshopper3-usb3/?model=GS3-U3-14S5M-C> it takes only 1.7k USD for a high performance sensor.
* Microlens array (MLA) fabrication?
* MLA-sensor alignment?
* Software development? (SDK & GUI)

But I am not convinced by myself.

Any ideas why a Shack-Hartmann sensor is so expensive?

**Tags:** optics, adaptive-optics

> **Comments:**
> **username_1**: There are several things that drive the price up higher than you would initially expect. There's quality in workmanship, a warrantee, a guaranteed spec that it will meet, software, support, accessible repair, a large installed base and track record, etc. In the end these add up to the costs that you encounter. Add to that the idea that if they made a low-end sensor, people wouldn't be forced to buy the expensive one!  
> **username_1**: You certainly may be able to build your own using a cheap microlens array or even a pinhole array in some specific cases, depending on what you need to resolve and the nature of your incoming wavefront. You'll have to mount the array and the sensor rigidly, take care to manage every bit of stray light (especially any with spatial structure!) think about thermal expansion, write your own analysis software, etc. If you have the time it might be quite fun!  
> **username_2**: I'm voting to close this question as off-topic because it's really about business economics, not astronomy.  
> **username_1**: @username_2 **I'm voting to keep this question open!** We talk about the price difference between cheap and expensive telescopes here, and what it is that makes the expensive one expensive, you wouldn't want to close all of those too now would you? A Shack-Hartmann sensor is a standard Optical metrology tool and has application in telescope building and characterization, I don't think this question is off-topic here.  
> **username_2**: @username_1 Questions like this are not only time limited in usefulness, but also *region* limited in usefulness.  It's just not a good fit for SE's model.  Ultimately something costs what it does because that's what someone decided to charge for it.  
> **username_3**: What is the intended use? The astronomers here think purely in terms of mounting on a 'scope, but if all you are doing is measuring a wavefront in a lab, and at low update rates as well, the task gets a lot easier.  Then the major cost is for the software package that facilitates analysis. "Stitching" the subaperture phase front data into a continuous pattern is nontrivial.  
> **username_0**: @username_3 The purpose is to use the sensor to measure beam collimation/wavefront smoothness. Yes it is true the task is simple (for software part, there are even open source code everywhere on github) so I am wondering why it costs so much for a commercial one.  

---

## 2 answers

### Answer by username_4 on 2021-04-28. Score: 9 | Accepted answer

I have been deeply involved in both Shack-Hartmann and lateral-shear polarization interferometers. Now I want something simple and slow for hobby projects and had the same question. I don’t think such a project is as daunting as might be imagined. One would like 12 bits in the camera, the Sony CMOS cameras are so good, the last bit is nearly noise free.
The camera need not be expensive: Any amateur telescope web store will have dozens for less than $400. You want monochrome, preferably USB 3, with the largest diagonal focal plane size you can afford. A Global shutter is nice if you have a dynamic situation. Rolling shutters are generally lower noise.

A lens array will be expensive. Thorlabs, Seuss, and RPC Photonics, and others sell them for \$400-\$600. The Thorlabs arrays are mounted. In the end you want the focal spot to be at least 2 pixels across. Choose your micro lens F/# accordingly, usually quite slow, F/20 or more. Likely you want the closest pitch you can find as this sets the spatial resolution. A 4 x 5 mm focal plane will view 40 x 50 micro lens spots. Good enough.

You will need to craft a mount that mates the camera and the lenslet array at the micro lens focus distance. They are slow, so the depth of field should be forgiving.

The real crux is the software. There is public domain software that is close (git has AOtools) and there may be more. You will need to take a dark exposure for the shutter time used (I typically take 100 frames and average them). Then the reaL GOTCHA issue: What to use as a reference? You can use a shear plate to focus a collimated light source (a single mode VCSEL works well), but you are unlikely to have a shear plate about. Place the VCSEL or other point source bright enough to see (an LED?) as far away in a dark room as you can manage. Don’t use a mirror or lenses, turn off heating and cooling, etc. This gives you a known curvature. for 100 μm lenslets at F/20 the focal length is 2mm so a tilt of 1/2 a subaperture (to keep things easy) or 50 μm is only 25 milliradians (mr), something over a degree. The edge of the camera must see the source as no larger than this angle. So if you have 50 subapertures across your camera the edge is 2.5 mm from the middle. Thus 2.5e-3 meters / d = 2.5e-3 radians so the source needs to be more than a meter away. Easy! With the distance from the source to the focal plane known you can now easily calculate the tilt distribution (should look spherical).

Use openCV or your favorite utility to get images into your computer and a) subtract background b) make sure the camera does not saturate (adjust exposure time, retake the dark background and try again) c) calculate the peak intensity of each spot and which pixel coordinates that is in d) Draw a box around each focal spot which is several spot diameters across each spot e) calculate the centroid of each spot using only pixels in the box (the rule is add no pixels that do not contribute to your signal, the centroid). You can play with the box size. An F/20 blue-green 500 nm wavelength spot from a 100 μm lenslet will be about lambda F/# across (just 20 wavelengths, about 10 μm) which should be 3 to 4 pixels so a box 16 x 16 pixels should be a good place to start. The centroids should be good to a small fraction of a pixel. I have done better than 1/100 pixel with a really good focal plane array and 1/20 pixel for standard cameras such as the above. Now you can calculate the centroid location within the box, and reference that to the whole array. A plot across a slice will give you a linear function which is somewhat less than the lenslet pitch. Do this in both X and Y. You may have a rotation in the spot coordinates. You can physically correct this, or use math. The slope in X and Y should be the same. If not, the lens array is tilted. If you move the light further away, the spots should move to be more directly behind the lenslets.

In passing I would note that I found the accuracy of the lithography on the imager, and used to make the lenslet array was better than my best tilt calibration! Thus for a 3.5 μm pixel and 100 μm lenslet the spots should be 100/3.5 pixels apart. This will be independent of focus etc. I also found trying to uniformly illuminate the array to correct for the variation in responsivity pixel by pixel generated more noise, not less. Silicon is awfully good.

The last calibration needed is to define where zero tilt is. This should be close to normal to the focal plane array, so pick the middle lenslet and the pixel you declare is on boresight. Now you have the subaperture tilts calibrated.

The last messy task is to convert from wavefront subaperture tilt to wavefront. There are books written on the subject. Notionally if you start at your zero tilt and add up the subaperture tilts as you move across the array, subtracting the zero tilt position of each subaperture, you have wavefront. Note you can take *any* path from the center to the subaperture you want to know and add up the X and Y tilts and you should get the same answer. Ideally you want to take the average of all possible paths (that are illuminated) as that would be the best average value you could get. This is referred to as the minimum RMS error. There are many ways to calculate this. If you think of the tilts as the gradient in phase, and calculate the divergence of the gradients, you have a measure of the wavefront curvature. It is also simply Laplace’s equation which can be solved by successive over-relaxation, or if you like fancy algorithms, use a multigrid method (it’s *way* faster). Greg Allen’s thesis has another approach, <https://dspace.mit.edu/bitstream/handle/1721.1/120381/1084482108-MIT.pdf?sequence=1&isAllowed=y> . There are many more.

In summary, you can build a Shack-Hartmann wavefront sensor for about $1000 and a lot of software development. The Thorlabs sensor seems cheap given the effort, at least until someone comes up with an open source sensor and software.

Jon

> **Comments:**
> **username_5**: Great answer! Could you please explain some more on why it is so expensive?  
> **username_0**: Thanks for your elaborate answer. So the conclusion about the expensive price is in software. I think the calibration pipeline could be further simplfied, because wavefront is only relevant to relative spot movements between reference and measurement. That said, as long as the light source is fixed for both calibration and measurement, then the algorithm should work.  

---

### Answer by username_1 on 2019-07-09. Score: 3

> Why are Shack-Hartmann sensors so expensive (4k+ USD)?

I had the same feeling the first time I saw their prices. In principle they are just an array of microlenses one focal length in front of a CCD or CMOS imaging chip. It can even be a pinhole array in some specific cases, depending on what you need to resolve and the nature of your incoming wavefront.

Here are some examples of being used to analyze the optical performance of astronomical telescopes:

* In preparation for the Nasmyth focus of one of the VLT unit telescopes: [Design and pe rformances of the Shac k-Ha rtmann sensor within
  the A ctive Phasing E xpe riment](https://www.eso.org/sci/libraries/SPIE2008/7012-124.pdf)
* ResearchGate: [Shack-Hartmann wavefront sensor for testing the quality of the optics of the 2.5-m SAI telescope](https://www.researchgate.net/publication/227199650_Shack-Hartmann_wavefront_sensor_for_testing_the_quality_of_the_optics_of_the_25-m_SAI_telescope)
* Alcor System: [Shack-Hartman](http://www.alcor-system.com/new/SH/Shackscope40x40.html)
* Spot Optics: [Shack-Hartmann wavefront sensor test of a telescope at Cassegrain
  focus](http://www.spot-optics.com/downloads/pdf/telsc_cassegrainfocus.pdf)

If the 4k+ is well outside the range you'd like to spend on this application, then consider building your own for some simple tests. After trying that a while you may discover that your results are off, or non-repeatable, or getting the software to reliably extract a reasonable wavefront shape is harder than you thought.

But yes, *in principle* it's just a dark box with an array of lenses or holes and a CCD or CMOS imaging array, and *a bunch of software* that you'd have to write from scratch.

You'll have to mount the array and the sensor rigidly, take care to manage every bit of stray light (especially any with spatial structure!) think about thermal expansion, write the capture, processing, and wavefront-extraction software, etc yourself.

---

There are several things that drive the price up higher than you would initially expect. There's quality in workmanship, a warrantee, a guaranteed spec that it will meet, software, support, accessible repair, a large installed base and track record, etc. In the end these add up to the costs that you encounter. Add to that the idea that if they made a low-end sensor, people wouldn't be forced to buy the expensive one!

[![Shack-Hartmann sensor Alcor-Systems](https://i.sstatic.net/ihieVm.jpg)](https://i.sstatic.net/ihieV.jpg) Source: [Alcor-Systems](http://www.alcor-system.com/new/SH/Shackscope40x40.html)


---

