mailr19041 - in /trunk: lib/geometry/ target_functions/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 23, 2013 - 09:26:
Author: bugman
Date: Sat Mar 23 09:26:06 2013
New Revision: 19041

URL: http://svn.gna.org/viewcvs/relax?rev=19041&view=rev
Log:
Shifted the target_functions.coord_transform module to 
lib.geometry.coord_transform.


Added:
    trunk/lib/geometry/coord_transform.py
      - copied unchanged from r19029, 
trunk/target_functions/coord_transform.py
Removed:
    trunk/target_functions/coord_transform.py
Modified:
    trunk/lib/geometry/__init__.py
    trunk/target_functions/__init__.py

Modified: trunk/lib/geometry/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/geometry/__init__.py?rev=19041&r1=19040&r2=19041&view=diff
==============================================================================
--- trunk/lib/geometry/__init__.py (original)
+++ trunk/lib/geometry/__init__.py Sat Mar 23 09:26:06 2013
@@ -23,6 +23,7 @@
 """The relax-lib geometry package - a library of functions for studies of 
geometry."""
 
 __all__ = [
+    'coord_transform',
     'lines',
     'rotations',
     'vectors'

Modified: trunk/target_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/__init__.py?rev=19041&r1=19040&r2=19041&view=diff
==============================================================================
--- trunk/target_functions/__init__.py (original)
+++ trunk/target_functions/__init__.py Sat Mar 23 09:26:06 2013
@@ -25,7 +25,6 @@
 
 __all__ = [
     'chi2',
-    'coord_transform',
     'consistency_tests',
     'correlation_time',
     'direction_cosine',

Removed: trunk/target_functions/coord_transform.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/coord_transform.py?rev=19040&view=auto
==============================================================================
--- trunk/target_functions/coord_transform.py (original)
+++ trunk/target_functions/coord_transform.py (removed)
@@ -1,77 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2010 Edward d'Auvergne                                       
 #
-#                                                                            
 #
-# This file is part of the program relax (http://www.nmr-relax.com).         
 #
-#                                                                            
 #
-# This program is free software: you can redistribute it and/or modify       
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation, either version 3 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# This program is distributed in the hope that it will be useful,            
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
-#                                                                            
 #
-###############################################################################
-
-# Module docstring.
-"""Module for transforming between different coordinate systems."""
-
-# Python module imports.
-from math import acos, atan2, cos, sin
-from numpy import array, float64, zeros
-from numpy.linalg import norm
-
-
-def cartesian_to_spherical(vector):
-    """Convert the Cartesian vector [x, y, z] to spherical coordinates [r, 
theta, phi].
-
-    The parameter r is the radial distance, theta is the polar angle, and 
phi is the azimuth.
-
-
-    @param vector:  The Cartesian vector [x, y, z].
-    @type vector:   numpy rank-1, 3D array
-    @return:        The spherical coordinate vector [r, theta, phi].
-    @rtype:         numpy rank-1, 3D array
-    """
-
-    # The radial distance.
-    r = norm(vector)
-
-    # Unit vector.
-    unit = vector / r
-
-    # The polar angle.
-    theta = acos(unit[2])
-
-    # The azimuth.
-    phi = atan2(unit[1], unit[0])
-
-    # Return the spherical coordinate vector.
-    return array([r, theta, phi], float64)
-
-
-def spherical_to_cartesian(spherical_vect, cart_vect):
-    """Convert the spherical coordinate vector [r, theta, phi] to the 
Cartesian vector [x, y, z].
-
-    The parameter r is the radial distance, theta is the polar angle, and 
phi is the azimuth.
-
-
-    @param spherical_vect:  The spherical coordinate vector [r, theta, phi].
-    @type spherical_vect:   3D array or list
-    @param cart_vect:       The Cartesian vector [x, y, z].
-    @type cart_vect:        3D array or list
-    """
-
-    # Trig alias.
-    sin_theta = sin(spherical_vect[1])
-
-    # The vector.
-    cart_vect[0] = spherical_vect[0] * cos(spherical_vect[2]) * sin_theta
-    cart_vect[1] = spherical_vect[0] * sin(spherical_vect[2]) * sin_theta
-    cart_vect[2] = spherical_vect[0] * cos(spherical_vect[1])




Related Messages


Powered by MHonArc, Updated Sat Mar 23 09:40:02 2013