:py:mod:`vamtoolbox.medium` =========================== .. py:module:: vamtoolbox.medium Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: vamtoolbox.medium.MediumModel vamtoolbox.medium.IndexModel vamtoolbox.medium.AttenuationModel vamtoolbox.medium.AbsorptionModel vamtoolbox.medium.ScatteringModel .. py:class:: MediumModel(coord_vec: numpy.ndarray) .. py:method:: _formatPresampledScalarField() Format presampled_scalar_field_3D into presampled_scalar_field_5D and store the latter as object attribute. .. py:method:: _formatPresampledVectorField() Format presampled_vector_field_4D into presampled_vector_field_5D and store the latter as object attribute. .. py:method:: _scalar_field_interp(x: torch.Tensor) Obtain scalar field value (e.g. refractive index, attenuation coefficient) via interpolating on provided or pre-sampled data points .. py:method:: _vector_field_interp(x: torch.Tensor) Obtain vector field value (e.g. gradient of refractive index) via interpolating on provided or pre-sampled data points .. py:method:: normalizePosition(x) .. py:method:: getPositionVectorsAtGridPoints() Get the position vectors (x) with shape [num_of_points,3] at the stored grid points. .. py:method:: centralFiniteDifference(presampled_scalar_field_5D, voxel_size) :staticmethod: .. py:class:: IndexModel(coord_vec: numpy.ndarray, type: str = 'analytical', form: str = 'homogeneous', **kwargs) Bases: :py:obj:`MediumModel` .. py:attribute:: _default_analytical .. py:attribute:: _default_interpolation .. py:method:: _n_homo(x: torch.Tensor) .. py:method:: _grad_n_homo(x: torch.Tensor) .. py:method:: _n_lune(x: torch.Tensor = None, r_known: torch.Tensor = None) Parameters: x : torch.Tensor, query position vector size(n_query_pts, 3) r_known : To achieve the lensing effect, the refractive index has to change relative to its surroundings. With p = 2, the center of the lens has index sqrt(2) times that of surroundings. Expression of n can be found in "Path Tracing Estimators for Refractive Radiative Transfer, Pediredla et. al., 2020, page 10" .. py:method:: _grad_n_lune(x: torch.Tensor) .. py:method:: _n_maxwell() .. py:method:: _grad_n_maxwell() .. py:method:: _n_eaton() .. py:method:: _grad_n_eaton() .. py:method:: plotIndex(fig=None, ax=None, block=False) Plot a 2D slice of index. Currently only for real part. Future extenstion: for both its real and imaginary parts .. py:method:: plotGradNMag(fig=None, ax=None, block=False) Plot a 2D slice of index gradient. Currently only for real part. Future extenstion: for both its real and imaginary parts .. py:method:: plotRandomlySampledIndex(pts=500, fig=None, ax=None, block=False) Create a scatter plot of index at random positions. Color value is proportional to index. .. py:method:: plotIndexAtPosition(x, fig=None, ax=None, block=False, cmap='viridis', marker='o') Create a scatter plot of index at specified positions x. Color value is proportional to index. .. py:class:: AttenuationModel(coord_vec: numpy.ndarray, type: str = 'analytical', form: str = 'homogeneous_cylinder', **kwargs) Bases: :py:obj:`MediumModel` .. py:attribute:: _default_analytical .. py:attribute:: _default_interpolation .. py:method:: _alpha_homo_cylinder(x: torch.Tensor) Constant absorption coefficient in a cylinder centered at origin. Radius determined by the class initialization variable R. .. py:method:: _alpha_homo_ball(x: torch.Tensor) Constant absorption coefficient in a ball centered at origin. Radius determined by the class initialization variable R. .. py:method:: plotAlpha(fig=None, ax=None, block=False) Plot a 2D slice of index. Currently only for real part. Future extenstion: for both its real and imaginary parts .. py:method:: plotRandomlySampledAlpha(pts=500, fig=None, ax=None, block=False) Create a scatter plot of index at random positions. Color value is proportional to alpha. .. py:method:: plotAlphaAtPosition(x, fig=None, ax=None, block=False, cmap='viridis', marker='o') Create a scatter plot of index at specified positions x. Color value is proportional to index. .. py:class:: AbsorptionModel(*args, **kwargs) Bases: :py:obj:`AttenuationModel` .. py:class:: ScatteringModel(*args, **kwargs) Bases: :py:obj:`AttenuationModel`