PRO pistonbatch, bname=bname, path=path, half=half, $ xpix=xpix, ypix=ypix, nbit=nbit, maxGSL=maxGSL, dGSL=dGSL ;+ ; ; Creates a series of images with UNIFORM grayscale level ; If these are to be displayed via PowerPoint, ; use INSERT >> Photo Album. ; ; bname: the base name for the image files to be written to disk ; path: a string describing WHERE you want to save your files ; ; half: set to one, to set the left half of the array to zero ; ; xpix: number of pixels on a horizontal side, ; ypix: number of pixels on a vertical side, ; ; nbit: provides 2^nbit levels of phase, ; default setting is 8 (valid for most SLMs) ; maxGSL: the grayscale level corresponding to 2pi of phase, ; default setting is 2^nbit-1 ; dGSL: the step in grayscale level, from one image to the next ;- IF NOT keyword_set(bname) THEN bname = 'piston' IF NOT keyword_set(path) THEN path = 'C:\Users\Physics Student\Desktop\Piston\' ; On the MacOS, the path should look more like what's shown below: ; IF NOT keyword_set(path) THEN path = '/Users/gabespalding/Desktop/Piston/' IF NOT keyword_set(half) THEN half = 0 IF NOT keyword_set(xpix) THEN xpix = 1920 IF NOT keyword_set(ypix) THEN ypix = 1080 IF NOT keyword_set(nbit) THEN nbit = 8 IF NOT keyword_set(maxGSL) THEN maxGSL = 2^nbit-1 IF NOT keyword_set(dGSL) THEN dGSL = 5 ; For quick data try dGSL=20 FOR GSL = 0, maxGSL, dGSL DO BEGIN image = make_array(xpix, ypix, /byte, VALUE = GSL) IF half EQ 1 THEN BEGIN halfpix = xpix/2 image[0:halfpix, *] = 0 ENDIF ; Create a new output during each pass through the FOR loop: name = bname+strcompress(string(GSL), /REMOVE_ALL)+".bmp" write_bmp, path+name, image ENDFOR END