SPECTRA: a synchrotron radiation calculation code

Welcome to SPECTRA home page

2024/10/01: Version 12.0.0 has been released.
  • What is SPECTRA?

    SPECTRA is an application software to calculate optical properties of synchrotron radiation (SR) emitted from bending magnets, wigglers (conventional and elliptical) and undulators (conventional, helical, elliptical and figure-8). Calculations of radiation from an arbitrary magnetic field distribution are also available. Parameters on the electron beam and the source can be edited completely on graphical user interfaces (GUIs) and it is possible to show the calculation result graphically. The energy spectrum and radiation power after transmitting various filters and convolution of detector's resolution are also available.
  • Related Publications

    If the users are presenting or publishing their results obtained with using SPECTRA, they are kindly requested to cite the related reference(s).
  • Request to those who are reporting a bug

    When reporting a bug found in SPECTRA, the users are kindly requested to attach the input file (*.json) in the e-mail, which is created before starting any calculation. The input file is placed in the directory specified in the "Output File" subpanel of the GUI, with the prefix specified in the same subpanel as well.
  • Important Notes on Brilliance Calculation

    In version 10.0, rigorous estimation of brilliance based on the Wigner function method has become available, which is in contrast to the traditional method based on the Gaussian approximation. Although the brilliance estimation by the Gaussian approximation is still available for compatibility with the older versions, it is referred to as GA.Brilliance (Gaussian-Approximated) and is distinguished from the rigorous estimation.
  • Functions supported

    SPECTRA offers many functions to characterize the synchrotron radiation as follows.
    • Energy spectra of the brilliance, flux density, partial flux after passing through a slit, and total flux
    • Spatial dependence of the flux and power densities
    • Beam size, angular divergence, coherent flux as a function of the gap and K value
    • The peak brilliance, flux, and radiation power as a function of the gap and K value
    • Radiation power after passing through a filter composed of various material
    • Far-field approximation for fast evaluation of radiation
    • More precise estimation of radiation in the near-field zone
    • Rigorous brilliance evaluation of SR based on Wigner function representation
    • Coherent mode decomposition of partially coherent SR
  • Contact Information

    Author

    Takashi Tanaka

    Address

Getting Started

To quickly get started with SPECTRA, follow the steps below.
  1. When started, SPECTRA tries to open a parameter file that was last opened (or load default parameters), and shows the parameters and options related to the electron beam and light source in two subpanels [Accelerator] and [Light Source] in [Main Parameters] tabbed panel. If you need to open another parameter file, run [File]-[Open a Parameter File] command, or run [File]-[Create a New Parameter File] command to start with a new parameter file.
  2. Select the type of calculation with [Select Calculation] command. The main SR characteristics (brilliance, power density, etc..) and dependence (energy, spatial, etc..) should be specified. A new subpanel [Configurations] appears to show the parameters related to observation conditions and numerical options.
  3. Before starting a calculation, you need to specify the output file in terms of the format, folder (directory to save the output file), prefix (sort of a data name) and serial number (if necessary) in [Output File] subpanel.
  4. Run [Run]-[Start Calculation] command to start a calculation with the current parameters shown in the subpanels.
  5. In order to specify more than one calculation, run [Run]-[Create Process] command to create a "process", which saves all the parameters currently shown in the GUI to a temporary memory and appends the created process to the current calculation list. Repeat it until all the desired calculation processes are specified. Then run [Run]-[Start Calculation] command, which starts the calculations in series.
  6. A progress bar pops up to let the user know the status of calculation status.
  7. When the calculation is finished, the output file is automatically imported in [Post-Processing] panel to visualize the result. The plot can be 1-dimensional or 2-dimensional, depending on the calculation type.

Version-up History

  • Ver. 12.0

    • Ver. 12.0.0 (2024/10/01)
      • Python interface (spectra-ui) and client-side web-application version have been added.
      • Implemented a new function to describe the wavefront propagation of partially coherent radiation based on a Wigner function formalism.
      • GUI appearance revised.
  • Ver. 11.2

    • Ver. 11.2.1 (2023/12/23)
      • Fxied a bug that the power density in the near field fails in bending magnets.
    • Ver. 11.2.0 (2023/10/01)
      • The GUI framework has been switched from "Electron" to "Tauri"; this makes the application file size much smaller and the file structure much simpler.
      • Signifiant improvement of the accuracy and reliability in CMD even when the electron emittance is large.
      • Implemented a new option "Gaussian-Schll Model" to perform CMD, in which the SR is described as a Gaussian-Schell source and the CMD can be done based on an analytical formula and thus is much faster.
      • Fixed bugs that the CMD can fail under some conditions.
      • Fixed bugs related to the source size and angular divergece shown in the GUI for wiggler sources.
      • Fixed bugs that Kx,y is not updated for Multi-harmoni undulator.
      • Fixed bugs that computations under FEL mode can fail under some conditions.
      • Fixed bugs in the characteristics of wiggler sources shown in the GUI.
      • Fixed bugs in specifying computations with the scan option.
  • Ver. 11.1

    • Ver. 11.1.2 (2022/08/26)
      • Fixed bugs that "Coherent Mode Decomposition" may fail under some conditions.
    • Ver. 11.1.1 (2022/06/13)
      • Fixed bugs in FEL amplifier calculations using MPI.
      • Fixed bugs in generating an undulator field with a specified phase error.
      • Fixed bugs that several parameters to specify the custom accuracy levels do not appear in the GUI under several conditions.
      • Fixed bugs in several calulations using custom current profiles.
      • Fixed bugs in filtered power and volume power density calculations using a wiggler approximation.
      • Fixed bugs that "Fixed Point Calculation" may fail under some conditions.
    • Ver. 11.1.0 (2022/03/01)
      • Implemented a new function "FEL Mode", in which the interaction between electrons and radiation is taken into account for computation of coherent radiation.
      • Fixed bugs related to GUI functions (disabled menu, scan option).
      • Enhanced the functions of the postprocessor.
      • Implemented new functions to save the CPU time to compute the spectrum of flux with a large angular acceptance in the near field condition (energy smoothing, wiggler approximation).
      • Implemented GUIs to configure the phase error and plot of the transmission rate.
      • Enhanced the configurations of numerical accuracy.
      • Remove the data size limitation in the socket.io communication (web-application mode).
  • Ver. 11.0

    • Ver. 11.0.1 (2021/09/04)
      • Fixed bugs in the input file converter.
      • Fixed bugs related to the temporal window in the time dependence calculation of coherent radiation.
      • Modified the availability of "Injection Condition" option.
      • Improved the algorithm for the modal flux of the CMD method.
      • Fixed bugs in the scan option under some conditions.
      • Corrected errors in the unit of GUI.
      • Fixed bugs that "Cancel" does not work under some conditions.
      • Revised the reference manual.
    • Ver. 11.0.0 (2021/03/01, Major upgrade)
      • Renewal of the GUI with new libraries.
      • Change of the input and output format (JSON).
      • Official support to utilize the solver without the GUI (including python script).
      • and many others ...
  • Ver. 10.2

    • Ver. 10.2.0 (2019/02/01)
      • Implemented a new function to handle the undulator phase error.
      • Coherent radiation by an electron beam with the energy-time phase space is supported.
      • Fixed bugs related to filtering using custom data.
      • Fixed bugs related to K-value dependence of helical undulators.
      • Fixed bugs of GUI.
  • Ver. 10.1

    • Ver. 10.1.3 (2018/08/13)
      • Fixed bugs that particle data cannot be loaded.
    • Ver. 10.1.2 (2017/10/18)
      • Wavelength shifter has been supported.
      • Fixed bugs related to segmented undulators with a huge number of segments.
      • Fixed a bug in total power evaluation in GUI for user-defined sources.
    • Ver. 10.1.1 (2017/08/08)
      • Fixed a bug that several calculations fail when the K value is huge.
      • Fixed a bug related to non-parallel computing algorithm.
      • Fixed several bugs related to GUI operation.
    • Ver. 10.1.0 (2017/05/01)
      • Implemented a new function to perform the coherent mode decomposition of partially coherent SR.
      • Implemented a new function to calculate the surface power density (e.g., heat load on the inner wall of the vacuum chamber).
      • Parallel computing has become available based on the MPI protocol.
      • Fixed several bugs related to GUI operation.
  • Ver. 10.0

    • Ver. 10.0.7 (2015/11/14)
      • Fixed a bug that the scanning option does not work when running spectra solver in the console mode.
    • Ver. 10.0.6 (2015/11/09)
      • Fixed bugs that calculations fail in "User-Defined" sources under certain conditions.
      • Logarithmic energy step has been available for "User-Defined" source with "Wiggler Approximation"
    • Ver. 10.0.5 (2015/10/15)
      • Fixed bugs that the parameters shown in "Photon Distribution at Source Point" are not valid in a specific condition.
      • Fixed bugs related to computations for the "User Defined" source with the "Wiggler Approximation" option.
    • Ver. 10.0.4 (2015/08/18)
      • Fixed bugs that the spectral calculation fails with "Zero Energy Spread" option under some conditions.
      • Added "Smoothing Along X Axis" option for Wigner function calculations with bending magnet and wiggler sources.
      • Improved the phase shifter model to be located between undulator segments, especially for few-period devices.
    • Ver. 10.0.3 (2015/03/16)
      • Fixed bugs that spectral calculations fail under special conditions when the electron energy spread is quite large and its emittance is extremely low.
    • Ver. 10.0.2 (2014/12/16)
      • Fixed bugs that photon energy cannot be specified in [Photon Distribution at Source Point] calculations under certain conditions.
      • Half-odd-integer periods can be specified in wiggler sources to allow for odd number of poles.
    • Ver. 10.0.1 (2014/08/19)
      • Fixed bugs related to GUI appearance under several conditions.
      • Fixed bugs of "Simple Plotter".
      • Fixed bugs related to "Coherent Radiation" (Menus and numerical algorithms).
      • Fixed bugs related to "Injection condition" for custom SR sources.
    • Ver. 10.0.0 (2014/07/01)
      • Numerical methods based on the Wigner function has been implemented for more rigorous estimation of brilliance.
      • Spatial profile right at the source point has become available, by backpropagating to the center of the device.
      • "Fixed Point Calculation" has become extensively available besides the radiation power.
      • "Multi-Harmonic Undulator" has become available, which generates a periodic field composed of a number of harmonics.
  • Ver. 9.0

    • Ver. 9.0.2 (2012/01/26)
      • Fixed bugs related to brilliance calculation in BM sources.
      • Fixed bugs related to ID gap-field table manipulation.
      • Fixed bugs that [Power@Fixed Point] calculations fail when filtering option is enabled.
      • Minor modification of GUI functions.
    • Ver. 9.0.1 (2012/01/16)
      • Improved the computation time by careful optimization of numerical algorithms.
      • Supported an arbitrary electron beam distribution in the 6-D phase space.
      • Fixed minor bugs.
      • Separated the Numerical and GUI parts.
  • Ver. 8.1

    • Ver. 8.1.3 (2010/12/15)
      • Fixed bugs in energy dependence calculations under far-field approximation.
      • Further improvement for calculations for an ultra-low emittance beam.
      • Added console (non-GUI) mode. (2011/01/18)
    • Ver. 8.1.2 (2010/11/22)
      • Fixed bugs that calculations for coherent synchrotron radiation are not available except BMs.
      • Fixed bugs in energy-dependence calculations for an ultra-low emittance beam under some conditions.
    • Ver. 8.1.1 (2010/10/28)
      • Fixed bugs in coherent synchrotron radiation calculation.
      • Fixed bugs in spectral calculation for an ultra-low emittance beam.
      • Modified configuration for visualization of scan results.
    • Ver. 8.1.0 (2010/04/23)
      • Modified the simple plotter to visualize the calculation results.
      • Improved algorithms for calculations with low emittance and energy spread.
      • Improved algorithms for SR sources with focusing magnets.
      • Implemented fast computation scheme for segmented undulators with periodic lattice functions.
  • Ver. 8.0

    • Ver. 8.0.10 (2008/08/14)
      • Fixed bugs in radiation-power calculations.
    • Ver. 8.0.9 (2008/07/28)
      • Fixed bugs in "Near Field"-"Power@Fixed Point" calculations.
      • Improvements in "Coherent Radiation" calculations.
    • Ver. 8.0.8 (2008/03/28)
      • Fixed bugs that calculations in "[K-Dependence]-[Peak Energy] fail under certain conditions.
      • Fixed bugs that "Zero E-spread" calculation fails under some conditions.
      • (2008/04/09)
      • Fixed bugs that filtering with narrow BPF fails under some conditions.
      • (2008/04/09)
      • Fixed bugs that the average current is not calculated correctly with large pulse repetition rate in the linac.
    • Ver. 8.0.7 (2008/02/26)
      • Fixed bugs that "Point-Fixed Calculation" with the filtering option for wiggler sources do not function.
    • Ver. 8.0.6 (2007/12/26)
      • Fixed bugs related to GUI operation in Mac OS X and Linux versions.
      • Improved algorithms for the spatial dependence of radiation power. (2008/01/04)
    • Ver. 8.0.5 (2007/11/16)
      • "Easy Calculation" algorithm improved.
      • Algorithms for calculations with "Segmented Undulator" option improved.
      • Fixed bugs related to filtered power calculation.(2007/11/22)
      • Fixed bugs related to electric-field calculation.(2007/12/04)
    • Ver. 8.0.4 (2007/09/07)
      • Coherent and SASE radiation algorithms improved.
      • Fixed bugs related to filtered power calculation.
      • Fixed several bugs related to GUI window operation.
    • Ver. 8.0.3 (2007/04/12)
      • Fixed bugs related to coherent-radiation calculation for undulators. (2007/04/19)
      • Fixed bugs related to total power calculation for segmented undulators. (2007/04/18)
      • Fixed several bugs related to GUI window operation.
      • Fixed bugs related to radiation power K-dependence calculation for figure-8 undulators.
    • Ver. 8.0.2 (2006/11/13)
      • Fixed several bugs related to GUI operation.
      • Fixed bugs related to K-dependence calculation with a segmented undulator.
      • Fixed bugs that the auto-pitch function does not work properly.
      • Fixed bugs related to filtering with custom data.(2006/12/01)
    • Ver. 8.0.1 (2006/09/09)
      • Significant reduction in computation time by major modification of the numerical algorithm. Version 8.0 is about 2~10 times faster than version 7.2.
      • Numerical part is now written in C++ as well as the GUI part.
      • Added "Coherent Radiation" and "SASE Radiation" options.
      • Added "Linac" and "Bunch Profile" options.
      • Added two new SR source types: "Multipole" and "Field Mapping".
      • Added a function to calculate the electron trajectory in an arbitrary magnetic field, which enables a particle tracking in the SR source.
      • Added "Special Magnet Setup" configuration: natural focusing, tapering, field offset, and multipole components are now available for magnetic configuration
  • Ver. 7.2

    • Ver. 7.2.0 (2005/03/01)
      • Renewed SPECTRA home page. (Japanese page is no more supported.)
      • Added "Time dependence of radiation field" function.
      • Added "Spatial dependence of radiation field complex amplitude" function.
      • Added "Scanning a parameter" function.
      • Added "Photon distribution in the 4-D phase space" function.
      • Reference manual has been fully updated and is now distributed in the PDF format as well as HTML documents.
      • Fixed bugs related to "Easy Calculation" algorithm in "Energy Dependence".
      • Improvement of "Spatial Dependence (Flux Density, Far Field)" algorithm.
  • Ver. 7.1

    • Ver. 7.1.5 (2004/11/30)
      • Fixed bugs related to "Zero Energy Spread" calculation.
    • Ver. 7.1.4 (2004/11/17)
      • Improvement of the algorithm for filtered power calculation.
    • Ver. 7.1.2 (2004/01/22)
      • Fixed bugs related to source-type selection in the GUI window.
      • Improvement of the algorithm in the near field region.
      • Fixed bugs in Spatial-Dependence calculation with Zero-Energy Spread.
    • Ver. 7.1.1 (2003/12/01)
      • Fixed bugs related to segmented undulator calculation.
      • Fixed bugs related to circular polarization component in the near field region.(12/03)
    • Ver. 7.1.0 (2003/11/01)
      • Modified the algorithm to calculate the brilliance of wiggler radiation to take into account the depth of the field.
      • Implemented the wiggler approximation scheme for the arbitrary-field SR source.
      • Improved the filtering scheme (II).
      • Added the bandpath filter in the filtering calculation.
      • Improved the GUI panel controls.
      • Improved the legends in the plot panel.
  • Ver. 7.0

    • Ver. 7.0.5 (2003/08/20)
      • Improved the algorithms on Spatial Distribution.
      • Modified the procedure for the power calculation after filtering.
    • Ver. 7.0.4 (2003/08/10)
      • Fixed bugs related to calculation of the degree of circular polarization.
      • Fixed the bug that the specified filtering data file is not used for input.
    • Ver. 7.0.3 (2003/07/26)
      • Modified the method to specify "Energy Mesh" in [Near Field-Energy Dependence]. (mesh->interval)
      • Modified the method to judge the convergence of numerical integration.
      • Fixed the bug in the calculation of [Spatial Dependence]-[Flux Density] with zero emittance.
      • Modified several GUI controls for the input parameter.
    • Ver. 7.0.2 (2003/05/22)
      • Fixed bugs related to plotting the orbit.
      • Improved the legend appearance in graph plot window.
      • Improved the file importing algorithm.
      • Modified the link failure in the help file.
      • Added "Log-Log plot" option..
      • Discarded "Update Interval" parameter.
      • Fixed bug related to [Energy Dependence].(2003/05/29)
    • Ver. 7.0.1 (2003/03/01)
      • Changed the GUI library to wxWidgets.
      • Added the segmented-undulator scheme.
      • Added the "Parameter Set".
      • Modified the plotting algorithm.
      • Mac OS X version is now available.
      • Abolished the file name related to source type (e.g. U***.prm means a conventional undulator).
      • Added the help browser.
  • Ver. 6.1 (2001/06/01)

    • Improved the calculation algorithm.
    • Added calculation with arbitrary magnetic field.
    • Added filtering in the spatial dependence of the power density.
    • Added cylindrical mesh for spatial dependence.
    • Simplified the specification of calculation accuracy.
  • Ver. 6.0 (2000/10/01): Windows/Mac/Unix Application

    • Has been much faster than older version by improving the calculation algorithm.
    • K value, 1st-harmonic energy and so on are now linked with the gap value by reading the gap-field relation table.
    • So-called near-field calculation is now available for the energy spectrum and power calculation.
    • Calculation of the power after transmitting filters is now available.
    • On-line help is now available.
    • Improved the file dialog box in [Open Parameter File] command.
    • Simplified specification of calculation accuracy.
  • Ver. 5.0 (1998/10/01): Windows/Mac/Unix Application

    • Applicable to Mac and Unix platforms.
    • Included the accuracy and multiple calculation.
    • Included calculation status graph.
  • Before Ver. 4

    • MS-DOS/Windows 3.1/95/NT Application

Download SPECTRA (ver. 12.0.0)

  • Before downloading, pay attention to the followings:

    • Even if you suffer losses and damages by using SPECTRA, the authors are not responsible for compensating for them.
    • Even if problems and bugs are found about SPECTRA, the authors are not responsible for version up.
  • Notice on the release of Ver. 11 or later

    • The input and output formats have been changed to JSON
    • If you need text output files as in the older versions (10.2 or earlier), select "ASCII" or "Both" as the output format in the "Output Format" subpanel
    • The output file name is automatically determined, without the file selection dialog box; before starting any calculation, specify the data folder and prefix (+ serial number)
    • A number of calculation types (those using the so-called far-field approximation) have been moved under "Far Field & Ideal Condition" menu
    • 32-bit versions are not supported any longer
    • Calling the solver without GUI has been officially supported; refer to the reference manual for details

    Notice on parallel computing

    • You need to install MPI to enable the parallel computing option; MS-MPI for Windows, and MPICH for Mac OS and Linux.
  • Windows Version

    Uncompress the zipped file and move the whole directory ("spectra") to a desired location. Note: self-executable installer is no more available.
  • Mac OS Version (compiled on OS14 - Sonoma)

    Important Notes for Users of Mac OS X 10.12 (Sierra) or Later
    • Because of the security enhancement made in 10.12, many (freely-available) applications downloaded from anywhere out of the App Store may fail, which is known as an "App Translocation" problem. To avoid this and run SPECTRA correctly, try the following steps.
      1. Uncompress the *.tgz file in a directory to install spectra (e.g., /Users/you/bin/)
      2. Open "Terminal" app and change directory to /Users/you/bin
      3. Run "xattr -rc spectra_macosx(_m)" to remove "extended attributes" of all the files.
  • Linux Version

    Both of the above are compiled on Ubuntu 20.04, and may be run in later Ubuntu distributions. Support for Other Linux distributions has been terminated. Those who are using other distributions are kindly recommended to use the

    non-desktop version.

Non-Desktop Versions

  • Besides the general desktop application, SPECTRA is available in two forms. One is a web application that runs in a common web browser, while the other runs as a python script.
  • Web-Application Version

    The web-application version of SPECTRA was first released in 11.0 as the so-called "server-side" application, in which the numerical computation was performed in the server computer. Although the user does not have to install the software as long as a modern web browser is available, the computation time depends on the performance of the server computer, and the computer resource (CPU time, memory) should be shared by users whose number can be potentially large. To avoid potential issues that may be caused by operationg the web-application in the server, the computer resource per user was considerably limited and this version has not been widely available.
    To solve these issues, the wave-application version has been redesigned in ver 12.0 to run as a "client-side" application, in which the numerical computation is done by the local (client-side) computer, without any load on the server. It should be noted that parallel computing is not available for the moment, and the computation speed is about half of the desktop version (withuot parallel computing). Even so, it is recommended to actively use the web-application version, for example just to check how SPECTRA works before installing the desktop version.
    The new web-application version is available here. Note that a few options are not available, which require to import an external data file. This is attributable to the security issue that the web browser cannot load local files that are specified by the full path in the local computer.
  • Python Version

    To support the expanding users of python language, SPECTRA has started official support for python, since ver. 12.0. To make use of this function, you need to have
    • python version 3.8 or later
    • web browser (Chrome, Edge or FireFox; Safari is not supported)
    installed; then, install a python package "spectra-ui" (SPECTRA User Interface) by simply runing the pip (or pip3) command.
    pip install spectra-ui (--user)
    For Windows and Mac OS platforms, binary packages are available and are downloaded/installed. In Linux platforms, the above command downloads the source package and tries to compile the source files with the C++ compiler installed in the local system. Thus the installation process needs some time. Note that two libraries are needed to compile the source code: eigen and boost. In addition, MPI library (OpenMPI or MPICH) should be installed if parallel computing is required.
    Once installed, it can be run as a module
    python -m spectra
    which mimics the desktop application. More flexible operation is possible as in other python applications, which helps the user to do a batch job. For details of how to get started with spectra-ui, refer to the instructions and try the sample files available here.
    For Mac OS users
    Even after closing the python application using simplex-ui, more than one Browser's icon may be shown in the Dock. If you feel it annoying, kill "Show suggested and recent apps in Dock" option, which is found in the Docker setting.