__init__.py (2411B)
1 # 2 # SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 # SPDX-License-Identifier: Apache-2.0 4 # 5 """ 6 Ray tracing module of Sionna. 7 """ 8 9 ########################################### 10 # Configuring Mitsuba variant 11 ########################################### 12 13 import tensorflow as tf 14 import mitsuba as mi 15 16 # If at least one GPU is detected, the CUDA variant is used. 17 # Otherwise, the LLVM variant is used. 18 # Note: LLVM is required for execution on CPU. 19 # Note: If multiple GPUs are visible, the first one is used. 20 gpus = tf.config.list_physical_devices('GPU') 21 if len(gpus) > 0: 22 # Use LLVM variant for non-CUDA platforms 23 try: 24 mi.set_variant('cuda_ad_rgb') 25 except (AttributeError, ImportError) as e: 26 print("No CUDA device found; using CPU as fallback.") 27 mi.set_variant('llvm_ad_rgb') 28 else: 29 mi.set_variant('llvm_ad_rgb') 30 31 ############################################ 32 # Objects available to the user 33 ############################################ 34 # pylint: disable=wrong-import-position 35 from .scene import load_scene, Scene 36 from .camera import Camera 37 from .antenna import Antenna, compute_gain, visualize, iso_pattern,\ 38 dipole_pattern, hw_dipole_pattern, tr38901_pattern,\ 39 polarization_model_1, polarization_model_2 40 from .antenna_array import AntennaArray, PlanarArray 41 from .radio_material import RadioMaterial 42 from .ris import AmplitudeProfile, DiscreteProfile, DiscreteAmplitudeProfile,\ 43 DiscretePhaseProfile, CellGrid, PhaseProfile, RIS,\ 44 ProfileInterpolator, LagrangeProfileInterpolator 45 from .scene_object import SceneObject 46 from .scattering_pattern import ScatteringPattern, LambertianPattern,\ 47 DirectivePattern, BackscatteringPattern 48 from .transmitter import Transmitter 49 from .receiver import Receiver 50 from .paths import Paths 51 from .coverage_map import CoverageMap 52 from .utils import rotation_matrix, rotate, theta_phi_from_unit_vec,\ 53 r_hat, theta_hat, phi_hat, cross, dot, outer,\ 54 normalize, moller_trumbore, component_transform,\ 55 reflection_coefficient, compute_field_unit_vectors,\ 56 gen_orthogonal_vector, mi_to_tf_tensor, fibonacci_lattice,\ 57 cot, sign, rot_mat_from_unit_vecs,\ 58 sample_points_on_hemisphere, watt_to_dbm, dbm_to_watt