Commit 6e40930d authored by Kloss's avatar Kloss

rename kwant-spectrum to kwantspectrum

parent 069a5c5b
......@@ -2,8 +2,8 @@
omit =
*tests*
*__init__*
kwant_spectrum/_kwant_spectrum_version.py
kwant_spectrum/version.py
kwantspectrum/_kwant_spectrum_version.py
kwantspectrum/version.py
branch = True
[report]
exclude_lines =
......
......@@ -4,4 +4,5 @@ __pycache__/
/doc/build/
*~
.coverage
*.egg-info/
The Kwant-Spectrum authors can be reached at tkwant-authors@kwant-project.org.
Kwant-Spectrum has been developed by
* Thomas Kloss (CEA Grenoble)
Contributors
* Christoph Groth (CEA Grenoble)
* Xavier Waintal (CEA Grenoble)
(CEA = Commissariat à l'énergie atomique et aux énergies alternatives)
Installation
============
This section covers the installation of Kwant_Spectrum on a GNU/Linux
system as Debian and Ubuntu via the command line.
Requirements
^^^^^^^^^^^^
Kwant_Spectrum has following non-Python dependency:
- `Kwant <https://kwant-project.org/>`_
The non-Python dependencies of Kwant_Spectrum can be installed with the following command::
sudo apt-add-repository -s ppa:kwant-project/ppa
sudo apt-get update
sudo apt-get install python3-kwant
Kwant_Spectrum requires at least Python 3.5. The following packages must
be installed to build Kwant_Spectrum:
- `NumPy <https://numpy.org/>`_
- `SciPy <https://www.scipy.org/>`_
Most packages can be installed from the command line
by the standard Python package manager `pip <https://pip.pypa.io/en/stable/>`_ via::
sudo pip3 install numpy scipy
The *pip* command can be also used within the Anaconda Python distribution,
see the instructions for `Conda <#conda>`__.
For version requirements we refer to the *requirements* section in
:download:`setup.py <../../../setup.py>`.
Testing requirements
--------------------
The Kwant_Spectrum test suite requires the following Python packages:
- `pytest <https://docs.pytest.org/en/latest/>`_
- `pytest-cov <https://pytest-cov.readthedocs.io/en/latest/>`_
- `pytest-flake8 <https://pypi.org/project/pytest-flake8/>`_
The packages can be installed by the standard *pip* command::
sudo pip3 install pytest pytest-cov pytest-flake8
Documentation requirements
--------------------------
The Kwant_Spectrum test suite requires the following Python packages:
- `sphinx <https://www.sphinx-doc.org/en/master/>`_
- `jupyter-sphinx <https://jupyter-sphinx.readthedocs.io/en/latest/>`_
The packages can be installed by the standard *pip* command::
sudo pip3 install sphinx jupyter-sphinx
Installating Kwant_Spectrum
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Kwant_Spectrum can be installed with pip via::
sudo pip3 install kwant_spectrum
Building Kwant_Spectrum for development
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For development, Kwant_Spectrum should first be cloned from the official repository::
git clone https://gitlab.kwant-project.org/kwant/spectrum.git
Then, after *cd* into the local repository,
one can locally build kwant_spectrum with the command::
python3 setup.py build_ext -i
Conda
^^^^^
.. _conda:
Kwant_Spectrum provides no dedicated Anaconda support. It is however possible to
install packages via *pip* and *git* similarly with conda.
First, *pip* and *git* must be installed for conda with::
conda install git pip
Kwant-Spectrum can then be installed with the commands given above.
======================
Kwant-Spectrum license
======================
=====================
kwantSpectrum license
=====================
Copyright 2018-2019 T. Kloss (CEA), C. W. Groth (CEA), X. Waintal (CEA),
and others.
......
include *.rst
include test_*.py
include .coveragerc
include LICENSE.rst
include MANIFEST.in
include README.rst
include doc/Makefile
include doc/source/about.rst
include doc/source/conf.py
include doc/source/*.rst
include doc/source/index.rst
include doc/source/kwantdoctheme/static/kwantdoctheme.css
include doc/source/kwantdoctheme/theme.conf
include doc/source/reference.rst
include doc/source/tutorial.rst
include kwantspectrum/__init__.py
include kwantspectrum/_kwant_spectrum_version.py
include kwantspectrum/kwant_spectrum.py
include kwantspectrum/tests/__init__.py
include kwantspectrum/tests/test_kwant_spectrum.py
include kwantspectrum/version.py
include pytest.ini
include setup.py
About Kwant-Spectrum
====================
About kwantSpectrum
===================
Kwant-Spectrum is an extension to `Kwant <http://kwant-project.org/>`__ that
kwantSpectrum is an extension to `Kwant <http://kwant-project.org/>`__ that
adaptively analyzes band structures of infinite quasi-1d systems. The
bandstructure is approximated to an arbitrary precision by piecewise cubic
polynomials. Functionality to deal with special points, intervals, and the
periodic nature of the spectrum is provided.
Kwant_Spectrum is distributed under the `2-clause BSD license <https://gitlab.kwant-project.org/kwant/spectrum/-/blob/master/LICENSE.rst>`_
kwantSpectrum is distributed under the `2-clause BSD license <https://gitlab.kwant-project.org/kwant/kwantspectrum/-/blob/master/LICENSE.rst>`_
Website: https://kwant-project.org/extensions/spectrum
Website: https://kwant-project.org/extensions/kwantspectrum
Source code: https://gitlab.kwant-project.org/kwant/spectrum
Source code: https://gitlab.kwant-project.org/kwant/kwantspectrum
Installation
############
This section covers the installation of Kwant_Spectrum on a GNU/Linux
This section covers the installation of kwantSpectrum on a GNU/Linux
system as Debian and Ubuntu via the command line.
Requirements
^^^^^^^^^^^^
Kwant_Spectrum has following non-Python dependency:
kwantSpectrum has following non-Python dependency:
- `Kwant <https://kwant-project.org/>`__
The non-Python dependencies of Kwant_Spectrum can be installed with the following command::
Kwant can be installed with the following command::
sudo apt-add-repository -s ppa:kwant-project/ppa
sudo apt-get update
sudo apt-get install python3-kwant
Kwant_Spectrum requires at least Python 3.5. The following packages must
be installed to build Kwant_Spectrum:
kwantSpectrum requires at least Python 3.5. The following packages must
be installed to build kwantSpectrum:
- `NumPy <https://numpy.org/>`_
- `SciPy <https://www.scipy.org/>`_
......@@ -48,7 +48,7 @@ by the standard Python package manager `pip <https://pip.pypa.io/en/stable/>`_ v
Testing requirements
--------------------
The Kwant_Spectrum test suite requires the following Python packages:
The kwantSpectrum test suite requires the following Python packages:
- `pytest <https://docs.pytest.org/en/latest/>`_
- `pytest-cov <https://pytest-cov.readthedocs.io/en/latest/>`_
......@@ -61,35 +61,31 @@ The packages can be installed by the standard *pip* command::
Documentation requirements
--------------------------
The Kwant_Spectrum test suite requires the following Python packages:
Building the documentation requires the following Python packages:
- `matplotlib <https://matplotlib.org/>`_
- `sphinx <https://www.sphinx-doc.org/en/master/>`_
- `jupyter-sphinx <https://jupyter-sphinx.readthedocs.io/en/latest/>`_
The packages can be installed by the standard *pip* command::
sudo pip3 install sphinx jupyter-sphinx
sudo pip3 install matplotlib sphinx jupyter-sphinx
Building Kwant_Spectrum
^^^^^^^^^^^^^^^^^^^^^^^
Building kwantSpectrum
^^^^^^^^^^^^^^^^^^^^^^
Kwant-Spectrum can be installed from PyPI with::
kwantSpectrum can be installed from PyPI with::
sudo pip3 install kwant_spectrum
sudo pip3 install kwantspectrum
Alternatively, it can be installed directly from the source code repository::
sudo pip3 install git+https://gitlab.kwant-project.org/kwant/spectrum.git
sudo pip3 install git+https://gitlab.kwant-project.org/kwant/kwantspectrum.git
For development, Kwant_Spectrum should first be cloned from the official repository::
For development, kwantSpectrum can be cloned from the official repository with::
git clone https://gitlab.kwant-project.org/kwant/spectrum.git
Then, after *cd* into the local repository,
one can locally build kwant_spectrum with the command::
python3 setup.py build
git clone https://gitlab.kwant-project.org/kwant/kwantspectrum.git
Test suite
----------
......@@ -116,7 +112,20 @@ Documentation
Full documentation including a tutorial:
- https://kwant-project.org/extensions/spectrum
- https://kwant-project.org/extensions/kwantspectrum
Communication
#############
The kwant-discuss mailing list is the main communication channel for
questions and discussions around kwantSpectrum. Searching and using the mailing list
is explained in section
`mailing list <https://kwant-project.org/community#mailing-list>`_.
- Mailing list: kwant-discuss@kwant-project.org
In addition, the authors can be reached by email, see below.
Contributing
......@@ -132,16 +141,16 @@ a new merge request.
License
#######
Kwant_Spectrum distributed under BSD license, see ``LICENSE.rst`` in the
project repository.
kwantSpectrum is distributed under BSD license, see the file ``LICENSE.rst``
in the project repository.
Authors
#######
The principle developer of Kwant-Spectrum is:
The principle developer of kwantSpectrum is:
* Thomas Kloss (CEA Grenoble)
* Thomas Kloss (CEA Grenoble), kloss@itp.uni-frankfurt.de
Contributors to the project are:
......
......@@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = kwant-spectrum
SPHINXPROJ = kwantspectrum
SOURCEDIR = source
BUILDDIR = build
......
......@@ -13,14 +13,16 @@
# -- Project information -----------------------------------------------------
project = 'kwant-spectrum'
project = 'kwantspectrum'
copyright = '2018-2019, T. Kloss, C. W. Groth, X. Waintal, et al.'
author = 'T. Kloss, C. W. Groth, X. Waintal, et al.'
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.0'
# The full version, including alpha/beta/rc tags.
import kwantspectrum
release = kwantspectrum.__version__
# The short X.Y version.
version = release[:len(release) - len(release.lstrip('012345679.'))].rstrip('.')
# -- General configuration ---------------------------------------------------
......@@ -100,7 +102,7 @@ html_static_path = []
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'kwant-spectrumdoc'
htmlhelp_basename = 'kwantspectrumdoc'
# -- Options for LaTeX output ------------------------------------------------
......@@ -127,7 +129,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'kwant-spectrum.tex', 'kwant-spectrum Documentation',
(master_doc, 'kwantspectrum.tex', 'kwantspectrum Documentation',
'T. Kloss, C. W. Groth, X. Waintal, et al.', 'manual'),
]
......@@ -137,7 +139,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'kwant-spectrum', 'kwant-spectrum Documentation',
(master_doc, 'kwantspectrum', 'kwantspectrum Documentation',
[author], 1)
]
......@@ -148,8 +150,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'kwant-spectrum', 'kwant-spectrum Documentation',
author, 'kwant-spectrum', 'One line description of project.',
(master_doc, 'kwantspectrum', 'kwantspectrum Documentation',
author, 'kwantspectrum', 'One line description of project.',
'Miscellaneous'),
]
......
Kwant-Spectrum |release| documentation
======================================
kwantSpectrum |release| documentation
=====================================
.. toctree::
:maxdepth: 2
......
:mod:`kwant_spectrum` -- Reference documentation
================================================
:mod:`kwantspectrum` -- Reference documentation
===============================================
.. automodule:: kwant_spectrum
.. automodule:: kwantspectrum
:members:
Kwant-Spectrum tutorial
=======================
kwantSpectrum tutorial
======================
For many situations we need to calculate and analyze the band structure
of a semi-infinite lead. In the following we will look at a simple toy
......@@ -83,7 +83,7 @@ A much more convenient method for examining the spectrum is the
.. jupyter-execute::
import kwant_spectrum as ks
import kwantspectrum as ks
spec = ks.spectrum(lead)
......@@ -505,12 +505,6 @@ the number evaluation points used internally.
print('tolerance= {}, number of points= {}'.format(tol, len(spec.x)))
.. parsed-literal::
tolerance= 0.0001, number of points= 57
tolerance= 1e-08, number of points= 533
Note that ``tol`` affects both the matching and the interpolation step.
First, if the tolerance becomes too large, the internally used matching
algorithm (see ``_match_functions`` below) may no longer be able to
......
# Copyright 2018-2020 Kwant-Spectrum authors.
# Copyright 2018-2020 kwantspectrum authors.
#
# This file is part of Kwant-Spectrum. It is subject to the license terms in
# This file is part of kwantspectrum. It is subject to the license terms in
# the file LICENSE.rst found in the top-level directory of this distribution.
from . import version
__all__ = []
from . import version, kwant_spectrum
version.ensure_python()
__version__ = version.version
__all__ = []
for module in ('kwant_spectrum', ):
exec('from . import {0}'.format(module))
__all__.append(module)
available = [
('kwant_spectrum', kwant_spectrum.__all__)
]
......@@ -21,3 +17,4 @@ available = [
for module, names in available:
exec('from .{0} import {1}'.format(module, ', '.join(names)))
__all__.extend(names)
# Copyright 2018-2020 Kwant-Spectrum authors.
# Copyright 2018-2020 kwantspectrum authors.
#
# This file is part of Kwant-Spectrum. It is subject to the license terms in
# This file is part of kwantspectrum. It is subject to the license terms in
# the file LICENSE.rst found in the top-level directory of this distribution.
from functools import partial, wraps
......
# Copyright 2018-2020 Kwant-Spectrum authors.
# Copyright 2018-2020 kwantspectrum authors.
#
# This file is part of Kwant-Spectrum. It is subject to the license terms in
# This file is part of kwantspectrum. It is subject to the license terms in
# the file LICENSE.rst found in the top-level directory of this distribution.
from functools import partial
......
# Copyright 2018-2020 Kwant-Spectrum authors.
# Copyright 2018-2020 kwantspectrum authors.
#
# This file is part of Kwant-Spectrum. It is subject to the license terms in
# This file is part of kwantspectrum. It is subject to the license terms in
# the file LICENSE.rst found in the top-level directory of this distribution.
import sys
......
[pytest]
# add coverage report, source analyzer, and pep8 compliance checks
addopts = --cov=kwant_spectrum --cov-config=.coveragerc --flake8
testpaths = kwant_spectrum
addopts = --cov=kwantspectrum --cov-config=.coveragerc --flake8
testpaths = kwantspectrum
flake8-ignore =
E501 # lines too long
W503 # line break before binary operator
kwant_spectrum/kwant_spectrum.py E722 # do not use bare 'except'
kwant_spectrum/__init__.py ALL # __version__ import confuse flakes
kwantspectrum/kwant_spectrum.py E722 # do not use bare 'except'
kwantspectrum/__init__.py ALL # __version__ import confuse flakes
#!/usr/bin/env python3
from setuptools import setup, find_packages
import os
import importlib
import subprocess
from setuptools import setup, find_packages
from distutils.command.build import build as build_orig
from setuptools.command.sdist import sdist as sdist_orig
STATIC_VERSION_PATH = ('kwantspectrum', '_kwant_spectrum_version.py')
distr_root = os.path.dirname(os.path.abspath(__file__))
# Get the long description from the README file.
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
def check_versions():
global version, version_is_from_git
# Let kwant-spectrum itself determine its own version.
# We cannot simply import kwant-spectrum, as it is not built yet.
spec = importlib.util.spec_from_file_location('version', 'kwant_spectrum/version.py')
# Let kwantspectrum itself determine its own version.
# We cannot simply import kwantspectrum, as it is not built yet.
spec = importlib.util.spec_from_file_location('version', 'kwantspectrum/version.py')
version_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version_module)
version_module.ensure_python()
return version_module.version
version = version_module.version
version_is_from_git = version_module.version_is_from_git
def write_version(fname):
# This could be a hard link, so try to delete it first. Is there any way
# to do this atomically together with opening?
try:
os.remove(fname)
except OSError:
pass
with open(fname, 'w') as f:
f.write("# This file has been created by setup.py.\n")
f.write("version = '{}'\n".format(version))
class build(build_orig):
def run(self):
super().run()
write_version(os.path.join(self.build_lib, *STATIC_VERSION_PATH))
def git_lsfiles():
if not version_is_from_git:
return
try:
p = subprocess.Popen(['git', 'ls-files'], cwd=distr_root,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except OSError:
return
if p.wait() != 0:
return
return p.communicate()[0].decode().split('\n')[:-1]
# Make the command "sdist" depend on "build". This verifies that the
# distribution in the current state actually builds. It also makes sure that
# the Cython-made C files will be up-to-date and included in the source.
class sdist(sdist_orig):
sub_commands = [('build', None)] + sdist_orig.sub_commands
def run(self):
"""Create MANIFEST.in from git if possible, otherwise check that
MANIFEST.in is present.
Right now (2015) generating MANIFEST.in seems to be the only way to
include files in the source distribution that setuptools does not think
should be there. Setting include_package_data to True makes setuptools
include *.pyx and other source files in the binary distribution.
"""
manifest_in_file = 'MANIFEST.in'
manifest = os.path.join(distr_root, manifest_in_file)
names = git_lsfiles()
if names is None:
if not (os.path.isfile(manifest) and os.access(manifest, os.R_OK)):
print("Error:", manifest_in_file,
"file is missing and Git is not available"
" to regenerate it.", file=sys.stderr)
sys.exit(1)
else:
with open(manifest, 'w') as f:
for name in names:
a, sep, b = name.rpartition('/')
if b == '.gitignore':
continue
stem, dot, extension = b.rpartition('.')
f.write('include {}'.format(name))
if extension == 'pyx':
f.write(''.join([' ', a, sep, stem, dot, 'c']))
f.write('\n')
super().run()
if names is None:
msg = ("Git was not available to generate the list of files to be "
"included in the\nsource distribution. The old {} was used.")
msg = msg.format(manifest_in_file)
print(banner(' Caution '), msg, banner(), sep='\n', file=sys.stderr)
def make_release_tree(self, base_dir, files):
super().make_release_tree(base_dir, files)
write_version(os.path.join(base_dir, *STATIC_VERSION_PATH))
def main():
version = check_versions()
check_versions()
setup(
name='kwant-spectrum',
name='kwantspectrum',
version=version,
description='Adaptive band structure analyzer for Kwant leads',
long_description=long_description,
url='https://gitlab.kwant-project.org/kwant/spectrum',
url='https://gitlab.kwant-project.org/kwant/kwantspectrum',
author='T. Kloss, C. W. Groth, X. Waintal, et al.',
author_email='kloss@itp.uni-frankfurt.de',
classifiers=[
......@@ -41,9 +137,11 @@ def main():
],
keywords='physics kwant bandstructure',
packages=find_packages('.'),
cmdclass={'build': build,
'sdist': sdist},
python_requires='>=3.5',
install_requires=['kwant >= 1.4', 'numpy', 'scipy'],
extras_require={'test': ['pytest'],},
extras_require={'test': ['pytest', 'pytest-cov', 'pytest-flake8'], },
)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment