Using the power of automation to explore new physics
Learn how a PhD student from the University of Tokyo reinvented his experimental workflow with software engineering.
Introduction
In this interview, Shintaro Nagase from the University of Tokyo and Roman from Engineers for Science discuss their learnings on how they boosted automation and reproducibility in their physics experiments. Roman joined the group of Prof. Sakemi in Tokyo during his Master's and has been a friend of the group ever since.
The Power of Low-Energy Experiments
Roman: Nagase-san, when I first joined your group, I was amazed by the engineering of your experiment. Can you share a little bit about the goal of your research?
Nagase: On a high level, the goal is to validate predictions of the Standard Model of Physics by observing the properties of cold atoms.
Most experiments concerning this theory need gigantic colliders, such as the Large Hadron Collider (LHC) at CERN [1]. This experiment is different, as it is based on effects that can only be measured in the regime of very low energies. The effect that we are interested in is a permanent electric dipole moment (EDM) of Francium atoms, which might be larger than what the Standard Model predicts [1].
Nagase: The electron EDM is an observable that is yet to be measured precisely and it could give us insights why we see more matter than antimatter around us [1,2].
If you are interested in learning more about this, I recommend reading a review paper on the topic. My favorite ones are Electric dipole moments and the search for new physics by Ricardo Alarcon [3] and Electric dipole moments of atoms, molecules, nuclei, and particles by Timothy Chupp and contributors [1].
Roman: This sounds fascinating, but abstract! Could you explain how the experiment works in concrete terms?
Nagase: Certainly! In our lab we trap Francium atoms with an optical lattice trap (OL).
Nagase: These atoms are cooled to extremely low temperatures, colder than outer space. The atoms slow down and lose their kinetic energy. This calm state allows us to measure their resonance frequencies with high precision. If we observe tiny shifts in the energy levels that could indicate new physics phenomena.
Roman: Why Francium, given its radioactive nature, instead of a simpler element like Oxygen?
Francium is special, as it enhances the property we are investigating by approximately a factor of 800. This allows us to measure the larger Francium EDM rather than the smaller electron EDM. Essentially, Francium atoms act like tiny microscopes, thereby enabling us to observe the electron EDM more easily. [1, 4]
Nagase: To further refine our experiments, we are developing a second method that targets the two main error source in the EDM experiment – magnetic field fluctuations and laser polarization impurities. By also trapping Caesium and Rubidium atoms, which have well-understood properties, we can calibrate our system more accurately.
Challenges and Breakthroughs in Experimentation
Roman: Could you walk us through the key steps involved once the experiment is fully set up?
Nagase: In both experiments, the number of trapped atoms is a critical factor.
The more atoms are trapped, the better is the signal to noise ratio in the measurement of the resonance frequency. To benchmark the efficiency of our trap, we have different methods. One method is to capture the fluorescence of the atoms with a CMOS camera and then analyze this image with different algorithms. Optimizing the trapping efficiency can be a time-consuming procedure, as it involves tuning many parameters.
Each capturing cycle takes between a few seconds and 5 minutes, depending on the source of the atoms.
Roman: Which challenges did you face when you started to run the experiment?
Nagase: Initially, our methods involved a considerable amount of manual labor, making the experiments not only time-consuming but also prone to human error.
For example optimizing the parameters of our trap was a meticulous and repetitive task. Each setting had to be adjusted manually in LabView to explore the optimal parameters. Following this, the images captured by the CMOS camera required analysis through a Python script, which involved numerous experimental parameters. Finally, these results were correlated with the parameter settings to determine the optimal values. This process, though great to get started, had its drawbacks — it was time-consuming, repetitive, and susceptible to errors.
Honestly, this was quite challenging at times.
Roman: So how did you turn the situation around?
Nagase: The crucial change came when we decided to automate the process. We utilized some basic but highly effective tools that proved to be game changers in facilitating this automation. These tools are quite general, making them potentially useful for many students and researchers in their own experimental setups.
Roman: Indeed, those tools really made a difference!
When I was in Tokyo, we started the process by abstracting all of our interactions with the experiment with Python.
Previously, reading data from the ten measurement devices was cumbersome. With Python, we could simply instantiate a class and start streaming the data. To make sure that the code is easy to use, we packed it, shared it via the Python package index (PyPI). To have an online documentation of the package, I generated one based on the docstrings with Sphinx and hosted it on ReadTheDocs.
I still remember that the documentation helped a lot in the adoption of the package!
Roman: So how did this help your experimental workflow?
Nagase: Moving the logic of controlling the experiment from LabView to Python allowed us to start versioning the process of executing the experiment with Git. This meant using a LabView client in Python and sending the instructions to LabView, which handled the low-level details. From a reproducibility point of view, this was a game changer, because repeating the experiment became as easy as clicking a single button.
Cloud and Configuration Management
Roman: This must save you so much time! What other tricks did you learn?
Nagase: For sure! Another tool that makes our lives easier is the cloud. We replicate the data we have on the private cloud of our research institute to the Google Cloud. This allows us to leverage online compute environments such as Google Colaboratory.
Roman: Great insight, these compute environments make collaborating and sharing your environment so easy!
I also like Github Codespaces, which is basically an online version of VS Code. So you have already improved your workflow a lot!
Roman: Did you still face other challenges?
Nagase: At this point, we still faced the problem of handling the 50+ parameters and experimental settings that our experiments typically have.
Missing to record even one of these parameters meant that we could start over. At first, these were scattered across the code and our lab notebooks. To overcome this issue, we moved the experimental parameters into a configuration file, which was basically a standardized JSON file and created a class for loading it. Another option would be to use YAML. It might have some advantages over JSON. In the code, some parameters were calculated from each other based on mathematical formulas.
To make loading the parameters easy, we created a class for it.
Roman: True, but do you remember the issues with handling dependent variables?
Nagase: Sure, when we loaded a config in the beginning of the experiment and then wanted to vary some of the parameters, we had to recompute all of the derived values. In our initial version, we made the design mistake of adding the logic for these computations to the constructor. So redoing computations meant that we had to instantiate a new object and could not do real updates.
Roman: Yes, doing the parameter updates was a challenge, before we came up with a really simple solution!
We modified the class for loading the variables to use a Python feature called the property decorator. By defining a loader method for each derived variable and adding this decorator, we could use the methods like attributes. Now the derived values were computed once they were accessed and not when the class was instantiated with the config. This solved the problem without the need for custom code to update the values.
Nagase: Moreover, we could now derive new configurations from old ones by simply stating the changes in Python code!
Reproducibility for the Scientific Workflow
Roman: So what did the introduction of configs mean for your scientific workflow?
Nagase: Now, both the code for controlling the experiment (data taking) and doing the processing (data analysis) could use the same configuration file.
This meant that all relevant values were automatically tracked and we did not have to note them down anymore. The configuration file could be saved along with the results and plots, making it easy to reconstruct the specific conditions that were present during an experiment. This allows us to perform multiple runs of the experiment without changing any code.
We simply start the code with a new configuration file and everything is set.
Roman: That sounds like a real game changer for the reproducibility of your experiment!
Nagase: It truly is!
Overall, automating control and analysis saves us countless hours every week. Moreover, it makes our experiment more reproducible and gives us access to a whole suit of methods and techniques that would be out of reach without these changes. Moreover, I have full control of the analysis process.
Cumbersome tasks like updating the plots of a past experiment becomes as easy as starting the updated code with the configuration file for this experiment.
Roman: Actually, this saved me during my Master's thesis. I had to update all of my plots the day before the deadline. Without this workflow, I would have missed the deadline!
Nagase: That is a fun one! In our case, the speedup gained through automation has also been crucial for our scientific progress.
Conclusion: The Impact of Automation on Scientific Research
Roman: That's interesting! So you also got new results?
Nagase: The parameter search that I mentioned before was just the beginning. Shortly after implementing the new workflow, our group captured Rubidium atoms with the optical dipole trap. In the meantime, we did other experiments like release and recapture of atoms with the workflow and have more planned, such as the Faraday rotation measurement.
Nagase: Overall, techniques like these ones can help make scientific work more efficient and reproducible. In the bigger picture, the methods that we discussed today are just some of the countless best practices that you can use in your everyday life. Investing the time to learn these methods has definitely been a game changer for me and improved my life and the quality and speed of my research.
Roman: Thank you for sharing your story, Nagase-san!
Nagase: You are welcome!
References
If you are interested in learning more about these methods, check out the other blog posts and try out the workflow presented in this article yourself.
[1] Chupp, T. E., Fierlinger, P., Ramsey-Musolf, M. J., & Singh, J. T. (2019). Electric dipole moments of atoms, molecules, nuclei, and particles. Reviews of Modern Physics, 91(1), 015001.
[2] A. D. Sakharov (1967). Violation of CP Invariance, C Asymmetry and Baryon Asymmetry of Universe, Journal of Experiment and Theoretical Physics Letters 5, 24-27.
[3] Alarcon, R., Alexander, J., Anastassopoulos, V., Aoki, T., Baartman, R., Baeßler, S., ... & Zioutas, K. (2022). Electric dipole moments and the search for new physics. arXiv preprint arXiv:2203.08103.
[4] Shitara, N., Yamanaka, N., Sahoo, B. K., Watanabe, T., & Das, B. P. (2021). CP violating effects in 210Fr and prospects for new physics beyond the Standard Model. Journal of High Energy Physics, 2021(2), 1-21.
[5] Nakamura, K., Nagase, S., Nakashita, T., Hayamizu, T., Aoki, T., Nagahama, H., ... & Sakemi, Y. (2022). Development of a Laser Frequency Stabilization and an Optical Transmission System for the Francium Electric Dipole Moment Search. Journal of Physics: Conference Series (Vol. 2249, No. 1, p. 012010). IOP Publishing.
Bio
Shintaro Nagase is a Ph.D. student at the University of Tokyo. We first met in August 2022 in Tokyo, when I joined his group for a research stay at RIKEN and the University of Tokyo. Since then, he has also visited the PSI in Switzerland and we have been writing research software together ever since. Nagase is one of the most talented researchers I know, and he inspired me to start Engineers for Science.