From cd33786c9c8f557bfe0a64f12d1056ae28c9ea2a Mon Sep 17 00:00:00 2001 From: kitchenknif Date: Tue, 20 Oct 2015 17:25:08 +0300 Subject: [PATCH] Refactor for setup.py --- README.md | 8 +-- __init__.py | 1 - pytmm/__init__.py | 0 pytmm/examples/__init__.py | 0 .../examples}/antireflection.py | 3 +- {examples => pytmm/examples}/brewster.py | 3 +- .../getRefractiveIndex.m | 0 .../refractiveIndex.py | 0 pytmm/tests/__init__.py | 0 .../tests}/test_refractiveIndex.py | 3 +- .../tests}/transferMatrix_tests.py | 3 +- {tests => pytmm/tests}/yaml_tests.py | 2 +- transferMatrix.py => pytmm/transferMatrix.py | 0 setup.py | 54 +++++++++++++++++++ 14 files changed, 67 insertions(+), 10 deletions(-) delete mode 100644 __init__.py create mode 100644 pytmm/__init__.py create mode 100644 pytmm/examples/__init__.py rename {examples => pytmm/examples}/antireflection.py (95%) rename {examples => pytmm/examples}/brewster.py (94%) rename getRefractiveIndex.m => pytmm/getRefractiveIndex.m (100%) rename refractiveIndex.py => pytmm/refractiveIndex.py (100%) create mode 100644 pytmm/tests/__init__.py rename {tests => pytmm/tests}/test_refractiveIndex.py (98%) rename {tests => pytmm/tests}/transferMatrix_tests.py (98%) rename {tests => pytmm/tests}/yaml_tests.py (98%) rename transferMatrix.py => pytmm/transferMatrix.py (100%) create mode 100644 setup.py diff --git a/README.md b/README.md index 94665f1..8031951 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Transfer Matrix Method implementation & RefractiveIndex.info database (2015- ## Installation & Basic Usage By default the RefractiveIndex module thinks that it is installed side-by-side with the RefractiveIndex.info database: - + . +-- _PyTMM | +-- refractiveIndex.py @@ -21,7 +21,7 @@ In this case, the database can be used as follows: If your folder structure is different, you just need to specify the path to the RefractiveIndex database: - catalog = RefractiveIndex("./path/to/folder/with/RefractiveIndex/databae") + catalog = RefractiveIndex("./path/to/folder/with/RefractiveIndex/database") mat = catalog.getMaterial('main', 'Si', 'Aspnes') n = mat.getRefractiveIndex(500)) # wavelength in nanometers @@ -30,11 +30,11 @@ Examples of using the transferMatrix module can be found in . +-- _PyTMM - | +-- _tests + | +-- tests | +-- transferMatrix_tests.py -###Dependencies +## Dependencies - numpy - scipy - pyyaml diff --git a/__init__.py b/__init__.py deleted file mode 100644 index ea8c118..0000000 --- a/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'Kryosugarra' diff --git a/pytmm/__init__.py b/pytmm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pytmm/examples/__init__.py b/pytmm/examples/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/antireflection.py b/pytmm/examples/antireflection.py similarity index 95% rename from examples/antireflection.py rename to pytmm/examples/antireflection.py index 3e2dea3..8db258d 100644 --- a/examples/antireflection.py +++ b/pytmm/examples/antireflection.py @@ -1,6 +1,7 @@ import numpy as np import matplotlib.pyplot as plt -from transferMatrix import * + +from pytmm.transferMatrix import * from refractiveIndex import * n1 = 1.5 diff --git a/examples/brewster.py b/pytmm/examples/brewster.py similarity index 94% rename from examples/brewster.py rename to pytmm/examples/brewster.py index cb86259..9c2e473 100644 --- a/examples/brewster.py +++ b/pytmm/examples/brewster.py @@ -1,6 +1,7 @@ import numpy as np import matplotlib.pyplot as plt -from transferMatrix import * + +from pytmm.transferMatrix import * from refractiveIndex import * n = 2 diff --git a/getRefractiveIndex.m b/pytmm/getRefractiveIndex.m similarity index 100% rename from getRefractiveIndex.m rename to pytmm/getRefractiveIndex.m diff --git a/refractiveIndex.py b/pytmm/refractiveIndex.py similarity index 100% rename from refractiveIndex.py rename to pytmm/refractiveIndex.py diff --git a/pytmm/tests/__init__.py b/pytmm/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_refractiveIndex.py b/pytmm/tests/test_refractiveIndex.py similarity index 98% rename from tests/test_refractiveIndex.py rename to pytmm/tests/test_refractiveIndex.py index 68021be..3276b92 100644 --- a/tests/test_refractiveIndex.py +++ b/pytmm/tests/test_refractiveIndex.py @@ -18,7 +18,8 @@ from unittest import TestCase -from refractiveIndex import * + +from pytmm.refractiveIndex import * class TestRefractiveIndex(TestCase): diff --git a/tests/transferMatrix_tests.py b/pytmm/tests/transferMatrix_tests.py similarity index 98% rename from tests/transferMatrix_tests.py rename to pytmm/tests/transferMatrix_tests.py index d875887..5ce22eb 100644 --- a/tests/transferMatrix_tests.py +++ b/pytmm/tests/transferMatrix_tests.py @@ -16,8 +16,9 @@ # # Copyright 2014-2015 Pavel Dmitriev -from transferMatrix import * import matplotlib.pyplot as plt + +from pytmm.transferMatrix import * from refractiveIndex import * catalog = RefractiveIndex() diff --git a/tests/yaml_tests.py b/pytmm/tests/yaml_tests.py similarity index 98% rename from tests/yaml_tests.py rename to pytmm/tests/yaml_tests.py index 5f00147..4378a68 100644 --- a/tests/yaml_tests.py +++ b/pytmm/tests/yaml_tests.py @@ -16,7 +16,7 @@ # # Copyright 2014-2015 Pavel Dmitriev -from refractiveIndex import * +from pytmm.refractiveIndex import * # catalog = RefractiveIndex("../RefractiveIndex") catalog = RefractiveIndex() diff --git a/transferMatrix.py b/pytmm/transferMatrix.py similarity index 100% rename from transferMatrix.py rename to pytmm/transferMatrix.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e27a2fa --- /dev/null +++ b/setup.py @@ -0,0 +1,54 @@ +# Always prefer setuptools over distutils +from setuptools import setup, find_packages +# To use a consistent encoding +from codecs import open +from os import path + +here = path.abspath(path.dirname(__file__)) + +# Get the long description from the README file +with open(path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() + +setup( + name='PyTMM', + + # Versions should comply with PEP440. For a discussion on single-sourcing + # the version across setup.py and the project code, see + # https://packaging.python.org/en/latest/single_source_version.html + version='1.0.0-a0', + + description='Implementation of the transfer matrix method', + long_description=long_description, + + url='https://github.com/kitchenknif/PyTMM', + + author='Pavel Dmitriev', + author_email='pavel.a.dmitriev@gmail.com', + + license='GPLv3+', + + classifiers=[ + 'Development Status :: 5 - Production/Stable', + + 'Intended Audience :: Science/Research', + 'Topic :: Scientific/Engineering :: Physics', + + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + ], + keywords='', + + packages=find_packages(exclude=['contrib', 'docs', 'tests']), + + install_requires=['numpy', 'scipy', 'pyyaml'], + + extras_require={}, + package_data={}, + data_files=[], + entry_points={}, +)