Skip to main content

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

FileDescription
gpu_main.pyPrimary CLI entry point
main.pyLegacy CPU entry point
simulator_api.pyProgrammatic API (run_simulation())
benchmark_runner.pyStandalone benchmark tool

Core Modules

FileKey Classes/Functions
core/utils.pyload_config(), solve_for_A(), calc_r0_profile(), create_output_directory(), FFT utilities
core/geometry/geometry.pyGeometry dataclass -- layer placement, r0/wind profiles
core/layer/layer.pyLayer -- wraps phase screen, manages extrusion and MCF
core/propagation/propagator.pyPropagator -- angular spectrum Fresnel propagation
core/propagation/basic_funcs.pyft2(), ift2(), circ(), rect(), TF equivalents
core/phase_screens/infinitephasescreen.pyPhaseScreenVonKarman, PhaseScreenKolmogorov -- autoregressive infinite screens
core/phase_screens/PhaseScreenGen.pyPhaseScreenGen -- TF-based Von Karman screen generator (used for Monte Carlo regeneration)

GPU Modules

FileKey Classes/Functions
gpu_core/gpu_simulator/gpu_simulator.pyGpuSimulator -- TF-accelerated simulator with streaming support
gpu_core/gpu_layer/gpu_layer.pyGpuLayer -- TF variable-backed layer
gpu_core/monitoring/system_monitor.pySimulationMonitor -- system metrics + TensorBoard integration

Analysis Modules

FileKey Classes/Functions
analysis/performance.pyPerformanceTester, PerformanceConfig -- systematic benchmarking
analysis/monte_carlo.pyMonteCarloAnalyzer -- Monte Carlo statistical analysis

Key Methods

GpuSimulator

MethodDecoratorDescription
simulate_turb(steps)@tf.functionSingle-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)PythonStreaming mode with double-buffered I/O. Passes tf.constant to chunk functions
simulate_turb_streaming_complex(steps, chunk_size)PythonStreaming mode returning complex fields
simulate_turb_no_save(steps)PythonThroughput test, no frame storage
animate_turb(steps)PythonFull pipeline: simulate + save + animate + validate
return_first_wvfrnt()@tf.functionSingle propagation step (no time evolution)
MCF_calc(real_num)@tf.functionCompute Mutual Coherence Function
tf_move_one_tick_all_layers()@tf.functionAdvance all layers by one time step. Uses tf.cast instead of int() to stay in-graph

Propagator

MethodDescription
propagate(Uin, PS_arr)Propagate input field through phase screen array. Returns (Uout, xn, yn)

Geometry

MethodDescription
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

MethodDecoratorDescription
get_new_row()@tf.functionGenerate new row via autoregressive model
add_row()@tf.functionPrepend new row and trim screen

Utility Functions

core/utils.py

FunctionDescription
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