Polarization#
- class pyvisgen.simulation.Polarization(SI: tensor, sensitivity_cut: float, amp_ratio: float, delta: float, polarization: str, field_kwargs: dict, random_state: int, device: device)[source]#
Bases:
objectSimulation of polarization.
Creates the \(2\times 2\) stokes matrix and simulates polarization if
polarizationis either'linear'or'circular'. Also computes the degree of polarization.- Parameters:
- SI
tensor() Stokes I component, i.e. intensity distribution of the sky.
- sensitivity_cutfloat
Sensitivity cut, where only pixels above the value are kept.
- amp_ratiofloat
Sets the ratio of \(A_{X|R}\). The ratio of \(A_{Y|L}\) is calculated as
1 - amp_ratio. If set toNone, a random value is drawn from a uniform distribution. See also:random_state.- deltafloat
Sets the phase difference of the amplitudes \(A_{X|R}\) and \(A_{Y|L}`\) of the sky distribution. Defines the measure of ellipticity.
- polarizationstr
Choose between
'linear'or'circular'orNoneto simulate different types of polarizations or disable the simulation of polarization entirely.- random_stateint
Random state used when drawing
amp_ratioand during the generation of the random polarization field.- device
device Torch device to select for computation.
- SI
Methods Summary
circular()Computes the stokes parameters I, Q, U, and V for circular polarization.
dop()Computes the degree of polarization for each pixel.
linear()Computes the stokes parameters I, Q, U, and V for linear polarization.
rand_polarization_field(shape[, order, ...])Generates a random noise mask for polarization.
Computes and returns the 2 x 2 stokes matrix B.
Methods Documentation
- circular() None[source]#
Computes the stokes parameters I, Q, U, and V for circular polarization.
This is done using the following equations:
\[\begin{split}I &= A_R^2 + A_L^2 \\ Q &= 2A_R A_L \cos\delta_{RL} \\ U &= -2A_R A_L \sin\delta_{RL} \\ V &= A_R^2 - A_L^2\end{split}\]
- linear() None[source]#
Computes the stokes parameters I, Q, U, and V for linear polarization.
This is done using the following equations:
\[\begin{split}I &= A_X^2 + A_Y^2 \\ Q &= A_X^2 - A_Y^2 \\ U &= 2A_X A_Y \cos\delta_{XY} \\ V &= -2A_X A_Y \sin\delta_{XY}\end{split}\]
- rand_polarization_field(shape: list[int, int] | int, order: list[int, int] | int = 1, random_state: int = None, scale: list = None, threshold: float = None) tensor[source]#
Generates a random noise mask for polarization.
- Parameters:
- shapearray_like (M, N), or int
The size of the sky image.
- orderarray_like (M, N) or int, optional
Morphology of the random noise. Higher values create more and smaller fluctuations. Default:
1.- random_stateint, optional
Random state for the random number generator. If
None, a random entropy is pulled from the OS. Default:None.- scalearray_like, optional
Scaling of the distribution of the image. Default:
[0, 1]- thresholdfloat, optional
If not None, an upper threshold is applied to the image. Default:
None
- Returns:
- imtorch.tensor
An array containing random noise values between scale[0] and scale[1].
- stokes_matrix() tuple[source]#
Computes and returns the 2 x 2 stokes matrix B.
- Returns:
- Btorch.tensor
2 x 2 stokes brightness matrix. Either for linear, circular or no polarization.
- masktorch.tensor
Mask of the sensitivity cut (Keep all px > sensitivity_cut).
- lin_doptorch.tensor
Degree of linear polarization of every pixel in the sky.
- circ_doptorch.tensor
Degree of circular polarization of every pixel in the sky.