  Conditional preparation of photon number states from a continuous-wave
nondegenerate optical parametric oscillator is investigated. We derive the
phase space Wigner function for the output state conditioned on photo detection
events that are not necessarily simultaneous, and we maximize its overlap with
the desired photon number state by choosing the optimal temporal output state
mode function. We present a detailed numerical analysis for the case of
two-photon state generation from a parametric oscillator driven with an
arbitrary intensity below threshold, and in the low intensity limit, we present
a formalism that yields the optimal output state mode function and fidelity for
higher photon number states.
