Note
Go to the end to download the full example code.
Interactive Accelerator Timeline
This script allows you to interactively explore the accelerator data, either by running the script and viewing the plots in a browser, by running the script in interactive-mode e.g. in vscode or by checking the from this script generated gallery.
To run the script, make sure your environment has the requirements
of interactive_charts installed,
e.g. via uv pip install -r pyproject.toml --extra interactive_charts.
This is automatically resolved when running this script via uv run interactive_charts.py.
Preparations
Import modules and define plotting function. This code is omitted in the interactive gallery, so that you can immediately enjoy the interactive plots below. Check interactive.py for the full example code.
# No code to see here in the interactive gallery or the generated jupyter notebook.
Energy Timeline
fig_com = plot(data, EnergyConfiguration)
Luminosity timeline
fig_lumi = plot(data, LuminosityConfiguration)
Luminosity vs. Energy
fig_lumi_energy = plot(data, LuminosityOverEnergyConfiguration)
Save plots
Save the plots as PDF and PNG.
output_dir = Path("images")
output_dir.mkdir(parents=True, exist_ok=True)
plotly.io.write_image(fig_com, output_dir / "energy-plotly.pdf", format="pdf")
plotly.io.write_image(fig_com, output_dir / "energy-plotly.png", format="png")
plotly.io.write_image(fig_lumi, output_dir / "luminosity-plotly.pdf", format="pdf")
plotly.io.write_image(fig_lumi, output_dir / "luminosity-plotly.png", format="png")
plotly.io.write_image(fig_lumi_energy, output_dir / "luminosity-vs-energy-plotly.pdf", format="pdf")
plotly.io.write_image(fig_lumi_energy, output_dir / "luminosity-vs-energy-plotly.png", format="png")
Total running time of the script: (0 minutes 15.142 seconds)