;+ ; NAME: ; holo_init ; ; PURPOSE: ; Set up the HOLO_COMMON common block for HOT applications. ; ; CATEGORY: ; Computational holography. Holographic optical trapping. ; ; CALLING SEQUENCE: ; holo_init ; ; KEYWORDS: ; slm: 2-element array containing the width and height of the SLM. ; doe: 2-element array containing the width and height of the DOE. ; One element is enough if the two are the same. ; zoffset: z displacement of trapping plane. ; ; COMMON BLOCKS: ; HOLO_COMMON ; ; RESTRICTIONS: ; Should be called before any of the other software in the HOLO ; suite, preferably from .idlstartx ; ; PROCEDURE: ; Straightforward ; ; EXAMPLE: ; IDL> holo_init, slm=[640,480], doe=480, zoffset=-200 ; ; MODIFICATION HISTORY: ; 06/05/2006: Written by David G. Grier, New York University ; 09/29/2006: DGG Added ZOFFSET calibration constant and keyword. ; Added zfactor calibration constant. ; 10/10/2006: DGG. Commented code. Added calibration constants for ; aberration correction. ; ; Copyright (c) 2006 David G. Grier ; ; LICENSE ; ; This program is free software; you can redistribute it and/or ; modify it under the terms of the GNU General Public License as ; published by the Free Software Foundation; either version 2 of the ; License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ; 02111-1307 USA ; ; If the Internet and WWW are still functional when you are using ; this, you shold be able to access the GPL here: ; http://www.gnu.org/copyleft/gpl.html ;- pro holo_init, slm=slm, doe=doe, zoffset = zoffset common holo_common, cal if n_elements(cal) eq 0 then $ cal = {slm_w: 640L, $ ; width of SLM window (pixels) slm_h: 480L, $ ; height of SLM window (pixels) slm_gamma: 1., $ ; gamma of SLM video display channel doe_w: 480L, $ ; width of computed DOE (pixels) doe_h: 480L, $ ; height of computed DOE (pixels) xc: 0., $ ; offset of optical axis relative ... yc: 0., $ ; ... to center of SLM (pixels) xscale: 1., $ ; ratio of x unit length to y unit. scale: 1., $ ; conversion of unit length to CCD pixels theta: 0., $ ; orientation of CCD relative to SLM (radians) zoffset: 0., $ ; default axial displacement (pixels) zfactor: 0., $ ; conversion factor for axial displacements ccd_xc: 320., $ ; location of of optical axis ... ccd_yc: 240., $ ; ... on the CCD (pixels) spherical: 0., $ ; spherical aberration (wavelengths) coma: 0., $ ; coma (wavelengths) coma_theta: 0., $ ; orientation of coma (radians) astig: 0., $ ; astigmatism (radians) astig_theta: 0., $ ; orientation of astigmatism (radians) curvature: 0., $ ; curvature of field (wavelengths) distortion: 0., $ ; barrel distortion (wavelengths) dis_theta: 0.} ; orientation of distortion (radians) if n_elements(slm) ge 1 then begin cal.slm_w = slm[0] if n_elements(slm) ge 2 then $ cal.slm_h = slm[1] $ else $ cal.slm_h = cal.slm_w endif if n_elements(doe) ge 1 then begin cal.doe_w = doe[0] if n_elements(doe) ge 2 then $ cal.doe_h = doe[1] $ else $ cal.doe_h = cal.doe_w endif if n_elements(zoffset) eq 1 then $ cal.zoffset = zoffset aperture = 5000.D ; 5 mm aperture on lens lambda = 0.532D * float(cal.doe_w) / aperture ; wavelength in pixels at aperture na = 1.4D ; numerical aperture f = aperture/na ; focal length in pixels cal.zfactor = 1./(lambda * f^2) end