[Yt-svn] commit/yt: sskory: Switching phi and theta to match physics convention.
Bitbucket
commits-noreply at bitbucket.org
Mon Mar 7 18:17:22 PST 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/e061a0fc3d3a/
changeset: r3804:e061a0fc3d3a
branch: yt
user: sskory
date: 2011-03-08 03:16:53
summary: Switching phi and theta to match physics convention.
affected #: 1 file (15 bytes)
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py Mon Mar 07 16:15:46 2011 -0700
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py Mon Mar 07 19:16:53 2011 -0700
@@ -83,12 +83,12 @@
number of point pairs per ruler length). Default = 0.
theta : Float
For random pairs of points, the second point is found by traversing
- a distance along a ray set by the angle (theta, phi) from the first
+ a distance along a ray set by the angle (phi, theta) from the first
point. To keep this angle constant, set ``theta`` to a value in the
- range [0, 2pi). Default = None, which will randomize theta for
+ range [0, pi]. Default = None, which will randomize theta for
every pair of points.
phi : Float
- Similar to theta above, but the range of values is [-pi/2, pi/2].
+ Similar to theta above, but the range of values is [0, 2*pi).
Default = None, which will randomize phi for every pair of points.
Examples
@@ -474,16 +474,16 @@
high=self.ds.right_edge[dim], size=size)
# Next we find the second point, determined by a random
# theta, phi angle.
+ if self.constant_phi is None:
+ phi = self.mt.uniform(low=0, high=2.*math.pi, size=size)
+ else: phi = self.constant_phi * na.ones(size, dtype='float64')
if self.constant_theta is None:
- theta = self.mt.uniform(low=0, high=2.*math.pi, size=size)
+ theta = self.mt.uniform(low=0., high=math.pi, size=size)
else: theta = self.constant_theta * na.ones(size, dtype='float64')
- if self.constant_phi is None:
- phi = self.mt.uniform(low=-math.pi/2., high=math.pi/2., size=size)
- else: phi = self.constant_phi * na.ones(size, dtype='float64')
r2 = na.empty((size,3), dtype='float64')
- r2[:,0] = r1[:,0] + length * na.cos(theta) * na.cos(phi)
- r2[:,1] = r1[:,1] + length * na.sin(theta) * na.cos(phi)
- r2[:,2] = r1[:,2] + length * na.sin(phi)
+ r2[:,0] = r1[:,0] + length * na.cos(phi) * na.sin(theta)
+ r2[:,1] = r1[:,1] + length * na.sin(phi) * na.sin(theta)
+ r2[:,2] = r1[:,2] + length * na.cos(theta)
# Reflect so it's inside the (full) volume.
r2 %= self.period
return (r1, r2)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list