def lnprob_coellip(theta, image, theta_PSF): """ Constrain theta in the following manner: - mus are restricted to cocentric (tbd in the future: unrestrict them) - covariances are coelliptical - the 'smallest' magnitude covariance has the highest weight params then are: mu_x, mu_y, theta, ellipticity, sigma_1, weight_1, sigma_2, weight_2, etc """ X, I = construct_X_and_I_from_image(image) means, covars, weights = convert_theta_coellip(theta) means_PSF, covars_PSF, weights_PSF = convert_theta(theta_PSF) weights /= np.sum(weights) weights_PSF /= np.sum(weights_PSF) lp = lnprior_coellip(theta) if not np.isfinite(lp): return -np.inf means_conv, covars_conv, weights_conv = convolve_gmms(means, covars, weights, means_PSF, covars_PSF, weights_PSF) ll = lnlike(X, I, means_conv, covars_conv, weights_conv) return lp + ll
def lnprob(theta, image, theta_PSF): X, I = construct_X_and_I_from_image(image) means, covars, weights = convert_theta(theta) means_PSF, covars_PSF, weights_PSF = convert_theta(theta_PSF) weights /= np.sum(weights) weights_PSF /= np.sum(weights_PSF) means_conv, covars_conv, weights_conv = convolve_gmms(means, covars, weights, means_PSF, covars_PSF, weights_PSF) lp = lnprior(image, means, covars, weights) if not np.isfinite(lp): return -np.inf ll = lnlike(X, I, means_conv, covars_conv, weights_conv) return lp + ll