Density matrix from photon number tomography