Spectrograph pincushion distortion?

Bigger

Leading Member
Messages
726
Solutions
1
Reaction score
443
I built a large spectrograph with a plumb line instead of a slit, and distance for collimation. It uses a linear transmission grating mounted in front of the camera lens, but its spectral lines appear curved:

Comparative spectrogram using an illuminated 19-gauge solid stainless steel wire and a 24x36mm (51mm^2 mounted) 1000 l/mm linear transmission diffraction grating in front of the right-hand side of an EFS 10-18mm lens @10mm f/4.5. Cokin 121 graduated ND8 filter applied to wire only. Unedited in-camera JPG from an EOS R7 at 3.5m sensor-subject distance with Tungsten WB.
Comparative spectrogram using an illuminated 19-gauge solid stainless steel wire and a 24x36mm (51mm^2 mounted) 1000 l/mm linear transmission diffraction grating in front of the right-hand side of an EFS 10-18mm lens @10mm f/4.5. Cokin 121 graduated ND8 filter applied to wire only. Unedited in-camera JPG from an EOS R7 at 3.5m sensor-subject distance with Tungsten WB.

This appears similar to pincushion distortion, but not from the lens directly--if I pan the camera, the zero-order image of the wire stays straight, while the first-order spectral lines stay curved (second-order lines appear even more curved). With the wire centered and plumb with the sensor as above, I can get the lines reasonably straight by applying pincushion distortion correction:

Crop from RAW file associated with JPG above, with -75 lens distortion correction in Adobe Lr.Spectra from top: Soft White 2700K spiral CFL, 3000K Bright White LED PAR38, Mixjoy Desert Fluorescent Lamp UVB10.0 (spiral CFL for reptiles), T-3 Tungsten Halogen (tape mask on wire in center of spectrum for level reference), Mixjoy 160W Reptile Heat Lamp Bulb (self-ballasted Mercury Vapor R40 spot with tungsten filament), 70 W Sylvania Metalarc Ceramic Metal Halide ED17 (clear/uncoated).
Crop from RAW file associated with JPG above, with -75 lens distortion correction in Adobe Lr.Spectra from top: Soft White 2700K spiral CFL, 3000K Bright White LED PAR38, Mixjoy Desert Fluorescent Lamp UVB10.0 (spiral CFL for reptiles), T-3 Tungsten Halogen (tape mask on wire in center of spectrum for level reference), Mixjoy 160W Reptile Heat Lamp Bulb (self-ballasted Mercury Vapor R40 spot with tungsten filament), 70 W Sylvania Metalarc Ceramic Metal Halide ED17 (clear/uncoated).

The curvature does not appear to be sensitive to the distance or angle of the grating relative to the lens. If I look through the diffraction grating held close to my eye, I can see the curvature, but I need to get closer to the wire to make it obvious (1-2m).

I'm unsure what causes this, and whether it can be corrected by improved technique. All the info I have seen only shows a plan view of a 2D cross-section of the problem.

The wire is more than 1m long to allow comparison of illuminants, including a reference source required to calibrate wavelength, and the curvature complicates the calibration. It is not reasonably feasible to collimate the wire. I could increase the distance to minimize the curvature, but I would prefer to eliminate it if possible, or at least better understand it if not.
 
Last edited:
I may have found at least a partial answer. I realized that on radials angled to the horizontal plane, the light rays see the diffraction grating at an angle, so the apparent slit spacing is multiplied by cosine theta. This increases the effective slit density, so the diffracted light rays are bent more, and projected further from the zeroth order line. This causes them to bow outward in the corners.

I thought a fisheye lens might correct this, but it only partially compensates:

Similar spectrogram setup from OP, but with an adapted Sigma 8mm f/3.5 EX DG Circular Fisheye Lens for Canon EF. Spectral lines show reduced pincushion distortion. Unedited in-camera JPG from an APSC crop sensor EOS R7. The black outer circle is from a telephoto lens hood used to block stray light. The barrel distorted faint white rectangle is from the inner edge of the diffraction grating paper slide mount.
Similar spectrogram setup from OP, but with an adapted Sigma 8mm f/3.5 EX DG Circular Fisheye Lens for Canon EF. Spectral lines show reduced pincushion distortion. Unedited in-camera JPG from an APSC crop sensor EOS R7. The black outer circle is from a telephoto lens hood used to block stray light. The barrel distorted faint white rectangle is from the inner edge of the diffraction grating paper slide mount.

It's wild seeing pincushion distortion on a fisheye lens!

Using a telephoto lens hood on a fisheye is also wild!
 
Last edited:
"I'm unsure what causes this, and whether it can be corrected by improved technique"

You are quite smart to ask this question before going off and working on a lot of code to compensate this effect. Very often I have seen people spend a lot of effort coding for things that would have gone away with better technique (like making sure the sensor isn't getting saturated, or the sensor is exactly one f from the lens, or the sensor is perpendicular to the optical axis, or there is no vignetting). However, this is not one of those cases.

For this discussion, we can regard the lens as an ideal lens. In that case, with the sensor exactly one focal length from the lens, and with collimated rays entering the lens, the position of the light ray on the sensor is directly proportional the angle raying entering the lens. (y=f*theta). If you imagine a plane wave entering the lens, all the light rays in it focus down to a single point,

If you know about the y=f*theta thing, you can imagine tracing rays from the sensor, through the lens, and then through the transmission grating. (Going backwards is a powerful and common optical analysis trick.) If you imagine this, you will see that our imaginary rays going backwards out of the grating have some convergence.

So, switching to thinking of going in the forward direction, from the wire light source, the nice set of almost collimated rays coming from the distant wire light source, in three-dimensional space, does not match what our backward raytrace showed for rays in between the grating and the lens. Instead we it looks like the bending of a ray not only depends on its wavelength, but also according to how far off axis horizontally and vertically it is from the optical axis.

And as you observed, the non-linearity is more for the higher diffractive orders. In one dimension, the change in angle through the grating, by order and with wavelength, is described by the "grating equation" and it is a transcendental equation. Adding the second dimension, so now we have skew rays (out of a single plane), adds another complication of transmission through the grating equation.

If you had a simple thin prism doing the dispersion for you, the deviation of a rays would be linearly proportional to (n-1) where n is the index of refraction of glass and the index varies with wavelength. A grating gives you more dispersion, but at the cost of having a larger non-linearity to deal with. (There is a little bit of non-linearity with the glass prism since they work by Snell's law, but it is very small with a thin prism.) Anyway, with a thin prism you would be seeing more of what you expect which is the spectrographic pattern falls onto a rectilinear grid. But with a grating, you get what looks like distortion.

(If one is thinking of gratings and interference patterns of coherent light, it can seem mis-guided to be discussing gratings in terms of light rays - which don't have any coherent properties. But it is common practice with the everyone keeping in mind that what is being called a light ray is a line normal to a planar wavefront which does have spatial coherence. It is the extent of the plane across the grating that allows for interference and the dispersion.)
 
Last edited:
may not apply to your situation, but I found that I had to pay attention to the angle of presentation of the diffraction grating to the focal plane in order to get a symmetric spectrum for camera profiling. Read all about it here:

https://discuss.pixls.us/t/the-quest-for-good-color-4-the-diffraction-grating-shootout/19984
Thanks for the link. It was very helpful, including the embedded links.

Yes, the grating angle is important. If I set the grating angle so the inbound wavefront is parallel to the grating as in my OP, or if I set it so the outbound wavefront is parallel as in your post, the spectral lines are curved. But if I split the difference, the spectral lines straighten up on the other side:

EOS R7 w/ 84mm^2, 1000L/mm planar transmission diffraction grating in front of adapted Sigma 8mm f/3.5 EX DG Circular Fisheye Lens for Canon EF. Unedited in-camera JPG. The image center is equidistant from the zeroth-order white line and the green line in the right-hand first-order spectra. Note left-hand first-order spectral lines appear straight!
EOS R7 w/ 84mm^2, 1000L/mm planar transmission diffraction grating in front of adapted Sigma 8mm f/3.5 EX DG Circular Fisheye Lens for Canon EF. Unedited in-camera JPG. The image center is equidistant from the zeroth-order white line and the green line in the right-hand first-order spectra. Note left-hand first-order spectral lines appear straight!

Above, the zero-order image of the illuminated wire is curved, but it goes straight through the grating, so the curvature is from the fisheye lens barrel distortion alone. The right-hand first-order spectra are curved into pincushion distortion by the grating pincushion distortion overpowering the barrel distortion of the fisheye lens projection. But on the left-hand first-order spectrum, the grating pincushion distortion balances the fisheye lens barrel distortion, and the spectral lines appear straight!

So now I know the optimal orientation of the diffraction grating is to align it so the inbound and outbound wavefronts are at the same angle. The fisheye lens was a good test, but it's ridiculously impractical. It's a major pain to control stray light with a >180 deg viewing angle!
 
Last edited:
that is pretty cool you found a solution like that. rather unexpected.

you may already know this, but different kinds of fisheye lenses have different projection profiles. so it is even more cool that the one you picked matched the grating.
 
that is pretty cool you found a solution like that. rather unexpected.

you may already know this, but different kinds of fisheye lenses have different projection profiles. so it is even more cool that the one you picked matched the grating
I think the fisheye projections differ most in how they map around the edges. I'm using the center of the APSC frame, and it's a FF lens. So it's mostly adding generic barrel distortion there, and it's possible to use that to minimize the pincushion in part of the frame.

Here is the same test with a 500L/mm grating mounted to the 72mm lens cap threads on the Sigma 8mm f/3.5:

As before but with 500L/mm planar grating flush mounted on 8mm circular fisheye lens. Unedited in-camera JPG. Three CFL bulbs added to fill gaps in the spectra.
As before but with 500L/mm planar grating flush mounted on 8mm circular fisheye lens. Unedited in-camera JPG. Three CFL bulbs added to fill gaps in the spectra.

The left-hand first-order spectral lines appear straight with the image center between the zero-order white line and the right-hand first-order green line as before. But the left-hand second-order lines are curved opposite the right-hand side. So, panning the camera to the right shifts the centerline of the pincushion to the left by about double the angle.

I re-ran the test with the rectilinear lens as well:

As above with 10mm rectilinear lens.
As above with 10mm rectilinear lens.

So this trick does not work with the rectilinear lens. The pincushion distortion does appear to shift with the spectra, but there is no barrel distortion to cancel it out.
 
Last edited:
that is pretty cool you found a solution like that. rather unexpected.

you may already know this, but different kinds of fisheye lenses have different projection profiles. so it is even more cool that the one you picked matched the grating
I think the fisheye projections differ most in how they map around the edges. I'm using the center of the APSC frame, and it's a FF lens. So it's mostly adding generic barrel distortion there, and it's possible to use that to minimize the pincushion in part of the frame.

Here is the same test with a 500L/mm grating mounted to the 72mm lens cap threads on the Sigma 8mm f/3.5:

As before but with 500L/mm planar grating flush mounted on 8mm circular fisheye lens. Unedited in-camera JPG. Three CFL bulbs added to fill gaps in the spectra.
As before but with 500L/mm planar grating flush mounted on 8mm circular fisheye lens. Unedited in-camera JPG. Three CFL bulbs added to fill gaps in the spectra.

The left-hand first-order spectral lines appear straight with the image center between the zero-order white line and the right-hand first-order green line as before. But the left-hand second-order lines are curved opposite the right-hand side. So, panning the camera to the right shifts the centerline of the pincushion to the left by about double the angle.

I re-ran the test with the rectilinear lens as well:

As above with 10mm rectilinear lens.
As above with 10mm rectilinear lens.

So this trick does not work with the rectilinear lens. The pincushion distortion does appear to shift with the spectra, but there is no barrel distortion to cancel it out.
Just an update to say that the fisheye lens was an interesting curiosity, but was ultimately a dead end that produced low-res spectra. I could only get the lines to straighten if I panned the lens away from the straight lines. I could not get the lines to straighten with the lens pointed to the wire, much less the intended straight lines, no matter what angle I set the grating at. So the fisheye lens didn't have enough barrel distortion!

I'm working with longer focal-length lenses on the R5 now, which is much more practical. The grating spacing sets the angular width which sets the focal length for a given sensor fill, and that sets the height and/or working distance. Here it is with a 40mm pancake prime lens a little further back:

View attachment 44ac58a8d7784a7db2dbda9ea46595b8.jpg
Illuminated 22 AWG wire with 600L/mm transmission diffraction grating in front filter threads of adapted EF40/2.8 on EOS R5. Unedited IBIS high-res JPG.Illuminants from top: Coated Metal Halide HID, CFL, Tungsten Ballasted Mercury Vapor HID, Tungesten Hallogen incandescent, Coated MH HID same as top.

This cleans up in Adobe Ps with -12 pincushion distortion in Filter/Lens Correction:

View attachment 0decceb063e948a094094a3bc56b000b.jpg.png
Above straightened in Adobe Ps with -12 distortion.

So I can get both sides straight, which was impossible with the fisheye. Only one side is needed, but I initially kept the other side as a check.
 
Last edited:
I used a planar grating perpendicular to the lens axis and parallel to the sensor. I used a wide-angle lens centered on the wire to show the full symmetrical +/- first-order spectra to demonstrate the apparent pincushion distortion and correction, without introducing the added complexity of off-angle incidence to the grating normal (for in-plane diffraction, i.e. horizontal with a vertical wire and horizontal lens axis).
The apparent pincushion distortion is explained by the full conical diffraction grating equation including gamma, which is the vertical angle of incidence to the grating off the vertical wire. So the spectral lines above and below the horizontal get diffracted through a larger angle.
 
Interesting work that fellow did. That was some fine garage shop engineering. But it also makes me really appreciate how nice having a modern 3D printer is rather than dealing with wood.
 

Keyboard shortcuts

Back
Top