SIGMAS = np.array([-5. , -4.8, -4.6, -4.4, -4.2, -4. , -3.8, -3.6, -3.4, -3.2, -3. , -2.8, -2.6, -2.4, -2.2, -2. , -1.8, -1.6, -1.4, -1.2, -1. , -0.8, -0.6, -0.4, -0.2, 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. , 2.2, 2.4, 2.6, 2.8, 3. , 3.2, 3.4, 3.6, 3.8, 4. , 4.2, 4.4, 4.6, 4.8, 5. ]) def zcdf_to_pdf(zcdf, sigmas=SIGMAS): """ Convert compressed redshift CDF to PDF Parameters ---------- zcdf : array-like Redshifts where ``cdf(z)`` for ``normal_cdf(mu=0, sigmas)`` sigmas : array-like Values where ``normal_cdf`` is evaluated Returns ------- pdf : array-like Converted ``p(z)`` """ import scipy.stats # Evaluate normal distribution at these values to get PDF(x) pdf_y = scipy.stats.norm.pdf(sigmas) return pdf_y / np.trapz(pdf_y, zcdf)