Accurate polarization preparation and measurement using twisted nematic liquid crystals

Generation of particular polarization states of light, encoding information in polarization degree of freedom, and efficient measurement of unknown polarization are the key tasks in optical metrology, optical communications, polarization-sensitive imaging, and photonic information processing. Liquid crystal devices have proved to be indispensable for these tasks, though their limited precision and the requirement of a custom design impose a limit of practical applicability. Here we report fast preparation and detection of polarization states with unprecedented accuracy using liquid-crystal cells extracted from common twisted nematic liquid-crystal displays. To verify the performance of the device we use it to prepare dozens of polarization states with average fidelity 0.999(1) and average angle deviation 0.5(3) deg. Using four-projection minimum tomography as well as six-projection Pauli measurement, we measure polarization states employing the reported device with the average fidelity of 0.999(1). Polarization measurement data are processed by the maximum likelihood method to reach a valid estimate of the polarization state. In addition to the application in classical polarimetry, we also employ the reported liquid-crystal device for full tomographic characterization of a three-mode Greenberger--Horne--Zeilinger entangled state produced by a photonic quantum processor.


Introduction
Direction, phase, and coherence of electromagnetic wave oscillation, i.e. its polarization state, represents an important feature determining the interaction of light and matter. Light reflection and scattering are fundamentally affected by incident polarization [1]. Manipulating the state of polarization can significantly improve optical resolution [2] and visualization of anisotropic structures in biomedical imaging [3][4][5]. Polarization modulation enhances information capacity in optical communication [6] and represents a building block of quantum communication and quantum information processing [7,8]. Precise generation and detection of the polarization state represent the crucial tasks in a vast number of applications. Electrically tunable birefringent elements like liquid crystals, Pockels cells, and integrated electrooptical modulators are often employed to control polarization in such applications. Pockels based polarization modulators were successfully applied in optical switches [9] and loop-based photonic routing, where high transmittance is of paramount importance [10][11][12]. They offer high-speed operation and an acceptable extinction ratio, but their application is rather cumbersome due to their size and the necessity of high-voltage driving. Integrated devices achieve even wider bandwidth enabling ultra-fast polarimetry [13]. They possess significant losses and their calibration might be challenging, though, mainly due to unavoidable waveguide coupling. Liquid crystals allow low-loss free-space polarization addressing using low-voltage control signals. Their operation is faster than mechanically manipulated birefringent elements, which has proven beneficial in polarimetry [14][15][16][17] and spectrometry [18,19]. Liquid crystal devices have also been successfully employed in polarization and phase modulation [20][21][22][23][24][25][26] and switching [27,28]. Moreover, the absence of moving parts improves the robustness and lifespan of the device [26,29].
In a vast majority of the polarimetric applications reported so far, nematic liquid crystals are used in custom devices acting as variable retarders [14,15,20,22,26]. Incompatibility of these devices with the common twisted nematic liquid crystal (TNLC) configuration widely utilized in display technology makes their broad application difficult. Another complication stems from the fact, that additional wave plates or birefringent compensators are often utilized to change the overall polarization transformation. Peinado et al. reported a polarimeter using a quarter-wave plate and a single tilted twisted nematic element in reflective geometry [17]. The device was optimized to project an unknown polarization state to four polarization projections symmetrically placed on the Bloch sphere (Poincaré sphere), i.e. the vertices of a regular tetrahedron inscribed into the sphere. This minimum information measurement, also termed the minimum tomography [30,31], was shown to be efficient but prone to noise and measurement errors [32][33][34][35][36]. Furthermore, a TNLC device applies a complex combination of rotation and retardation to incident polarization state, and the exact theoretical description of the device operation and its calibration remains a significant challenge [37,38].
Here we present a TNLC device based on a commercially available TNLC display with minimal modifications. The construction of the TNLC device is described in Section 2. In Section 3, we show that the theoretical model of a twisted nematic liquid crystals cell has a limited ability to predict the polarization changes. The novel calibration method, described in Section 4, does not require a theoretical model and yields unprecedented accuracy. We show how to calibrate the TNLC device to prepare an arbitrary polarization state and perform arbitrary polarization projection. The calibration stage is boosted by a genetic algorithm and other possible improvements are also discussed. In section 5, we test the TNLC device by preparing more than a hundred polarization states covering the Bloch sphere uniformly with an unprecedentedly high average fidelity of 0.999(1), including six eigenstates of Pauli operators and four states needed for the minimum tomography. Also, we show depolarized state preparation with degree of polarization 0.03 (1). The presented device is ready to be used as a polarimeter, performing the polarization state tomography. In Section 6 we briefly review the polarization state tomography, and then we test the performance of the TNLC-based polarimeter. Furthermore, the TNLC device is employed in full quantum tomography of three-qubit Greenberger-Horne-Zeilinger entangled state produced by photonic quantum Toffoli gate.

Construction of TNLC device
The presented polarimetric device consists of three TNLC cells extracted from commercially available displays. We tested several commercially available displays, namely TN reflective display Lumex LCD-S101D14TR, super-TN (STN) reflective display RS Pro 5080PHR, transmissive TNLC display OCZ Vrchlabi 2027. We also tested transmissive STN pixel display OCZ Vrchlabi 2001 and reflective STN pixel display DOG XL. Due to their limited fill factor, the transmitted polarization state is spatially modulated and effectively depolarized. We therefore find them inappropriate for the presented application. We selected display Lumex LCD-S101D14TR, which has 7 segments (cells) and dimensions 33×50 mm, see Fig. 1(a). This particular model was chosen as a trade-off between the size of the segment and the overall compactness of the whole device. The TNLC reflective display cannot be directly used in transmission geometry or even to perform a unitary transformation. Therefore, we first removed reflective layers, protective films, polarizing sheets, and also other auxiliary layers from the displays. Using a micrometer screw gauge, we measured the thickness of the LC layer to be 6 ± 2 m. The number in parenthesis represents one standard deviation at the least significant digit.
We mounted the TNLC glass cells on printed circuit boards and stacked them, as shown in Fig. 1(b,c). The main circuit board contains a driver consisting of a microcontroller, 16-bit digital-to-analog converter, and a voltage amplifier [39]. The microcontroller receives serial commands from a computer and controls the digital-to-analog converter. The produced control voltage signal is a symmetric square wave with frequency 1 kHz and 50% duty cycle. The square wave amplitude spans from 0 to 10 Vpp and effectively controls the action of the liquid crystals. For brevity, we refer to the control voltage amplitude simply as the voltage. The voltage is applied between the central segment electrode, denoted G in Fig. 1(a), and the common back electrode (COM) of the TNLC cell. The central segment has a 15×4.5 mm approximately rectangular clear aperture, which is perfectly sufficient for collimated optical beams with mode field diameter up to 2.5 mm. The device can address the polarization state of several parallel optical beams arranged in a line or a matrix in complex quantum information processing circuits [40][41][42].
The transmittance of the single cell is 84% and the transmittance of the whole device is 59% at wavelength 810 nm. Limited transmittance is not an obstacle for classical polarimetry. At the single-photon level, the presented transmittance is also sufficient, as we demonstrate in Section 6. Antireflective coating TNLC cells could increase the transmittance of a single cell up to 90%, increasing the overall transmittance to 73%. Only in loss-sensitive scenarios, for example measurements involving squeezed light, the limited transmittance becomes an obstacle.

Characterization of a single TNLC cell
Let us start with a brief review of the Dirac notation, used here to describe the polarization, and connect it to the traditional description of polarized light. We describe pure polarization states with a ket state, denoted with symbol |· , which is equivalent to the normalized Jones vector. It holds that | = J | |J | | , where J = x + y is the Jones vector and x and y are orthonormal vectors, both normal to the direction of light propagation. The choice of basis is arbitrary, and the vector can be written as a superposition of any two orthonormal basis states. We choose basis states | and | corresponding to horizontally and vertically polarized light to keep the close correspondence between Jones vector and ket states. Explicitly, the correspondence is | = | + | | | 2 + | | 2 −1/2 . Density matrix = | | composed as an incoherent mixture of pure states | with a probability distribution also describes polarization of light, but in comparison to ket-vectors, it can also describe partially polarized light. Term | | is the outer product of | and its Hermitian conjugate, a 2 × 2 complex trace-normalized Hermitian matrix. Any polarization density matrix can be expanded using the identity I and the Pauli matrices, 1 , 2 , 3 , is the Bloch vector. Compared to the Stokes vector, the Bloch vector does not contain information about the optical intensity, and its size is upper-bounded to one. We represent the polarization states geometrically using the Bloch sphere. A Bloch vector contains Cartesian coordinates of a point within the sphere. A point on the surface of the Bloch sphere, described with longitude and latitude , corresponds to a pure state | = cos( 2 ) | + exp( ) sin( 2 ) | . In this representation, left-and righthanded circular polarizations lie on the south and north pole of the sphere, respectively. All linear polarizations lie on the equator of the sphere. A point inside the sphere describes a partially polarized state. We quantify its purity as = Tr 2 , in the expression for purity is the degree of polarization of density matrices and quantifies their similarity. It can be expressed in terms of the corresponding Bloch vectors, u and v, as . The fidelity is connected to the angular deviation of the Bloch vectors = 1 2 arccos u·v | |u | | | |v| | via the dot-product term. The polarization transformation introduced by a device is described with matrix acting on a density matrix of the input state, out = in † , where † stands for Hermitian conjugation. The transformation matrix of an ideal TNLC cell can be derived using a sequence of thin wave plates, each introducing a small phase delay and oriented at linearly increasing azimuth angle [43]. The transformation reads where = √︁ 2 + 2 , is the twist angle, is the rotation angle of the cell, and represents the phase delay dependent on the applied voltage . The phase delay (retardance) is almost constant up to a threshold voltage and decreases for larger voltages. The retardance is usually approximated using an arctan function [44]. We propose to model the retardance more precisely using a logistic function, where , , , , and are constants and is the voltage applied on the TNLC cell. Let us show how a single TNLC cell transforms a polarization state, according to the model, and compare it with experimental data. We prepared state | on the input of the tested TNLC cell and changed the control voltage amplitude. For each voltage, we measured the output polarization state using a reference polarimeter. We plot the phase delay introduced by the cell in Fig. 2 as a function of voltage. The least-square fit with the proposed logistic function in Fig. 2 clearly describes the measured data better than the approximation with arctan. This measurement was repeated for four known angular positions of the TNLC cell, namely = 0 deg, 15 deg, 30 deg, and 45 deg. See Fig. 3(a) for a scheme of the experimental setup used in this measurement. We performed a least-square fit of the measured data to obtain seven independent parameters Fig. 2. The measured phase delay of a single TNLC cell obtained from the display Lumex LCD-S101D14TR as a function of the applied voltage at 810 nm (blue markers). The delay is described using an arctan function (green) or a logistic function (red). = −2.6. In Fig. 3(b), we compare measured data with the theoretical predictions based on fitted parameters. The prepared and expected states are depicted using the Bloch sphere, which is plotted in the Hammer map projection [45]. Clearly, a single TNLC cell covers only a curve on the Bloch sphere. To transform state | into an arbitrary pure polarization state, one needs to introduce additional independent polarization transformations. This is the reason why the reported TNLC device consists of three TNLC cells controlled with independent voltages. Furthermore, the model deviates from the measured data even though it was fitted to the same data. Parameters of the model vary between individual TNLC cells, which represents a complication in modeling multi-cell devices. The accuracy of the model could be further improved by considering edge effects in the vicinity of aligning layers [37,38] and accounting for other imperfections, such as multiple reflections, depolarization effects, and thickness inhomogeneity. However, no model with sufficiently high fidelity with the experimental data covering all possible states has been reported. Also, it is very complicated to make an inverse of such a complex numerical model. In the following section, we introduce a novel calibration method that solves both issues.

Calibration of TNLC device
We aim for the device able to prepare an arbitrary polarization state with high precision. The calibration of the TNLC device consists of finding control voltages 1 , 2 , and 3 , one for each TNLC cell, for which the device transforms the pure input state | to the pure particular target state | . The calibration is thus formulated as maximization of the fidelity = | | ( 1 , 2 , 3 ) | | 2 , where is transformation introduced by the TNLC device, over the three control voltages. The fidelity | | ( 1 , 2 , 3 ) | | 2 is proportional to the intensity of projection onto the target state, which is directly experimentally measurable. The maximization does not rely on the theoretical model, and various methods could be used to solve it. Straightforward methods, like brute-force search or random sampling, are time-consuming as they require many measurements. Therefore we choose a genetic algorithm [46] to speed up the calibration.
The initial population is created as three-element random-voltage vectors, and a fitness function is the detected photocurrent. We sequentially apply these voltages settings and directly measure the value of the fitness function. We choose voltages with the largest fitness from this first generation and crossover them to produce "child" voltages, which replace the voltages of lesser fitness. As a crossover method, we chose the arithmetic mean of the corresponding voltages. A random mutation in range of ±500 mVpp is also applied to a randomly chosen component of the voltage vector. These steps are repeated until the fitness changes less than one part per thousand, which is roughly an order of magnitude larger than the uncertainty of the intensity measurement. Further iterations would slightly improve the precision at the expense of the longer time needed for the calibration. Although the TNLC theoretical model (1)-(3) is neither perfect nor required, it can be used to speed up the search by providing a rough initial estimate of the voltage values for the first generation of the genetic algorithm. Even faster calibration might be obtained using black-box optimization methods [47]. As the last step of the calibration, we generate 120 random voltage vectors around the fittest voltage vector using a normal distribution with a half-width of 0.1 Vpp. We prepare states using these voltages and measured them using a reference polarimeter. Finally, we select the optimum voltages that produce the target state with the highest fidelity.
The optimum voltages slightly vary for the TNLC cells extracted from different TNLC displays, even when selected from a single manufacturing batch. The voltages are also affected by offsets of voltage regulators and digital-to-analog converters incorporated in the electronic drivers, see Sec. 2. Consequently, the calibration has to be performed independently for each TNLC device. A detailed calibration sheet with optimum voltages for various target states and several TNLC devices assembled in our lab is available on GitHub [39].
The experimental setup for the calibration is depicted in Fig. 4(a). An 810-nm continuous-wave laser light passes the first horizontal polarizer (calcite crystal with extinction ratio exceeding 1 : 10 4 ), and then it passes the TNLC device. The output polarization state is projected onto the desired state | in a detection block, consisting of half-and quarter-wave plates followed by another horizontal polarizer (another calcite crystal). The photodiode measures the optical intensity, which is proportional to the fitness function. The wave plates are mounted in motorized rotation stages (Newport PR50CC) with the angular speed of 20 deg/s and typical bi-directional repeatability ±30 mdeg. The angular positions of these wave plates control which projection we measure. We also use the waveplates to realize projections to six eigenstates of Pauli matrices, | , | , | , | , | , and | . Section 6 explains how to use these projections to reconstruct a quantum state. For now, we state that the analysis and detection block serves also as a reference polarimeter.
In addition to preparing arbitrary pure polarization state, the TNLC device can project a state onto an arbitrary pure state. Just by simple reversion of the calibration setup, depicted in Fig. 4(b), we could maximize = | | ( 1 , 2 , 3 ) | | 2 using the same algorithm. The presented calibration can be performed for an arbitrary wavelength within visible and near-infrared regions.

Precise preparation of arbitrary polarization
We first test the presented TNLC device calibration on a set of six eigenstates of Pauli operators. We measured the prepared state with the reference polarimeter. The Bloch parameters of the prepared states are shown in Table 1. The prepared states show high purity, = 0.999(2) on average, and are very close to the ideal target states. The number in parenthesis represents one standard deviation at the last decimal digit [48]. The average fidelity of the observed state to the ideal target states reaches = 0.999(1) with the corresponding average angular deviation of 1.1(3) deg. We believe that the very small remaining discrepancy is mainly due to the stopping criteria of the calibration search (one part per thousand) and also inaccuracies of the reference polarimeter, such as retardation error of the waveplates or their misalignment.
We observed perfect stability in time and low sensitivity to temperature changes under common laboratory conditions. The cell's temperature variation within ±3 • C did not cause any measurable changes in the calibration. Similarly, central wavelength variation within ±5 nm does not introduce any measurable changes.  We chose the six eigenstates of Pauli operators because they are traditionally used in polarization state tomography, which we will show in Section 6. Another important tomographic set of states forms the vertices of a regular tetrahedron inscribed into the Bloch sphere. We searched for the states that maximize the tetrahedron volume and reached the ratio of the measured volume to the volume of the regular tetrahedron meas / ideal = 0.9987 (5).
Furthermore, we prepare 120 states, quasi-uniformly distributed over the Bloch sphere. Figure 5 visually compares the prepared states with the ideal target states. It clearly shows that In addition to the pure polarization states, it is also beneficial to prepare partially mixed states, i.e., states with an arbitrary degree of polarization DoP. Depolarization can be achieved by ensemble averaging of a polarization state in spatial, frequency, or time domain [23]. Often, the maximally depolarized state is prepared and then superimposed to a pure state to form a source with continuously tunable DoP. In the case of a voltage-controlled TNLC cell, a specific voltage applied to the TNLC cell performs corresponding unitary operation. Therefore, time multiplexing of various control voltages within the single acquisition time must be used. We demonstrate the preparation of a maximally mixed state by uniformly cycling through the polarization states H, V, D, A, R, and L during the measurement time. Note that the acquisition is paused during the time needed to switch from one prepared state to another. The resulting prepared state possesses the purity 0.5004(3) and the corresponding DoP 0.03(1). The reported TNLC device is made from thick TNLC cells and is not optimized with respect to its speed. However, to present the full characterization of the TNLC device, we measured its time response, for which we used the setup shown in Fig. 4(b). The wave plates prepare a pure input state which is then projected onto another pure state using the tested device. The corresponding projection intensity is detected with a photodiode. To study the time response, we switch the projection and sample the transition in the detected photocurrent using an analog-to-digital converter with an 18-bit resolution acquiring approximately 1000 samples per second.
Specifically, we measured the transition times of all the projections onto Pauli operators eigenstates (H, V, D, A, R, L). We prepared a corresponding input state for an initial projection to obtain a maximal optical intensity at the detector. Then we switched the projection. We define the transition time as the time from the issued command to the moment when the intensity deviation from its final value stays under 1% of the total intensity (0% to 99% transition time). We chose this value to ensure a stable operation after the transition. The measured transition times are shown in Table 2, and the time traces of all 30 transitions are shown in Fig. 6.
The particular transitions, such as H→V, are rather fast and suitable for rapid polarization switching, but there is a transition exceeding 600 ms, namely L→H. Specially designed nematic liquid crystal retarders and switches typically specify faster switching, particularly those with a thinner liquid crystal layer and a single optimized polarization transition. Also, their transition times are often specified as 10% to 90% or even 20% to 80%, which is not sufficient for precise settling of the induced polarization transformation in polarimetry.

TNLC polarimeter
The presented device is compact, robust, and capable of precise polarization manipulation with less than one second transition times. Here, we utilize the developed TNLC device to create a polarimeter based on polarization state tomography. The polarization state tomography finds its applications mainly when we deal with single-photon signals or measure multi-photon polarization states. In these applications, the classical polarimetry techniques are not sufficient. The presented polarimeter outperforms conventional rotating-waveplates-based polarization tomography in speed, precision, and versatility.
Let us first briefly review the principle of polarization state tomography. The goal of the polarization state tomography is to unambiguously reconstruct an unknown state from a set of measurements. Let us start with the strong signal and six-state tomography. We assume that the light has intensity 0 and unknown polarization. Recall that any density matrix could be decomposed as a sum of Pauli operators multiplied by Bloch vector components = (I + 3

=1
)/2. The projections onto eigenstates of these operators, | , | , | , | , | , and | contains information about the polarization. Specifically, the measured intensities of these projections are These six equations contain three unknown parameters of the polarization state. In the previous section, we showed that our device is capable of realizing these projections. One can obtain the parameters from (4-9) by straightforward inversion, In the presence of measurement noise, the linear inversion may introduce artifacts. For example, the reconstructed density matrix can have negative eigenvalues, leading to a degree of polarization greater than one. We call such a density matrix unphysical.
To avoid these problems, we use a maximum-likelihood reconstruction method [49][50][51][52]. The method searches for a valid quantum state that would reproduce the measured data with the maximum likelihood. It guarantees that the reconstructed state is always physical. Instead of optical intensities of projection | | , we work with relative frequencies , which correspond to normalized intensities = . The logarithm of likelihood of observing relative frequencies { } given the input polarization state is proportional to The likelihood quantifies the degree of belief in the hypothesis that for the particular set of observations the polarization is in state . We can work with the logarithm of the likelihood with neglected multiplicative factors because if the likelihood is maximized, then any monotonically increasing function of the likelihood is also maximized. The density matrix , which maximizes the likelihood, satisfies the extremal equation [49,51,52] = , where Equation (14) leads to an iteration that maximizes the likelihood. The iteration reads starting from 0 = I/2 and stopping when the change in one step gets small enough, Tr| +1 − | 2 < . The derivations of the extremal and iterative equations are covered in Ref. [49,51,52]. So far, we have used projection measurement operators Π = | |, namely | | , . . . , | |. Let us note that the polarization tomography is not restricted to these particular projections and any tomographically complete set of positive measurement operators (POVM) is applicable. The method also applies to single-photon signals, for which the detected intensity is replaced with the recorded number of detection events in a given projection. We provide a Python script for the maximum likelihood reconstruction on GitHub [39]. Examples of waveplate-based and TNLC-based polarization tomography are also included.
We test the TNLC polarimeter by comparing its readings to the known input polarization states. We prepared the input polarization states using waveplates and measured them using the tested TNLC polarimeter. Namely, we prepared the six eigenstates of Pauli operators. The TNLC polarimeter was calibrated to perform the projections onto Pauli eigenstates as well as the four states required for minimal tomography [30]. As a reference, we replaced the TNLC polarimeter with a pair of waveplates and performed the standard six-state tomography.
The resulting fidelities and angular deviations averaged over the six tested states are summarized in Table 3. The individual sample states analyzed using the presented TNLC device with the six-state tomography and the four-state tomography are visualized in Fig. 7. The six-state tomography outperforms the four-state minimal tomography consistently. The results produced by the TNLC polarimeter agree excellently with the results provided by a reference waveplatebased polarimeter. Note that the used reference polarimeter is not the same polarimeter we used for TNLC device calibration.  Table 3. Achieved average results of the fidelity and angular deviation between the ideal and measured sample polarization states prepared by the reference polarimeter. The reported TNLC polarimeter in six-state and four-state configurations, and the reference wave-plate based polarimeter in six-state regime are compared. Now we show that the presented TNLC polarimeter outperforms the equivalent scheme with waveplates in terms of speed. The ordering of the projections in the tomographic measurement does not affect the result of the measurement but influences its duration [53]. Based on the transition time characterization (Table 2), we can select the optimum sequence ordering of the six-state protocol, which is H, R, L, A, D, V, and back to H to prepare the TNLC device for another tomography cycle. The transition of the optimum sequence takes 1.17 s. For the minimal tomography [30], only four states are required. The transitions times between them are longer than in the six-state scheme. It takes approximately 1.2 s to cycle through these four states. Consequently, we recommend to using six-state tomography with the presented device.
We compare these values with the total time required by our reference waveplate-based polarimeter. The reference polarimeter uses motorized mounts with a typical speed of 20 deg/s (Newport PR50CC), and the optimum sequence reads H, L, A, R, V, D, and back to H. The sequence takes 12.9 s, which is an order of magnitude slower than using the TNLC device. The optimal sequence ordering can significantly speed up the whole measurement process, especially for multi-mode analysis or quantum circuits with more qubits [53]. Alternatively, all projections can be measured at the same time [31,54] at the expense of a number of detectors and the complexity of the experimental setup.
To show an application of the reported TNLC device at the single-photon level, we used it in quantum tomography of a multi-qubit photonic entangled state. The TNLC device was calibrated in a six-state configuration using the strong laser signal, as described in Sec. 4. The TNLC device was then used to perform tomographic projections on the third output qubit of a three-qubit linear optical controlled-Z gate (CCZ gate). The gate is equivalent to the Toffoli gate up to single-qubit Hadamard transform on a target qubit [40,[55][56][57]. The Toffoli gate is a crucial part of many quantum information processing schemes [55]. The photonic circuit of the gate and its characterization were presented in detail elsewhere [58]. The gate can produce entangled quantum states such as tripartite Greenberger-Horne-Zeilinger (GHZ) state [59,60]. We used the circuit to prepare the GHZ state (| + | ) / √ 2 and performed its full tomographic characterization using the TNLC device. The resulting density matrix of the three-qubit state is shown in Fig. 8(a,b). The fidelity of the measured state and the ideal GHZ state is 0.9362. For comparison, we characterized the state also using a common waveplate-based tomography and obtained the fidelity to the ideal state 0.9360; the resulting density matrix is shown in Fig. 8(c,d). The respective fidelity of the retrieved GHZ states measured using the TNLC device and the wave-plate polarimeter reaches 0.971. The small resulting discrepancy is caused by the limited repeatability of the experimental setup. When changing the TNLC device for the waveplates, the setup had to be partly reassembled and realigned. Due to the circuit construction, this realignment might lead to small changes in polarization-dependent losses. Furthermore, the interferometric phase in the experimental setup was slowly drifting, and the phase drift might result in small changes between two experimental runs.

Conclusion
We have presented a polarimetric device assembled from a commercially available TNLC segment display with minimal modifications. We have demonstrated a universal method of the TNLC device calibration utilizing a genetic algorithm. Various polarization states have been prepared using the TNLC device and characterized with a reference polarimeter with the average fidelity exceeding 0.999 (1). Particularly, we have demonstrated a highly accurate generation of four states forming the vertices of a regular tetrahedron inscribed into the Bloch sphere [30], six eigenstates of Pauli operators (horizontal, vertical, diagonal, anti-diagonal, right-handed and left-handed circular polarizations), and 120 states uniformly distributed on the Bloch Sphere. We also have generated a completely depolarized state with the purity 0.5004(3) and degree of polarization 0.03(1). Using the presented calibration procedure, we can generate an arbitrary state of polarization.
Furthermore, we have employed the reported TNLC device as a polarimeter and demonstrated accurate measurement of polarization of light. Physically correct density matrix of the polarization state is retrieved using the maximum likelihood iterative algorithm. We have tested two tomographic schemes, namely four-projection minimal tomography and overdetermined sixprojection scheme based on eigenstates of the Pauli matrices. We have characterized and optimized the precision and speed of the developed polarimeter. The TNLC device has been successfully used also for polarimetry of optical signals at the single-photon level. Particularly, we have performed the full quantum tomography of the three-qubit Greenberger-Horne-Zeilinger entangled state produced by photonic quantum Toffoli gate. The results agree with those obtained using common wave-plate polarimetry.
To conclude, we have demonstrated the calibration and application in polarimetry of virtually arbitrary twisted nematic liquid crystal segment displays. The approach allows highly accurate preparation and measurement of an arbitrary polarization state of light using low-voltage driving and no moving parts. The approach is fully scalable to many optical modes at the singlephoton level. It can find applications in a wide range of fields, such as polarization-sensitive biomedical imaging or photonic quantum information processing. Recently, we have developed a deep learning model of TNLC devices, which allows omitting the time-consuming calibration procedure and predicting the TNLC control voltages directly [61]. This novel deep learning approach is particularly beneficial when the polarization needs to be controlled continuously.
The complete technical documentation of the presented TNLC device, including tomography software, is published on GitHub [39].