Example #1
0
 def miscenter(self, radii, rho_func, prob_dist_func):
     y_phi_integrand, dys, dphis = self._get_y_phi_integrand_and_differentials(
         radii, rho_func, prob_dist_func)
     dys_ = mathutils.atleast_kd(dys, y_phi_integrand.ndim)
     dphis_ = mathutils.atleast_kd(dphis, y_phi_integrand.ndim)
     phi_integrand = mathutils.trapz_(y_phi_integrand, axis=0, dx=dys)
     return mathutils.trapz_(phi_integrand, axis=0, dx=dphis) / (2 * np.pi)
Example #2
0
 def prob_dist_func(r):
     sigmas = np.array([0.4, 0.5])
     sigmas = mathutils.atleast_kd(sigmas,
                                   r.ndim + 1,
                                   append_dims=False)
     r = mathutils.atleast_kd(r, r.ndim + 1)
     return 1 / np.sqrt(2 * np.pi * sigmas**2) * np.exp(-(r - 0.2)**2 /
                                                        (2 * sigmas**2))
Example #3
0
 def _reshape_probs(self, probs, rho_ndim):
     return np.moveaxis(
         mathutils.atleast_kd(probs, rho_ndim),
         1,
         -1,
     )
Example #4
0
 def _rho_arg(self, radii, ys, phis):
     ys_ = mathutils.atleast_kd(ys, radii.ndim + 2)
     phis_ = mathutils.atleast_kd(phis[None, :], radii.ndim + 2)
     radii_ = radii[None, None, ...]
     return np.sqrt(radii_**2 + ys_**2 + 2 * radii_ * ys_ * np.cos(phis_))
Example #5
0
 def rho_func(x):
     amps_ = mathutils.atleast_kd(amps, x.ndim + 2, append_dims=False)
     slopes_ = mathutils.atleast_kd(slopes[:, None],
                                    x.ndim + 2,
                                    append_dims=False)
     return amps_ / x[..., None, None]**slopes_