DOI: 10.5281/zenodo.17647858
title: Data and code for "Time series learning in a many-body Rydberg system with emergent collective nonlinearity"

description: # Time-series learning in a many-body Rydberg system with emergent collective nonlinearity

This repository accompanies work on time-series learning in a many-body Rydberg system that exhibits emergent collective nonlinearity. It contains the LaTeX source for the paper, the datasets used for figures, and the Python code used for simulations and plotting.

Quick summary- Goal: Study whether a Rydberg gas can act as a reservoir for time-series prediction and compare its performance to classical reservoir-computing approaches.- Included content: LaTeX manuscript, scripts to generate figures (Fig. 2 and Fig. 3), simulation and analysis code, and the raw data used for plots.

Project structure (important files/folders)

- `002-Code/` – code and data used to generate plots and run simulations:  - `requirements.txt` – Python dependencies required for computation and plotting.    - `weather-beijing.csv` – example dataset used in parts of the analysis.  - `Fig 2/` – reproduces Figure 2 of the paper:    - `plot_fig_2.py` – script that reads CSV files in `data_Fig2/` and creates visualization(s) for Fig. 2.    - `data_Fig2/` – CSV files (`a.csv`–`j.csv`) with example data or results shown in Fig. 2.  - `Fig 3/` – reproduces Figure 3 (reservoir-computing / Rydberg gas simulation):    - `plot_fig_3.py` – script to create the plots for Fig. 3.    - `reservoir.py` – implementation of a reservoir model (Rydberg gas / dynamical system) and helper functions. (most of this is not used)    - `reservoircomputer.py` – wrapper for training and evaluation of the reservoir-computing setup. (most of this is not used)    - `generate MSE/`      - `input_data` - input time-series data for training/testing (e.g., Lorenz Attractor).      - `generated_output_data` - output time-series data generated by `generate_output_from_input.py`.      - `generate_output_from_input.py` – script to generate output time-series data from input      - `calc_MSE_from_output_data.py` – script to calculate MSE from generated output data.      - `generated_output_data/` - output time-series data generated by `generate_output_from_input.py` for varying detuning.      - `results_MF_model_for_parameters_in_fig_3.txt` – evaluated MSE values for the detuning parameters used in Fig. 3.    - `rydberg_gas_mse_cut.txt` – Same file as `results_MF_model_for_parameters_in_fig_3.txt`.

What the simulations and scripts do- `002-Code/Fig 2/plot_fig_2.py`  - Reads the CSV files in `data_Fig2/`.  - Produces visualizations of time-series predictions and comparison plots between target and predicted data.  - Purpose: Illustrate prediction quality for selected test cases and parameters (displayed in Fig. 2 of the manuscript).

- `002-Code/Fig 3/` (key components: `reservoir.py`, `reservoircomputer.py`, `plot_fig_3.py`)  - `reservoir.py`: Models the dynamical behaviour of the Rydberg gas / reservoir. Contains the update equations used to simulate collective nonlinearity and internal reservoir states.  - `reservoircomputer.py`: Implements training of a linear readout (typically ridge regression or ordinary least squares) using reservoir states. Contains train/test routines and metric calculations (e.g., MSE).  - `plot_fig_3.py`: Orchestrates multiple runs and parameter sweeps (e.g., reservoir size, regularization strength, noise level), aggregates metrics and generates the plot(s) used in Fig. 3. The file `rydberg_gas_mse_cut.txt` contains values exported from these runs.

Requirements and installation1. (Optional) Create a virtual environment (venv or conda).2. Install the required Python packages listed in `002-Code/requirements.txt`.

Example (bash):

```bashpython3 -m venv .venvsource .venv/bin/activatepip install -r "002-Code/requirements.txt"```

Running the scripts (quick guide)- Plot Fig. 2:

```bashpython3 "002-Code/Fig 2/plot_fig_2.py"```

- Run Fig. 3 experiments (reservoir-computing / Rydberg simulation) and generate plots:

```bashpython3 "002-Code/Fig 3/plot_fig_3.py"```

Notes:- By default the scripts save figures or metrics in their respective folders or print summaries to stdout. If you expect outputs in different locations, inspect `plot_fig_2.py` and `plot_fig_3.py` for path and save options.- Computational cost: Some simulations (parameter sweeps) may be time-consuming. For quick tests, reduce the number of runs or use smaller reservoir sizes.