gns.geom module¶
-
gns.geom.cartCirc2Point(x, y, l, u)[source]¶ Convert from Cartesian coordinates back to 1-d angle parameterising circle. Then converts back to physical point value based on upper and lower limits Note y = 0 gives p = 0 for all x
-
gns.geom.cartSphere2Point(x, y, z, l1, l2, u1, u2)[source]¶ Convert from Cartesian coordinates back to 2-d angle parameterising surface of sphere. Then converts back to physical point value based on upper and lower limits Again assumes r = 1
-
gns.geom.cartTorus2Point(x, y, z, l1, l2, u1, u2)[source]¶ Convert from Cartesian coordinates on torus back to 2-d angle parameterising torus. Then converts back to physical point value based on upper and lower limits Again assumes r = R = 1
-
gns.geom.getPoleOrthogs(v1)[source]¶ get vector orthogonal to v1, which points towards positive z-pole, then finds vector orthogonal to v1 and v2 by using cross product
-
gns.geom.getPoleVec(v)[source]¶ takes vector v, which is normal to plane tangential to surface of unit sphere (i.e. unit vector from origin), and finds vector in perpendicular plane which points to (positive) z axis. Since v is also a point on the perpendicular plane, only need single vector to get pole vector from n_hat dot (x - a) = 0 i.e. n_hat = a = v. ASSUMES v is normalised
-
gns.geom.getRandOrthogs(v1)[source]¶ get two vectors (mutually) orthogonal to v1. ASSUMES v1 is normalised
-
gns.geom.point2CartCirc(p, l, u)[source]¶ Takes a periodic 1-d physical point along with its bounds, projects it onto the unit circle (r = 1) and returns its 2-d Cartesian coordinates on this circle
-
gns.geom.point2CartSphere(p1, p2, l1, l2, u1, u2)[source]¶ Takes a periodic 2-d physical point along with its bounds, projects it onto surface of ‘unit sphere’ which is parameterised by these periodic values and returns its 3-d Cartesian coordinates on the sphere. Sphere is defined to have radius 1
-
gns.geom.point2CartTorus(p1, p2, l1, l2, u1, u2)[source]¶ Takes a periodic 2-d physical point along with its bounds, Converts it into a point on a torus which is parameterised by these periodic values and returns its 3-d Cartesian coordinates on the torus. Torus is defined to have greater radius = 2 and lesser radius = 1
-
gns.geom.projectCart2Circ(x, y)[source]¶ Takes arbitrary point in x-y plane and projects onto unit circle. Does same as first part of cartCirc2Point() Returns angle measured from positive x-axis
-
gns.geom.projectCart2Sphere(x, y, z)[source]¶ Takes arbitrary point in 3-d cartesian coordinates and projects it onto sphere centred on origin. Essentially does same as first part of cartSphere2Point() but for arbitrary radius r. Returns phi and theta
-
gns.geom.projectCart2Torus(x, y, z, R)[source]¶ Takes arbitrary point in 3-d cartesian coordinates and projects it onto torus centred on origin with greater torus radius R. First calculates azimuthal angle by considering projection of point onto circle in x-y plane with radius equal to R. Then calculates angle around tube by taking arcsin of ratio of z component of original point to distance from original point to centre of tube at azimuthal angle. Returns phi and theta
-
gns.geom.rodriguezRot(k, v, alpha)[source]¶ Rotate vector v about angle alpha (defined b y right hand rule) in plane defined by unit vector k (plane perpendicular to k).
-
gns.geom.sphericalTranslation(phi0, theta0, dPhi, dTheta)[source]¶ phi0 and theta0 correspond to x0, y0, z0 dphi, dtheta correspond to some dx, dy, dz returns coordinates xt, yt, zt
-
gns.geom.testCircleProposalSymmetry(p, l, u, cov)[source]¶ takes a single point on circle (parameterised by angle) and evaluates 2-d gaussian in cartesian coords at a random point which is sampled from same 2-d Gaussian, centred on same input point. Then projects random point onto circle, and evaluates pdf of a gaussian centred on the proposed point at input point. Checks if these two pdf values are the same Essentially checks if (phi’ | phi) = p(phi | phi’) where p is proposal distribution of Metropolis algo
-
gns.geom.testSphereProposalSymmetry(p1, p2, l1, l2, u1, u2, cov)[source]¶ takes a single point on surface of sphere (parameterised by 2 angles) and evaluates 3-d gaussian in cartesian coords at a random point which is sampled from same 3-d Gaussian, centred on same input point. Then projects random point onto sphere, and evaluates pdf of a gaussian centred on the proposed point at input point. Checks if these two pdf values are the same Essentially checks if p(phi’, theta’ | phi, theta) = p(phi, theta | phi’, theta’) where p is proposal distribution of Metropolis algo
-
gns.geom.testTorusProposalSymmetry(p1, p2, l1, l2, u1, u2, cov)[source]¶ takes a single point on torus (parameterised by 2 angles) and evaluates 3-d gaussian in cartesian coords at a random point which is sampled from same 3-d Gaussian, centred on same input point. Then projects random point onto torus, and evaluates pdf of a gaussian centred on the proposed point at input point. Checks if these two pdf values are the same Essentially checks if p(phi’, theta’ | phi, theta) = p(phi, theta | phi’, theta’) where p is proposal distribution of Metropolis algo
-
gns.geom.translateAxes(axes, dPhi, dTheta)[source]¶ calls translateAxis on each vector in axes, and shifts each by dPhi, dTheta