  Excess quasiparticles play a crucial role in superconducting quantum devices
ranging from qubits to quantum sensors. In this work we analyze their dynamics
for phase-biased finite-length weak links with several Andreev subgap states,
where the coupling to a microwave resonator allows for parity state (even/odd)
readout. Our theory shows that almost perfect dynamical polarization in a given
parity sector is achievable by applying a microwave pulse matching a transition
in the opposite parity sector. Our results qualitatively explain key features
of recent experiments on hybrid semiconducting nanowire Josephson junctions and
provide theoretical guidelines for efficiently controlling the parity state of
Andreev qubits.
