@echo off
echo       Copyright Gleb Vdovin, 1995.
echo       LightPipes script: demonstration of amplitude and 
echo       phase filtering

rem       Here we form a shifted Gaussian distribution 
rem       aberrated with coma     

begin 0.1 1e-6 256 | gauss 0.02 0.02 0.01 | Zernike 3 1 0.02 1 > field1

rem       Intensity and phase are saved in files in and pha
rem       Note the command line argument 256 (!) -
rem       the default is 128

file_int in 256 < field1 |file_pha pha 256 >null

rem       Here we form a new beam with a uniform 
rem       phase and intensity:

begin 0.1 1e-6 256 > field2

rem       Here we filter it through saved intensity and phase:
rem       The field in file field3 has Gaussian intensity 
rem       and uniform phase

int_filt in < field2 > field3 

rem       The field in file field4 has uniform intensity
rem       and aberrated phase

pha_filt pha < field2 > field4

rem       The field in a file field5 has the same distribution
rem       of the complex amplitude as the initial beam field1

pha_filt pha <field2 | int_filt in > field5

rem       End, all the files have to be erased:

del field1 
del field2 
del field3 
del field4 
del field5
del null



