Measurements of energy- and time-resolved neutral hydrogen and helium fluxes from an impurity pellet ablation cloud, referred to as pellet charge exchange or PCX experiments, can be used to study local fast ion energy distributions in fusion plasmas. The estimation of the local distribution function fi(E) of fast ions entering the cloud requires knowledge of both the fraction F0(E) of incident ions exiting the cloud as neutral atoms and the attenuation factor A(E,ρ) describing the loss of fast atoms in the plasma. Determination of A(E,ρ), in turn, requires the total stopping cross section σloss of neutral atoms in the plasma and the Jacobian reflecting the measurement geometry and the magnetic surface shape. The obtained functions F0(E) and A(E,ρ) enter multiplicatively into the probability density for escaping neutral particle kinetic energy. A general calculation scheme has been developed and realized as a FORTRAN code, which is to be applied for the calculation of fi(E) from PCX experimental results obtained with low-Z impurity pellets.