Skip to main content

Quick Start

Run Your First Simulation

With the environment activated, run:

python gpu_main.py

This runs a single simulation using the default config.json. By default, it uses streaming mode to avoid GPU out-of-memory errors.

Output is saved to:

outputs/YYYY-MM-DD/HH/RUN_N/

Check the Output

import numpy as np

frames = np.load("outputs/2024-01-15/14/RUN_1/frames.npy")
print(frames.shape) # (steps, 2, nx_size, nx_size)

# Access phase and amplitude at time step 0
phase = frames[0, 0, :, :] # radians
amplitude = frames[0, 1, :, :] # unitless

Quick Visualization

import matplotlib.pyplot as plt

fig, axes = plt.subplots(1, 2, figsize=(12, 5))
axes[0].imshow(phase, cmap='twilight')
axes[0].set_title('Phase (radians)')
axes[1].imshow(amplitude, cmap='hot')
axes[1].set_title('Amplitude')
plt.tight_layout()
plt.show()

Use the Programmatic API

For scripted usage without the CLI:

from simulator_api import run_simulation

# Run with default parameters
frames = run_simulation()

# Run with custom parameters
frames = run_simulation(
atmosphere_params={
'num_layers': 10,
'total_r0': 0.15,
'phase_screen_size': 1024,
},
simulation_params={
'whole_simulation_time': 0.05,
}
)

print(frames.shape) # (steps, 2, nx_size, nx_size)

What's Next