Module Reference
Class Hierarchy
Simulator (simulator/simulator.py)
└── GpuSimulator (gpu_core/gpu_simulator/gpu_simulator.py)
Layer (core/layer/layer.py)
└── GpuLayer (gpu_core/gpu_layer/gpu_layer.py)
PhaseScreen (core/phase_screens/infinitephasescreen.py)
├── PhaseScreenVonKarman
└── PhaseScreenKolmogorov
File Map
Entry Points
| File | Description |
|---|---|
gpu_main.py | Primary CLI entry point |
main.py | Legacy CPU entry point |
simulator_api.py | Programmatic API (run_simulation()) |
benchmark_runner.py | Standalone benchmark tool |
Core Modules
| File | Key Classes/Functions |
|---|---|
core/utils.py | load_config(), solve_for_A(), calc_r0_profile(), create_output_directory(), FFT utilities |
core/geometry/geometry.py | Geometry dataclass -- layer placement, r0/wind profiles |
core/layer/layer.py | Layer -- wraps phase screen, manages extrusion and MCF |
core/propagation/propagator.py | Propagator -- angular spectrum Fresnel propagation |
core/propagation/basic_funcs.py | ft2(), ift2(), circ(), rect(), TF equivalents |
core/phase_screens/infinitephasescreen.py | PhaseScreenVonKarman, PhaseScreenKolmogorov -- autoregressive infinite screens |
core/phase_screens/PhaseScreenGen.py | PhaseScreenGen -- TF-based Von Karman screen generator (used for Monte Carlo regeneration) |
GPU Modules
| File | Key Classes/Functions |
|---|---|
gpu_core/gpu_simulator/gpu_simulator.py | GpuSimulator -- TF-accelerated simulator with streaming support |
gpu_core/gpu_layer/gpu_layer.py | GpuLayer -- TF variable-backed layer |
gpu_core/monitoring/system_monitor.py | SimulationMonitor -- system metrics + TensorBoard integration |
Analysis Modules
| File | Key Classes/Functions |
|---|---|
analysis/performance.py | PerformanceTester, PerformanceConfig -- systematic benchmarking |
analysis/monte_carlo.py | MonteCarloAnalyzer -- Monte Carlo statistical analysis |
Key Methods
GpuSimulator
| Method | Decorator | Description |
|---|---|---|
simulate_turb(steps) | @tf.function | Single-shot simulation, all frames in GPU memory |
simulate_turb_chunk(steps) | @tf.function(input_signature) | Run a fixed chunk of steps, return tensor. Uses input_signature to avoid retracing |
simulate_turb_chunk_complex(steps) | @tf.function(input_signature) | Like simulate_turb_chunk but returns complex Uout directly |
simulate_turb_streaming(steps, chunk_size) | Python | Streaming mode with double-buffered I/O. Passes tf.constant to chunk functions |
simulate_turb_streaming_complex(steps, chunk_size) | Python | Streaming mode returning complex fields |
simulate_turb_no_save(steps) | Python | Throughput test, no frame storage |
animate_turb(steps) | Python | Full pipeline: simulate + save + animate + validate |
return_first_wvfrnt() | @tf.function | Single propagation step (no time evolution) |
MCF_calc(real_num) | @tf.function | Compute Mutual Coherence Function |
tf_move_one_tick_all_layers() | @tf.function | Advance all layers by one time step. Uses tf.cast instead of int() to stay in-graph |
Propagator
| Method | Description |
|---|---|
propagate(Uin, PS_arr) | Propagate input field through phase screen array. Returns (Uout, xn, yn) |
Geometry
| Method | Description |
|---|---|
move_one_tick_all_layers() | Advance all layers, return phase screen array |
recreate_ps_arr() | Regenerate all phase screens (for Monte Carlo) |
show_object_info(logger) | Log geometry parameters |
GpuLayer
| Method | Decorator | Description |
|---|---|---|
get_new_row() | @tf.function | Generate new row via autoregressive model |
add_row() | @tf.function | Prepend new row and trim screen |
Utility Functions
core/utils.py
| Function | Description |
|---|---|
load_config(file_path) | Load JSON config file |
solve_for_A(k, w, delta_z, r0) | Solve for Hufnagel-Valley A parameter |
calc_r0_profile(...) | Compute layer heights, r0 array, wind profile |
calculate_number_of_extrusions(...) | Pixels to extrude per time step |
create_output_directory(...) | Create timestamped output directory |
ft2(data, delta) / ift2(G, delta_f) | NumPy 2D FFT/IFFT |
tf_ft2(g, delta) / tf_ift2(g, delta_f) | TensorFlow 2D FFT/IFFT |
corr2_ft(u1, u2, mask, delta) | Fourier-domain cross-correlation |