diff --git a/README.md b/README.md index 50baae3..8f09f12 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,12 @@ In order to use the functions in this package, you will need the following pytho ## Installation -Place this directory in your PYTHONPATH. The various functions can then be imported as, e.g.: +It could be installable as: + +``` +pip install --user . +``` +The various functions can then be imported as, e.g.: ``` from rotations import rotate_vector_collection @@ -44,4 +49,4 @@ pytest contact: -duncanc@andrew.cmu.edu \ No newline at end of file +duncanc@andrew.cmu.edu diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f3ad2dd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +# Packages required for basic usage of `rotations` package +numpy +astropy + +# Packages required for unit tests +nose +coverage \ No newline at end of file diff --git a/rotations/README.md b/rotations/README.md new file mode 100644 index 0000000..50baae3 --- /dev/null +++ b/rotations/README.md @@ -0,0 +1,47 @@ +# Rotations + +This package contains functions to rotate collections of 2D and 3D vectors. + +Some of the functionality of this package is taken from the [Halotools](https://halotools.readthedocs.io/en/latest/) utilities sudmodule, reproduced here for convenience. + + +## Description + +This package contains tools to perform: + +* rotations of 3D vectors, +* rotations of 2D vectors, +* and monte carlo rotations of 2D and 3D vectors. + + +## Requirements + +In order to use the functions in this package, you will need the following python packages installed: + +* numpy +* astropy + + +## Installation + +Place this directory in your PYTHONPATH. The various functions can then be imported as, e.g.: + +``` +from rotations import rotate_vector_collection +``` + +or for 2- and 3-D specific functions, + +``` +from rotations.rotations3d import rotation_matrices_from_vectors +``` + +You can run the testing suite for this package using the [pytest](https://docs.pytest.org/en/latest/) framework by executing the following command in the package directory: + +``` +pytest +``` + + +contact: +duncanc@andrew.cmu.edu \ No newline at end of file diff --git a/__init__.py b/rotations/__init__.py similarity index 100% rename from __init__.py rename to rotations/__init__.py diff --git a/mcrotations.py b/rotations/mcrotations.py similarity index 91% rename from mcrotations.py rename to rotations/mcrotations.py index 89ac195..fb54b01 100644 --- a/mcrotations.py +++ b/rotations/mcrotations.py @@ -8,10 +8,10 @@ unicode_literals) import numpy as np from astropy.utils.misc import NumpyRNGContext -from vector_utilities import * -from rotate_vector_collection import rotate_vector_collection -from rotations2d import rotation_matrices_from_angles as rotation_matrices_from_angles_2d -from rotations3d import rotation_matrices_from_angles as rotation_matrices_from_angles_3d +from .vector_utilities import * +from .rotate_vector_collection import rotate_vector_collection +from .rotations2d import rotation_matrices_from_angles as rotation_matrices_from_angles_2d +from .rotations3d import rotation_matrices_from_angles as rotation_matrices_from_angles_3d __all__=['random_rotation_3d', diff --git a/rotate_vector_collection.py b/rotations/rotate_vector_collection.py similarity index 100% rename from rotate_vector_collection.py rename to rotations/rotate_vector_collection.py diff --git a/rotations2d.py b/rotations/rotations2d.py similarity index 100% rename from rotations2d.py rename to rotations/rotations2d.py diff --git a/rotations3d.py b/rotations/rotations3d.py similarity index 100% rename from rotations3d.py rename to rotations/rotations3d.py diff --git a/tests/__init__.py b/rotations/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to rotations/tests/__init__.py diff --git a/tests/test_2d.py b/rotations/tests/test_2d.py similarity index 100% rename from tests/test_2d.py rename to rotations/tests/test_2d.py diff --git a/tests/test_3d.py b/rotations/tests/test_3d.py similarity index 100% rename from tests/test_3d.py rename to rotations/tests/test_3d.py diff --git a/tests/test_mcrotations.py b/rotations/tests/test_mcrotations.py similarity index 100% rename from tests/test_mcrotations.py rename to rotations/tests/test_mcrotations.py diff --git a/tests/test_rotate_vector_collection.py b/rotations/tests/test_rotate_vector_collection.py similarity index 100% rename from tests/test_rotate_vector_collection.py rename to rotations/tests/test_rotate_vector_collection.py diff --git a/tests/test_utilities.py b/rotations/tests/test_utilities.py similarity index 100% rename from tests/test_utilities.py rename to rotations/tests/test_utilities.py diff --git a/vector_utilities.py b/rotations/vector_utilities.py similarity index 100% rename from vector_utilities.py rename to rotations/vector_utilities.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..dd41ea9 --- /dev/null +++ b/setup.py @@ -0,0 +1,9 @@ +from setuptools import setup + +setup( + name='rotations', + version='1.0.0', + packages=["rotations"], + install_requires=["numpy", "astropy"], + tests_require=["nose","coverage"], +) \ No newline at end of file