  Most bright sources of the radiation in hard x-ray and gamma--ray regions are
undulator sources and Compton based ones. These sources are ultimate for
production of polarized positrons necessary for future linear colliders ILC,
CLIC. We developed a novel method for evaluating the energy spectrum of
electrons emitting the undulator- and the inverse Compton radiation. The method
based on Poisson weighted superposition of electron states is applicable for
whole range of the emission intensity per electron pass through the driving
force, from much less than unity emitted photons (Compton sources) to many
photons emitted (undulators), and for any energy of the photons. The method
allows for account contributions in the energy spread both from the Poisson
statistics and diffusion due to recoils. The theoretical results were confirmed
by simulations. The electron energy spectrum was used for evaluation of the
on-axis density of photons and their coherency making use of the
`carrier--envelope' presentation for the emitting photons. The evaluated
maximum coherency degree of single--electron radiation is evaluated to be
proportional to the undulator spatial period and inversely to the energy of
electrons, the number of coherently emitted undulator periods almost
independent of the undulator deflection parameter. The results of our study are
applicable both for the classical limit of classical undulator and for the
quantum limit of Compton gamma--ray sources.
