Synchrotron Radiation Workshop
C++ C Rebol Objective-C Makefile Python
Switch branches/tags
Nothing to show
Failed to load latest commit information.
cpp compatibility with Sirepo; fix in 1D FFT usage; updates in Crystal an… Sep 30, 2016
env compatibility with Sirepo; fix in 1D FFT usage; updates in Crystal an… Sep 30, 2016
ext_lib added BM SR, X-ray Crystal examples; updated all sources Dec 4, 2015
literature/srw_pubs added BM SR, X-ray Crystal examples; updated all sources Dec 4, 2015
.gitignore compatibility with Sirepo; fix in 1D FFT usage; updates in Crystal an… Sep 30, 2016
COPYRIGHT.txt first commit Mar 13, 2013
README.txt compatibility with Sirepo; fix in 1D FFT usage; updates in Crystal an… Sep 30, 2016
repository_struct.txt Migration to Visual C++ 2013 on Windows; introduction of general Make… Nov 8, 2013


"Synchrotron Radiation Workshop" (SRW)

SRW is a physical optics computer code for calculation of detailed characteristics of Synchrotron Radiation (SR) generated by relativistic electrons in magnetic fields of arbitrary configuration and for simulation of the radiation wavefront propagation through optical systems of beamlines. Frequency-domain near-field methods are used for the SR calculation, and the Fourier-optics based approach is generally used for the wavefront propagation simulation. The code enables both fully- and partially-coherent radiation propagation simulations in steady-state and in frequency-/time-dependent regimes. With these features, the code has already proven its utility for a large number of applications in infrared, UV, soft and hard X-ray spectral range, in such important areas as analysis of spectral performances of new synchrotron radiation sources, optimization of user beamlines, development of new optical elements, source and beamline diagnostics, and even complete simulation of SR based experiments. Besides the SR applications, the code can be efficiently used for various simulations involving conventional lasers and other sources. SRW versions interfaced to Python and to IGOR Pro (WaveMetrics), as well as cross-platform library with C API, are available.

In the following writing, it is assumed that "SRW_Dev" is absolute path to the full SRW directory (obtained e.g. after downloading from repository).

Using pre-compiled SRW libraries and clients / bindings:
The last ~"clean" release of SRW for IGOR Pro and for Python can be found in SRW_Dev/env/release, in particular:
	- installers (of compressed packages) can be found in SRW_Dev/env/release/install;
	- unpacked folder of SRW for IGOR Pro (for Windows only) is:
SRW_Dev/env/release/srw_igor; this folder contains ReadMe.txt file with general "start-up" notes; detailed documentation for IGOR Pro version can be found in: SRW_Dev/env/release/srw_igor/SRW Help/SRW Help.ifn file (in IGOR formatted notebook format);
	- unpacked folder of SRW for Python (for Windows and Linux) is: SRW_Dev/env/release/srw_python; this folder contains ReadMe.txt file with general "start-up" notes.

Besides, some recent pre-releases and current work versions of SRW for Python and for IGOR Pro can be found in: SRW_Dev/env/work.

Testing of the pre-compiled SRW libraries and clients / bindings can be done using examples included both to Python and IGOR Pro versions of SRW (see "Check example" section below for a particular platform).

I. Compiling and testing SRW Library and its Python and IGOR Pro bindings on Windows:
1. Compile SRWLib library and Python binding using MS Visual Studio:
	Microsoft Visual C++ 2015 (or later version) solution file (SRW.sln), which includes 4 projects: 
	- SRW Library (file SRWLIB.vcxproj),
	- SRW Python client / binding (file SRWLClientPython.vcxproj),
	- SRW IGOR Pro client / binding (file SRWLClientIgor.vcxproj),
	- SRW C demo client (file SRWLClientC.vcxproj),
can be found in SRW_Dev/cpp/vc. These project files allow for compiling SRW for Python 2.7 and 3.x (64-bit or 32-bit), and SRW for IGOR Pro (32-bit only). Free Microsoft Visual Studio Community 2015 (or later versions) can be used.

2. Check examples:

2.1.	The SRW for Python examples can be tested using e.g. "IDLE" (Python native GUI). To do so, start this application (e.g. from Windows Start menu), open an example file in it, e.g. "SRW_Dev\env\work\srw_python\", and run it from the IDLE.
	Alternatively, the example scripts can be executed from the Windows Command Prompt, e.g. from within the "SRW_Dev\env\work\srw_python" directory. For convenience, correct path to python.exe file may need to be specified in the Windows system PATH variable prior to these tests.

2.2. The The SRW for IGOR Pro examples can be tested from "SRWE" and "SRWP" menus, "Help" sub-menus, of the IGOR Pro.

II. Compiling and testing SRW Library and its Python binding on Linux:
1. Compile SRWLib library and Python binding:
	This can be done either using Python "distutils" (see section 2.1 below) or without it (see section 2.2)

1.1. Compiling using Python "distutils" module:
	Make sure the "distutils" module of the Python version you would like to use is properly installed and configured. If this is done, the compilation and installation is simple:
	cd SRW_Dev
	make all
	This should compile libsrw.a and, and copy to SRW_Dev/env/work/srw_python/

1.2. Compiling without "distutils":

1.2.1. Download and compile fftw-2.1.5 library as required for SRW:
	Download fftw-2.1.5.tar.gz from FFTW site (probably and place it to SRW_Dev/ext_lib
	cd SRW_Dev/ext_lib
	tar -zxvf fftw-2.1.5.tar.gz
	cd fftw-2.1.5
	./configure --enable-float --with-pic
	Manually (using editor) add -fPIC option to CFLAGS in Makefile
	make install
	cp fftw/.libs/libfftw.a SRW_Dev/ext_lib/

1.2.2. Compile the SRW library and Python binding:
	cd SRW_Dev/cpp/gcc
	Make sure that Python 3.2 or higher (or Python 2.7) is installed 
	In Makefile, modify/correct PYPATH and PYFLAGS variables, i.e. specify path to Python header and library files
	rm libsrw.a
	make all
	cp ../../env/work/srw_python/

2. Check examples:
	Make sure the path to Python 3.5 (or 2.7) is added to the PATH variable and "srw_python" to PYTHONPATH variable:
	export PATH="$PATH:<absolute path to Python 3.5>" # this is not necessary if you install python using the distro's package manager
	export PYTHONPAH="$PYTHONPATH:SRW_Dev/env/work/srw_python/" # temporarely solution
	echo "export PYTHONPATH=$PYTHONPATH:SRW_Dev/env/work/srw_python/" >> ~/.bashrc # permanent solution for a single user
	Setting up PYTHONPATH allows to import srwlpy module from any directory.
	cd SRW_Dev/env/work/srw_python

Authors and Contributors to SRW project:
O. Chubar (ESRF - SOLEIL - BNL)
P. Elleaume (ESRF)
J. Chavanne (ESRF)
P. Dumas (SOLEIL)
O. Marcouille (SOLEIL)
L. Samoylova (E-XFEL)
A. Buzmakov (E-XFEL)
G. Geloni (E-XFEL)
I. Agapov (E-XFEL)
J. Sutter (DIAMOND)
D. Laundy (DIAMOND)
M. Rakitin (BNL)
N. Canestrari (ESRF - BNL)
A. Suvorov (BNL)
R. Reininger (ANL)
X. Shi (ANL)
R. Lindberg (ANL)
D. Bruhwiler (RadiaSoft LLC)
R. Nagler (RadiaSoft LLC)
P. Moeller (Bivio Inc)