Polarization#
Processing and polarization analysis#
- vampires_dpp.pdi.utils.measure_instpol(I, X, r=5, expected=0)#
Use aperture photometry to estimate the instrument polarization.
- Parameters:
stokes_cube (NDArray) – Input Stokes cube (4, y, x)
r (float, optional) – Radius of circular aperture in pixels, by default 5
expected (float, optional) – The expected fractional polarization, by default 0
**kwargs
I (ndarray[tuple[int, ...], dtype[_ScalarType_co]])
X (ndarray[tuple[int, ...], dtype[_ScalarType_co]])
- Returns:
The instrumental polarization coefficient
- Return type:
float
- vampires_dpp.pdi.utils.radial_stokes(stokes_cube, stokes_err=None, phi=0)#
Calculate the radial Stokes parameters from the given Stokes cube (4, N, M)
\[\begin{split}Q_\phi = -Q\cos(2\theta) - U\sin(2\theta) \\ U_\phi = Q\sin(2\theta) - U\cos(2\theta)\end{split}\]- Parameters:
stokes_cube (ArrayLike) – Input Stokes cube, with dimensions (4, N, M)
phi (float) – Radial angle offset in radians, by default 0
stokes_err (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None)
- Returns:
Returns the tuple (Qphi, Uphi, Qphi_err, Uphi_err)
- Return type:
NDArray, NDArray
Mueller calculus#
- vampires_dpp.pdi.mueller_matrices.generic(theta=0, epsilon=0, delta=0)#
Return a generic optic with diattenuation
epsilon
and phase retardancedelta
oriented at angletheta
.- Parameters:
theta (float, optional) – Rotation angle of the fast-axis in radians, by default 0
epsilon (float, optional) – Diattenuation, by default 0
delta (float, optional) – Retardance in radians, by default 0
- Returns:
(4, 4) Mueller matrix for the optic
- Return type:
NDArray
Examples
>>> generic() # Identity array([[ 1., 0., 0., 0.], [ 0., 1., 0., -0.], [ 0., 0., 1., 0.], [ 0., 0., -0., 1.]])
>>> generic(epsilon=0.01, delta=np.pi) # mirror with diatt. array([[ 1. , 0.01 , 0. , 0. ], [ 0.01 , 1. , 0. , -0. ], [ 0. , 0. , -0.99995, 0. ], [ 0. , 0. , -0. , -0.99995]])
- vampires_dpp.pdi.mueller_matrices.hwp(theta=0)#
Return the Mueller matrix for an ideal half-wave plate (HWP) with fast-axis oriented to the given angle, in radians.
- Parameters:
theta (float, optional) – Rotation angle of the fast-axis, in radians. By default 0
- Returns:
(4, 4) Mueller matrix representing the HWP
- Return type:
NDArray
Examples
>>> hwp(0) array([[ 1., 0., 0., 0.], [ 0., 1., 0., 0.], [ 0., 0., -1., 0.], [ 0., 0., 0., -1.]])
>>> hwp(np.deg2rad(45)) array([[ 1., 0., 0., 0.], [ 0., -1., 0., 0.], [ 0., 0., 1., 0.], [ 0., 0., 0., -1.]])
- vampires_dpp.pdi.mueller_matrices.linear_polarizer(theta=0)#
Return the Mueller matrix for an ideal linear polarizer oriented at the given angle.
- Parameters:
theta (float, optional) – Angle of rotation, in radians. By default 0
- Returns:
(4, 4) Mueller matrix for the linear polarizer
- Return type:
NDArray
Examples
>>> linear_polarizer(0) array([[0.5, 0.5, 0. , 0. ], [0.5, 0.5, 0. , 0. ], [0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0. ]])
>>> linear_polarizer(np.deg2rad(45)) array([[0.5, 0. , 0.5, 0. ], [0. , 0. , 0. , 0. ], [0.5, 0. , 0.5, 0. ], [0. , 0. , 0. , 0. ]])
- vampires_dpp.pdi.mueller_matrices.qwp(theta=0)#
Return the Mueller matrix for an ideal quarter-wave plate (QWP) with fast-axis oriented to the given angle, in radians.
- Parameters:
theta (float, optional) – Rotation angle of the fast-axis in radians. By default 0
- Returns:
(4, 4) Mueller matrix representing the QWP
- Return type:
NDArray
Examples
>>> qwp(0) array([[ 1., 0., 0., 0.], [ 0., 1., 0., -0.], [ 0., 0., 0., 1.], [ 0., 0., -1., 0.]])
>>> qwp(np.deg2rad(45)) array([[ 1., 0., 0., 0.], [ 0., 0., 0., -1.], [ 0., 0., 1., 0.], [ 0., 1., -0., 0.]])
- vampires_dpp.pdi.mueller_matrices.rotator(theta=0)#
Return the Mueller matrix for rotation clockwise about the optical axis.
- Parameters:
theta (float, optional) – Angle of rotation, in radians. By default 0
- Returns:
(4, 4) Mueller matrix
- Return type:
NDArray
Examples
>>> rotator(0) array([[ 1., 0., 0., 0.], [ 0., 1., 0., 0.], [ 0., -0., 1., 0.], [ 0., 0., 0., 1.]])
>>> rotator(np.deg2rad(45)) array([[ 1., 0., 0., 0.], [ 0., 0., 1., 0.], [ 0., -1., 0., 0.], [ 0., 0., 0., 1.]])
- vampires_dpp.pdi.mueller_matrices.waveplate(theta=0, delta=0)#
Return the Mueller matrix for a waveplate with arbitrary phase retardance.
- Parameters:
theta (float, optional) – Rotation angle of the fast-axis in radians. By default 0
delta (float, optional) – Retardance in radians, by default 0
- Returns:
(4, 4) Mueller matrix representing the waveplate
- Return type:
NDArray
Examples
>>> waveplate(0, np.pi) # HWP array([[ 1., 0., 0., 0.], [ 0., 1., 0., -0.], [ 0., 0., -1., 0.], [ 0., 0., -0., -1.]])
>>> waveplate(np.deg2rad(45), np.pi/2) # QWP at 45° array([[ 1., 0., 0., 0.], [ 0., 0., 0., -1.], [ 0., 0., 1., 0.], [ 0., 1., -0., 0.]])
- vampires_dpp.pdi.mueller_matrices.wollaston(ordinary=True, eta=1)#
Return the Mueller matrix for a Wollaston prism or polarizing beamsplitter.
- Parameters:
ordinary (bool, optional) – Return the ordinary beam’s Mueller matrix, by default True
eta (float, optional) – For imperfect beamsplitters, the diattenuation of the optic, by default 1
- Returns:
(4, 4) Mueller matrix for the selected output beam
- Return type:
NDArray
Examples
>>> wollaston() array([[0.5, 0.5, 0. , 0. ], [0.5, 0.5, 0. , 0. ], [0. , 0. , 0. , 0. ], [0. , 0. , 0. , 0. ]])
>>> wollaston(False, eta=0.8) array([[ 0.5, -0.4, 0. , 0. ], [-0.4, 0.5, 0. , 0. ], [ 0. , 0. , 0.3, 0. ], [ 0. , 0. , 0. , 0.3]])