Advertisement
Geometrian

Laser wavelength calculation

Jan 18th, 2018
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Grating equation:
  2. #   d sin(θₘ) = m λ
  3.  
  4. #See also:
  5. #   http://academia.hixie.ch/bath/laser/home.html
  6. #   https://laserpointerforums.com/f70/make-your-own-spectrometer-under-1-a-98640.html
  7.  
  8. #Map of laser ID onto measurement tuples of form:
  9. #   ( grating spacing (m / cycle),
  10. #     distance to wall (m),
  11. #     distance from mode 0 to mode 1 (m)[,
  12. #     distance from mode 0 to mode 2 (m)[,
  13. #     ...]] )
  14. data = {
  15.     "405nm laser (test)" : [
  16.         (1.0e-3/1000.0, 1.5885, 0.703),
  17.     ],
  18.     "445nm laser (test)" : [
  19.         (1.0e-3/1000.0, 1.5885, 0.796),
  20.     ],
  21.     "515nm laser (test)" : [
  22.         (1.0e-3/1000.0, 1.5885, 0.9585),
  23.     ],
  24.     "532nm laser (test)" : [
  25.         (1.0e-3/1000.0, 1.5885, 0.998),
  26.     ],
  27.     "638nm laser (test)" : [
  28.         (1.0e-3/1000.0, 1.5885, 1.3165),
  29.     ],
  30.     "650nm laser (test)" : [
  31.         (1.0e-3/1000.0, 1.5885, 1.389),
  32.     ],
  33. }
  34.  
  35. for laser in sorted(data.keys()):
  36.     l_ests = [] #in nm
  37.     measurements = data[laser]
  38.     for measurement in measurements:
  39.         mode = 1
  40.         for dist_mode in measurement[2:]:
  41.             sin_theta = dist_mode * (measurement[1]*measurement[1]+dist_mode*dist_mode)**-0.5 #sin(arctan(dist_mode/measurement[1]))
  42.             l_est = sin_theta * measurement[0] / mode
  43.             l_ests.append(l_est * 1.0e+9)
  44.             mode += 1
  45.     print(laser + ": " + str(l_ests) + " nm")
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement