$$Z =
\begin{pmatrix}
1 & 0 & 0 & \cdots & 0\\
0 & \omega & 0 & \cdots & 0\\
0 & 0 & \omega^2 & \cdots & 0\\
\vdots & \vdots & \vdots & \ddots & \vdots\\
0 & 0 & 0 & \cdots & \omega^{d-1}
\end{pmatrix}
$$
Where $\omega = e^{\frac{2\pi i}{d}}$.
$$X =
\begin{pmatrix}
0 & 0 & 0 & \cdots & 0 & 1\\
1 & 0 & 0 & \cdots & 0 & 0\\
0 & 1 & 0 & \cdots & 0 & 0\\
0 & 0 & 1 & \cdots & 0 & 0\\
\vdots & \vdots & \vdots & \ddots &\vdots &\vdots\\
0 & 0 & 0 & \cdots & 1 & 0\\
\end{pmatrix}
$$
Let's check that we really get a POVM. Recall that a POVM (a positive operator valued measure) consists in a set of positive semidefinite operators that sum to the identity, i.e., a set $\{E_{i}\}$ such that $\sum_{i} E_{i} = I$.
We can form a POVM whose elements are all rank-1:
d = 3
povm_from_state = weyl_heisenberg_povm(qt.rand_ket(d))
assert np.allclose(sum(povm_from_state), qt.identity(d))
Or not!
povm_from_dm = weyl_heisenberg_povm(qt.rand_dm(d))
assert np.allclose(sum(povm_from_dm), qt.identity(d))
The $d^2$ POVM elements form a linearly independent basis for quantum states in a $d$ dimensional Hilbert space. This works because the Weyl-Heisenberg (unitary) displacement operators themselves form an operator basis!
d = 4
O = qt.rand_unitary(d)
assert np.allclose(O, from_weyl_heisenberg_basis(to_weyl_heisenberg_basis(O)))