Skip to content

Exchange SRW Sirepo simulations

Maksim Rakitin edited this page Jul 28, 2017 · 1 revision

Exchange and backup SRW/Sirepo simulations

Users can exchange SRW/Sirepo simulations in several formats:

  • a Python script;
  • a JSON file;
  • a zip-archive;
  • a self-extracting simulation.

We have found that users want the ability to download valid Python scripts, which can then be specialized to implement more sophisticated simulations — for example, capabilities that the GUI does not yet support. The same menu provides a way to export a Python script used for execution of the report — Export Python File menu item:

This allows the end user to run an SRW simulation from the command line. Hence, the expert user is benefitted by the GUI just as much as the novice user, and the GUI never inhibits or limits what an X-ray scientist can do with SRW.

As an accompanying tool, we have implemented exporting of the JSON files, which fully describe the simulation — Export JSON Data File menu item:

This assures portability of Sirepo simulations.

In many cases SRW simulations involve additional files, e.g. mirror height profiles and magnetic measurements data for the tabulated undulator, which cannot be exported as a single Python file. For that purpose, we implemented exporting of a zip-archive with Python, JSON and all related data files — Export as Zip menu item:

Also, an advanced exporting feature of a self-extracting simulation in HTML format was implemented — Self-Extracting Simulation menu item to allow a one-click importing to a remote server:

To provide a robust mechanism for sharing the simulations across multiple installations of Sirepo and/or SRW, we complemented the exporting capabilities by the advanced importing features. Currently, Sirepo accepts importing of the standardly formatted "Virtual Beamline" Python scripts as well as previously exported JSON files. When the user attempts to import a Python script, optional command-line arguments could be provided (for instance, to select the desired beamline layout to import):

Import of a previously exported simulation in a form of a zip-archive can be performed in the same manner.

Steps to backup your simulations


The best way to backup your calculations is to use zip-archive exporting feature.

  • Go to the simulations list page, click on the simulation to save and press Export as Zip.


The exported zip-file can be imported to the same Sirepo server, or even to another server, which provides a great way to transfer simulations between the servers.

  • Go to the desired Sirepo server, e.g.
  • Go to the expert mode by clicking Expert users only button.
  • On the simulations list page click Import button.
  • In the pop-up window click Choose File/Browse button, select the desired zip-archive (or JSON file) and click Import File button:
  • You will be redirected to the page with the imported simulation.


  • Export to Python may be useful, but there is no 100% guarantee that you will import it back to Sirepo correctly since the names of optical elements will be replaced by default values and some parameters may be processed incorrectly.
Clone this wiki locally