vamtoolbox.medium#

Module Contents#

Classes#

MediumModel

IndexModel

AttenuationModel

AbsorptionModel

ScatteringModel

class vamtoolbox.medium.MediumModel(coord_vec: numpy.ndarray)#
_formatPresampledScalarField()#

Format presampled_scalar_field_3D into presampled_scalar_field_5D and store the latter as object attribute.

_formatPresampledVectorField()#

Format presampled_vector_field_4D into presampled_vector_field_5D and store the latter as object attribute.

_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

_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

normalizePosition(x)#
getPositionVectorsAtGridPoints()#

Get the position vectors (x) with shape [num_of_points,3] at the stored grid points.

static centralFiniteDifference(presampled_scalar_field_5D, voxel_size)#
class vamtoolbox.medium.IndexModel(coord_vec: numpy.ndarray, type: str = 'analytical', form: str = 'homogeneous', **kwargs)#

Bases: MediumModel

_default_analytical#
_default_interpolation#
_n_homo(x: torch.Tensor)#
_grad_n_homo(x: torch.Tensor)#
_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”

_grad_n_lune(x: torch.Tensor)#
_n_maxwell()#
_grad_n_maxwell()#
_n_eaton()#
_grad_n_eaton()#
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

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

plotRandomlySampledIndex(pts=500, fig=None, ax=None, block=False)#

Create a scatter plot of index at random positions. Color value is proportional to index.

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.

class vamtoolbox.medium.AttenuationModel(coord_vec: numpy.ndarray, type: str = 'analytical', form: str = 'homogeneous_cylinder', **kwargs)#

Bases: MediumModel

_default_analytical#
_default_interpolation#
_alpha_homo_cylinder(x: torch.Tensor)#

Constant absorption coefficient in a cylinder centered at origin. Radius determined by the class initialization variable R.

_alpha_homo_ball(x: torch.Tensor)#

Constant absorption coefficient in a ball centered at origin. Radius determined by the class initialization variable R.

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

plotRandomlySampledAlpha(pts=500, fig=None, ax=None, block=False)#

Create a scatter plot of index at random positions. Color value is proportional to alpha.

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.

class vamtoolbox.medium.AbsorptionModel(*args, **kwargs)#

Bases: AttenuationModel

class vamtoolbox.medium.ScatteringModel(*args, **kwargs)#

Bases: AttenuationModel