katsu.polarimetry module

katsu.polarimetry.I_output_simulation_function(t, a1, w1, w2, r1, r2, M_in=None)

Function to generate TOTAL intensity values measured with a given Mueller matrix and offset parameters.

Parameters:
  • t (array) – angles of the first quarter wave plate

  • a1 (float) – calibration parameter for the offset angle of the first linear polarizer

  • w1 (float) – calibration parameter for the offset angle of the first quarter-wave plate fast axis.

  • w2 (float) – calibration parameter for the offset angle of the second quarter-wave plate fast axis.

  • r1 (float) – calibration parameter for the retardance offset of the first quarter-wave plate.

  • r2 (float) – calibration parameter for the retardance offset of the second quarter-wave plate.

  • M_in (array) – optional 4x4 Mueller matrix to simulate data. By default None, which uses the identity matrix for air.

Returns:

prediction – An array of predictions for measured Q values.

Return type:

array

katsu.polarimetry.drrp_data_reduction_matrix(Mg, Ma, invert=False)

Compute the polarimetric data reduction matrix from a generator and analyzer matrix

Parameters:
  • Mg (numpy.ndarray) – polarization state generator matrix

  • Ma (numpy.ndarray) – polarization state analyzer matrix

  • invert (bool, optional) – whether to return the pseudo-inverse of the matrix, by default False

Returns:

polarimetric data reduction matrix

Return type:

numpy.ndarray

katsu.polarimetry.dual_channel_polarimeter(thetas, S_in=None, power_o=None, power_e=None, normalized=False, sub_method='single_difference')

Simulate or analyze a dual channel polarimetry experiment using single or double differencing.

Parameters:
  • thetas (ndarray) – Array of angles (in radians) at which measurements were taken

  • S_in (ndarray, optional) – The input Stokes vector [I, Q, U, V] to be measured. Default is None.

  • power_o (ndarray, optional) – Measured power in the ordinary beam. Default is None.

  • power_e (ndarray, optional) – Measured power in the extraordinary beam. Default is None.

  • normalized (bool, optional) – Whether to normalize the response by the total intensity. Default is False

  • sub_method (str, optional) – The differencing method to use, either “single_difference” or “double_difference”. Default is “single_difference”

Returns:

The fitted or propagated Stokes components [Q, U] based on the differencing and normalization method specified.

Return type:

ndarray

Raises:

ValueError – If required input data is missing or if invalid parameters are provided.

katsu.polarimetry.dual_channel_sinusoid(theta, I, Q, U, theta_2=None, method='single_difference', normalized=False)

Calculate the sinusoidal response for a dual channel polarimetry setup.

Parameters:
  • theta (float or ndarray) – The angle(s) of the half-wave plate (HWP) in radians

  • I (float) – Stokes I of the input Stokes vector

  • Q (float) – Stokes Q of the input Stokes vector

  • U (float) – Stokes U of the input Stokes vector

  • theta_2 (float or ndarray, optional) – The angle(s) of the HWP for the previous measurement, required for the double difference method

  • method (str, optional) – The differencing method to use, either “single_difference” or “double_difference”. Default is “single_difference”

  • normalized (bool, optional) – Whether the output should be normalized by the total intensity I. Default is False

Returns:

the sinusoidal power based on the provided Stokes parameters, angles, and method

Return type:

float or ndarray

Raises:

ValueError – If normalized=True and I is not provided or if theta_2 is required and not provided.

katsu.polarimetry.full_mueller_polarimetry(thetas, power, angular_increment, return_condition_number=False, Min=None, starting_angles={'psa_polarizer': 0, 'psa_waveplate': 0, 'psg_polarizer': 0, 'psg_waveplate': 0}, starting_polarization={'psa_Tmin': 0, 'psa_ret': 1.5707963267948966, 'psg_Tmin': 0, 'psg_ret': 1.5707963267948966}, starting_anglestep={'psa_step': 1, 'psg_step': 1})

conduct a full mueller polarimeter measurement from a series of power measurements

Parameters:
  • thetas (numpy.ndarray) – np.linspace(starting_angle,ending_angle,number_of_measurements)

  • power (numpy.ndarray) – 3D array of power recorded from the polarimeter. The first two dimensions are spatial, and the last is temporal i.e. power[…,0] is the first measurement, power[…,0] is the second measurement

  • angular_increment (float) – The fractional angular increment that the PSA rotates compared to the PSG. This can be computed by the ratio PSA_increment / PSG_increment.

  • return_condition_number (bool, optional) – returns condition number of the data reduction matrix. by default False

  • Min (numpy.ndarray) – if provided, is the “true” Mueller matrix. This allows us to simulate full mueller polarimetry. by default None

  • starting_angles – the starting angles (in radians) of the optics that make up the polarization state generator and analyzer.

katsu.polarimetry.full_stokes_polarimetry(thetas, Sin=None, power=None, return_coeffs=False)

conduct a full stokes polarimeter measurement

Parameters:
  • thetas (numpy.ndarray) – rotation angles of the QWP fast axis w.r.t. the horizontal polarizer

  • Sin (numpy.ndarray, optional) – input stokes vector, used for simulating polarimetry. by default None

  • power (numpy.ndarray, optional) – powers measured on detector for each angle theta, by default None

  • return_coeffs (bool, optional) – option to return the stokes sinusoid coefficients. Useful for evaluating curve fit quality. by default None

Returns:

array containing the Stokes vector measured. Also returns coefficients of curve fit of return_coeffs==True.s

Return type:

numpy.ndarray

katsu.polarimetry.normalized_double_diff_sinusoid(theta_1, theta_2, I, Q, U)

Calculate the normalized sinusoidal response for a double difference in dual channel polarimetry.

Parameters:
  • theta_1 (float or ndarray) – The angle(s) of the half-wave plate (HWP) in radians for the first measurement

  • theta_2 (float or ndarray) – The angle(s) of the HWP in radians for the second measurement.

  • I (float) – Stokes I of the input Stokes vector

  • Q (float) – Stokes Q of the input Stokes vector

  • U (float) – Stokes U of the input Stokes vector

Returns:

The normalized output power response based on the provided Stokes parameters and angles

Return type:

float or ndarray

katsu.polarimetry.normalized_single_diff_sinusoid(theta, I, Q, U)

Calculate the normalized sinusoidal response for a single difference in dual channel polarimetry

Parameters:
  • theta (float or ndarray) – The angle(s) of the half-wave plate (HWP) in radians

  • Q (float) – Stokes Q of the input Stokes vector

  • U (float) – Stokes U of the input Stokes vector

Returns:

The normalized output power response based on the provided Stokes parameters and angles.

Return type:

float or ndarray

katsu.polarimetry.q_calibrated_full_mueller_polarimetry(thetas, a1, w1, w2, r1, r2, I_vert, I_hor, M_in=None)

Full Mueller polarimetry using measurements of Q and calibration parameters. Gives a calibrated Mueller matrix with the parameters, or set a1, w1, w2, r1, and r2 to zero for an uncalibrated matrix. :param thetas: angles of the first quarter wave plate :type thetas: array :param a1: calibration parameter for the offset angle of the first linear polarizer :type a1: float :param w1: calibration parameter for the offset angle of the first quarter-wave plate fast axis. :type w1: float :param w2: calibration parameter for the offset angle of the second quarter-wave plate fast axis. :type w2: float :param r1: calibration parameter for the retardance offset of the first quarter-wave plate. :type r1: float :param r2: calibration parameter for the retardance offset of the second quarter-wave plate. :type r2: float :param I_hor: measured intensity of the horizontal polarization spot from the Wollaston prism :type I_hor: array :param I_vert: measured intensity of the vertical polarization spot from the Wollaston prism :type I_vert: array

Returns:

M – 4x4 Mueller matrix for the measured sample.

Return type:

array

katsu.polarimetry.q_output_simulation_function(t, a1, w1, w2, r1, r2, M_in=None)

Function that models the Mueller calculus for the DRRP system and is used to calculate the calibration parameters.

Parameters:
  • t (array) – angles of the first quarter wave plate

  • a1 (float) – calibration parameter for the offset angle of the first linear polarizer

  • w1 (float) – calibration parameter for the offset angle of the first quarter-wave plate fast axis.

  • w2 (float) – calibration parameter for the offset angle of the second quarter-wave plate fast axis.

  • r1 (float) – calibration parameter for the retardance offset of the first quarter-wave plate.

  • r2 (float) – calibration parameter for the retardance offset of the second quarter-wave plate.

  • M_in (array) – optional 4x4 Mueller matrix to simulate data. By default None, which uses the identity matrix for air.

Returns:

prediction – An array of predictions for measured Q values.

Return type:

array

katsu.polarimetry.q_ultimate_polarimetry(cal_angles, cal_vert_intensity, cal_hor_intensity, sample_angles, sample_vert_intensity, sample_hor_intensity)

Function that calculates the Mueller matrix of a sample and other relevant information. cal_angles and sample_angles could be the same, or could be different.

Parameters:
  • cal_angles (array) – angles of the first quarter wave plate for calibration

  • cal_vert_intensity (array) – measured intensity of the vertical polarization spot from the Wollaston prism for calibration

  • cal_hor_intensity (array) – measured intensity of the horizontal polarization spot from the Wollaston prism for calibration

  • sample_angles (array) – angles of the first quarter wave plate when taking data with the sample

  • sample_vert_intensity (array) – measured intensity of the vertical polarization spot from the Wollaston prism when taking data with the sample

  • sample_hor_intensity (array) – measured intensity of the horizontal polarization spot from the Wollaston prism when taking data with the sample

Returns:

  • M_Sample (array) – 4x4 Mueller matrix for the sample

  • retardance (float) – extracted retardance of the sample in waves

  • M_Cal (array) – 4x4 Mueller matrix for the calibration (should resemble the identity matrix)

  • RMS_Error (float) – root mean square error of the calibration matrix

  • Retardance_Error (float) – error of the retardance value, assuming the RMS error from the calibration matrix is the same for all elements of the sample matrix.

katsu.polarimetry.single_output_simulation_function(t, a1, a2, w1, w2, r1, r2, LPA_angle=0, M_in=None)

Function to generate intensity values for one polarization at a time. Default is horizontal, with LPA=0. For vertical, set LPA=pi/2. :param t: angles of the first quarter wave plate :type t: array :param a1: calibration parameter for the offset angle of the first linear polarizer :type a1: float :param a2: calibration parameter for the offset angle of the second linear polarizer (could be just one channel of the Wollaston prism) :type a2: float :param w1: calibration parameter for the offset angle of the first quarter-wave plate fast axis. :type w1: float :param w2: calibration parameter for the offset angle of the second quarter-wave plate fast axis. :type w2: float :param r1: calibration parameter for the retardance offset of the first quarter-wave plate. :type r1: float :param r2: calibration parameter for the retardance offset of the second quarter-wave plate. :type r2: float :param LPA_angle: angle of the analyzing linear polarizer. Default is 0 for horizontal. Set to pi/2 for vertical. :type LPA_angle: float :param M_in: optional 4x4 Mueller matrix to simulate data. By default None, which uses the identity matrix for air. :type M_in: array

Returns:

prediction – An array of predictions for measured Q values.

Return type:

array

katsu.polarimetry.stokes_sinusoid(theta, a0, b2, a4, b4)

sinusoidal response of a single rotating retarder full stokes polarimeter.

Parameters:
  • theta (float) – angle of QWP

  • a0 (float) – zero frequency coefficient

  • b2 (float) – sin(2 heta) coefficient

  • a4 (float) – cos(4 heta) coefficient

  • b4 (float) – sin(4 heta) coefficient

Returns:

sinusoidal response of the SRRP

Return type:

numpy.ndarray

katsu.polarimetry.unnormalized_double_diff_sinusoid(theta_1, theta_2, Q, U)

Calculate the unnormalized sinusoidal response for a double difference in dual channel polarimetry.

Parameters:
  • theta_1 (float or ndarray) – The angle(s) of the half-wave plate (HWP) in radians for the first measurement

  • theta_2 (float or ndarray) – The angle(s) of the HWP in radians for the second measurement

  • Q (float) – Stokes Q of the input Stokes vector

  • U (float) – Stokes U of the input Stokes vector

Returns:

The output power response based on the provided Stokes parameters and angles

Return type:

float or ndarray

katsu.polarimetry.unnormalized_single_diff_sinusoid(theta, Q, U)

Calculate the unnormalized sinusoidal response for a single difference in dual channel polarimetry.

Parameters:
  • theta (float or ndarray) – The angle(s) of the half-wave plate (HWP) in radians

  • Q (float) – Stokes Q of the input Stokes vector

  • U (float) – Stokes U of the input Stokes vector

Returns:

The output power response based on the provided Stokes parameters and angles

Return type:

float or ndarray