From 02d70502e2449aaada0beca50872b388ed3fb098 Mon Sep 17 00:00:00 2001 From: Nicolas Aunai Date: Wed, 1 May 2024 09:22:45 +0200 Subject: [PATCH 1/3] update readme --- README.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cfb7f25..2fbb6e6 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# space +# SPOK -[![PyPI](https://img.shields.io/pypi/v/space)](https://pypi.python.org/pypi/space) -[![Tests](https://github.com/LaboratoryOfPlasmaPhysics/space/actions/workflows/test_main.yml/badge.svg)](https://github.com/LaboratoryOfPlasmaPhysics/space/actions/workflows/test_main.yml) -[![Documentation Status](https://readthedocs.org/projects/space/badge/?version=latest)](https://space.readthedocs.io/en/latest/?badge=latest) -[![Coverage Status](https://codecov.io/gh/LaboratoryOfPlasmaPhysics/space/branch/main/graph/badge.svg?branch=main)](https://codecov.io/gh/LaboratoryOfPlasmaPhysics/space/branch/main) +[![PyPI](https://img.shields.io/pypi/v/spok)](https://pypi.python.org/pypi/spok) +[![Tests](https://github.com/LaboratoryOfPlasmaPhysics/spok/actions/workflows/test_main.yml/badge.svg)](https://github.com/LaboratoryOfPlasmaPhysics/spok/actions/workflows/test_main.yml) +[![Documentation Status](https://readthedocs.org/projects/spok/badge/?version=latest)](https://spok.readthedocs.io/en/latest/?badge=latest) +[![Coverage Status](https://codecov.io/gh/LaboratoryOfPlasmaPhysics/spok/branch/main/graph/badge.svg?branch=main)](https://codecov.io/gh/LaboratoryOfPlasmaPhysics/spok/branch/main) -Space Plasma Analysis CodE +spok Plasma Observations Kit -![space](https://user-images.githubusercontent.com/3200931/98716891-978e2180-238c-11eb-9487-07c66221e5bb.png) +![spok](https://user-images.githubusercontent.com/3200931/98716891-978e2180-238c-11eb-9487-07c66221e5bb.png) * Free software: GNU General Public License v3 -* Documentation: https://space.readthedocs.io. +* Documentation: https://spok.readthedocs.io. ## Features @@ -19,7 +19,3 @@ Space Plasma Analysis CodE ## TODO -## Credits - - -This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template. From b34d1f5a5fa895c87ee1c446d7a8d5bcb6dc831e Mon Sep 17 00:00:00 2001 From: Nicolas Aunai Date: Wed, 1 May 2024 09:37:10 +0200 Subject: [PATCH 2/3] rename package --- CONTRIBUTING.rst | 22 ++++---- docs/Makefile | 2 +- docs/conf.py | 62 ++++++++++------------ pyproject.toml | 8 +-- setup.cfg | 2 +- space/__init__.py | 5 -- spok/__init__.py | 5 ++ {space => spok}/analysis/mva.py | 0 {space => spok}/coordinates/__init__.py | 0 {space => spok}/coordinates/coordinates.py | 0 {space => spok}/data/__init__.py | 0 {space => spok}/models/__init__.py | 0 {space => spok}/models/planetary.py | 0 {space => spok}/plot/__init__.py | 0 {space => spok}/plot/planet_env.py | 0 {space => spok}/smath.py | 0 space/space.py => spok/spok.py | 0 {space => spok}/utils.py | 0 tests/__init__.py | 2 +- tests/{test_space.py => test_spok.py} | 53 +++++++++--------- tox.ini | 2 +- 21 files changed, 80 insertions(+), 83 deletions(-) delete mode 100644 space/__init__.py create mode 100644 spok/__init__.py rename {space => spok}/analysis/mva.py (100%) rename {space => spok}/coordinates/__init__.py (100%) rename {space => spok}/coordinates/coordinates.py (100%) rename {space => spok}/data/__init__.py (100%) rename {space => spok}/models/__init__.py (100%) rename {space => spok}/models/planetary.py (100%) rename {space => spok}/plot/__init__.py (100%) rename {space => spok}/plot/planet_env.py (100%) rename {space => spok}/smath.py (100%) rename space/space.py => spok/spok.py (100%) rename {space => spok}/utils.py (100%) rename tests/{test_space.py => test_spok.py} (60%) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 299906f..7b0add5 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -15,7 +15,7 @@ Types of Contributions Report Bugs ~~~~~~~~~~~ -Report bugs at https://github.com/nicolasaunai/space/issues. +Report bugs at https://github.com/LaboratoryOfPlasmaPhysics/spok. If you are reporting a bug, please include: @@ -38,14 +38,14 @@ and "help wanted" is open to whoever wants to implement it. Write Documentation ~~~~~~~~~~~~~~~~~~~ -space could always use more documentation, whether as part of the -official space docs, in docstrings, or even on the web in blog posts, +`spok` could always use more documentation, whether as part of the +official `spok` docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ -The best way to send feedback is to file an issue at https://github.com/nicolasaunai/space/issues. +The best way to send feedback is to file an issue at https://github.com/LaboratoryOfPlasmaPhysics/spok If you are proposing a feature: @@ -59,15 +59,15 @@ Get Started! Ready to contribute? Here's how to set up `space` for local development. -1. Fork the `space` repo on GitHub. +1. Fork the `spok` repo on GitHub. 2. Clone your fork locally:: - $ git clone git@github.com:your_name_here/space.git + $ git clone git@github.com:your_name_here/spok.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: - $ mkvirtualenv space - $ cd space/ + $ mkvirtualenv spok + $ cd spok/ $ python setup.py develop 4. Create a branch for local development:: @@ -79,7 +79,7 @@ Ready to contribute? Here's how to set up `space` for local development. 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: - $ flake8 space tests + $ flake8 spok tests $ python setup.py test or pytest $ tox @@ -103,7 +103,7 @@ Before you submit a pull request, check that it meets these guidelines: your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check - https://travis-ci.com/nicolasaunai/space/pull_requests + https://github.com/LaboratoryOfPlasmaPhysics/spok/pulls and make sure that the tests pass for all supported Python versions. Tips @@ -112,7 +112,7 @@ Tips To run a subset of tests:: - $ python -m unittest tests.test_space + $ python -m unittest tests.test_spok Deploying --------- diff --git a/docs/Makefile b/docs/Makefile index 51ece33..57f81ac 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = python -msphinx -SPHINXPROJ = space +SPHINXPROJ = spok SOURCEDIR = . BUILDDIR = _build diff --git a/docs/conf.py b/docs/conf.py index df5ba8f..6c3d636 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# space documentation build configuration file, created by +# spok documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its @@ -19,9 +19,10 @@ # import os import sys -sys.path.insert(0, os.path.abspath('..')) -import space +sys.path.insert(0, os.path.abspath("..")) + +import spok # -- General configuration --------------------------------------------- @@ -31,22 +32,22 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'space' +project = "spok" copyright = "2020, Nicolas Aunai" author = "Nicolas Aunai" @@ -55,9 +56,9 @@ # the built documents. # # The short X.Y version. -version = space.__version__ +version = spok.__version__ # The full version, including alpha/beta/rc tags. -release = space.__version__ +release = spok.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -69,10 +70,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -83,7 +84,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "alabaster" # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the @@ -94,13 +95,13 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # -- Options for HTMLHelp output --------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'spacedoc' +htmlhelp_basename = "spokdoc" # -- Options for LaTeX output ------------------------------------------ @@ -109,15 +110,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -127,9 +125,7 @@ # (source start file, target name, title, author, documentclass # [howto, manual, or own class]). latex_documents = [ - (master_doc, 'space.tex', - 'space Documentation', - 'Nicolas Aunai', 'manual'), + (master_doc, "spok.tex", "spok Documentation", "Nicolas Aunai", "manual"), ] @@ -137,11 +133,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'space', - 'space Documentation', - [author], 1) -] +man_pages = [(master_doc, "spok", "spok Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------- @@ -150,13 +142,13 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'space', - 'space Documentation', - author, - 'space', - 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "spok", + "spok Documentation", + author, + "spok", + "One line description of project.", + "Miscellaneous", + ), ] - - - diff --git a/pyproject.toml b/pyproject.toml index af7b67a..4a4c943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,10 +3,10 @@ build-backend = "flit_core.buildapi" requires = ["flit_core"] [project] -name = "space" +name = "spok" version = "0.1.0" -description = "Space Plasma Analysis CodE" -keywords = ["space", "plasma-physics"] +description = "Space Plasmas Observations Kit" +keywords = ["spok", "plasma-physics"] authors = [ { name = "Nicolas Aunai", email = "nicolas.aunai@lpp.polytechnique.fr" } ] @@ -33,6 +33,6 @@ classifiers = [ ] dependencies = ["pandas", "numpy", "matplotlib", "scipy"] [project.urls] -homepage = "https://github.com/LaboratoryOfPlasmaPhysics/space" +homepage = "https://github.com/LaboratoryOfPlasmaPhysics/spok" diff --git a/setup.cfg b/setup.cfg index efa50fb..e0b94ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ tag = True search = version = "{current_version}" replace = version = "{new_version}" -[bumpversion:file:space/__init__.py] +[bumpversion:file:spok/__init__.py] search = __version__ = '{current_version}' replace = __version__ = '{new_version}' diff --git a/space/__init__.py b/space/__init__.py deleted file mode 100644 index 52706f6..0000000 --- a/space/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Top-level package for space.""" - -__author__ = """Nicolas Aunai""" -__email__ = 'nicolas.aunai@lpp.polytechnique.fr' -__version__ = '0.1.0' diff --git a/spok/__init__.py b/spok/__init__.py new file mode 100644 index 0000000..37c0735 --- /dev/null +++ b/spok/__init__.py @@ -0,0 +1,5 @@ +"""Top-level package for spok.""" + +__author__ = """Nicolas Aunai""" +__email__ = "nicolas.aunai@lpp.polytechnique.fr" +__version__ = "0.1.0" diff --git a/space/analysis/mva.py b/spok/analysis/mva.py similarity index 100% rename from space/analysis/mva.py rename to spok/analysis/mva.py diff --git a/space/coordinates/__init__.py b/spok/coordinates/__init__.py similarity index 100% rename from space/coordinates/__init__.py rename to spok/coordinates/__init__.py diff --git a/space/coordinates/coordinates.py b/spok/coordinates/coordinates.py similarity index 100% rename from space/coordinates/coordinates.py rename to spok/coordinates/coordinates.py diff --git a/space/data/__init__.py b/spok/data/__init__.py similarity index 100% rename from space/data/__init__.py rename to spok/data/__init__.py diff --git a/space/models/__init__.py b/spok/models/__init__.py similarity index 100% rename from space/models/__init__.py rename to spok/models/__init__.py diff --git a/space/models/planetary.py b/spok/models/planetary.py similarity index 100% rename from space/models/planetary.py rename to spok/models/planetary.py diff --git a/space/plot/__init__.py b/spok/plot/__init__.py similarity index 100% rename from space/plot/__init__.py rename to spok/plot/__init__.py diff --git a/space/plot/planet_env.py b/spok/plot/planet_env.py similarity index 100% rename from space/plot/planet_env.py rename to spok/plot/planet_env.py diff --git a/space/smath.py b/spok/smath.py similarity index 100% rename from space/smath.py rename to spok/smath.py diff --git a/space/space.py b/spok/spok.py similarity index 100% rename from space/space.py rename to spok/spok.py diff --git a/space/utils.py b/spok/utils.py similarity index 100% rename from space/utils.py rename to spok/utils.py diff --git a/tests/__init__.py b/tests/__init__.py index 8fcbfd0..830ec96 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Unit test package for space.""" +"""Unit test package for spok.""" diff --git a/tests/test_space.py b/tests/test_spok.py similarity index 60% rename from tests/test_space.py rename to tests/test_spok.py index d75c388..26c4435 100644 --- a/tests/test_space.py +++ b/tests/test_spok.py @@ -1,24 +1,31 @@ #!/usr/bin/env python -"""Tests for `space` package.""" +"""Tests for `spok` package.""" import unittest from ddt import data, unpack, ddt -from space.models.planetary import Magnetosheath +from spok.models.planetary import Magnetosheath import numpy as np -from space import space +from spok import spok + @ddt class TestMagnetosheath(unittest.TestCase): - """Tests for `space` package.""" + """Tests for `spok` package.""" def setUp(self): """Set up test fixtures, if any.""" - self.typical_msh = Magnetosheath(magnetopause="mp_shue1998", bow_shock="bs_jelinek2012") - theta = np.arange(0, np.pi/2, 0.01*np.pi) - self.typical_mp_sph, self.typical_bs_sph = self.typical_msh.boundaries(theta, 0, coord_sys = "spherical") - self.typical_mp_cart, self.typical_bs_cart = self.typical_msh.boundaries(theta, 0, coord_sys = "cartesian") + self.typical_msh = Magnetosheath( + magnetopause="mp_shue1998", bow_shock="bs_jelinek2012" + ) + theta = np.arange(0, np.pi / 2, 0.01 * np.pi) + self.typical_mp_sph, self.typical_bs_sph = self.typical_msh.boundaries( + theta, 0, coord_sys="spherical" + ) + self.typical_mp_cart, self.typical_bs_cart = self.typical_msh.boundaries( + theta, 0, coord_sys="cartesian" + ) def tearDown(self): """Tear down test fixtures, if any.""" @@ -27,46 +34,44 @@ def test_magnetosheath_can_be_constructed(self): """Test something.""" self.assertIsNotNone(self.typical_msh) - - - @data(("bs_shue1998", "mp_formisano1979"), #both wrong - ("mp_shue1998", "mp_formisano1979")) # bow shock wrong + @data( + ("bs_shue1998", "mp_formisano1979"), # both wrong + ("mp_shue1998", "mp_formisano1979"), + ) # bow shock wrong @unpack def test_msh_invalid_boundaries_raise(self, mp, bs): """Test something.""" - self.assertRaises(ValueError, Magnetosheath, magnetopause=mp, - bow_shock=bs) - + self.assertRaises(ValueError, Magnetosheath, magnetopause=mp, bow_shock=bs) @data("mp_formisano1979", "mp_shue1998") def test_mp_nose_are_in_expected_dayside_region(self, mp): msh = Magnetosheath(magnetopause=mp, bow_shock="bs_formisano1979") - x,y,z = msh.magnetopause(0,0) + x, y, z = msh.magnetopause(0, 0) self.assertGreater(x, 5) self.assertLess(x, 15) - @data("bs_formisano1979", "bs_jerab2005") def test_mp_nose_are_in_expected_dayside_region(self, bs): msh = Magnetosheath(magnetopause="mp_formisano1979", bow_shock=bs) - x,y,z = msh.bow_shock(0,0) + x, y, z = msh.bow_shock(0, 0) self.assertGreater(x, 7) self.assertLess(x, 30) - def test_spherical_and_cartesian_are_consistent(self): - for model_sph, model_cart in zip((self.typical_mp_sph, self.typical_bs_sph), - (self.typical_mp_cart, self.typical_bs_cart)): - rfromcart = np.sqrt(model_cart[0]**2 + model_cart[1]**2+ model_cart[2]**2) + for model_sph, model_cart in zip( + (self.typical_mp_sph, self.typical_bs_sph), + (self.typical_mp_cart, self.typical_bs_cart), + ): + rfromcart = np.sqrt( + model_cart[0] ** 2 + model_cart[1] ** 2 + model_cart[2] ** 2 + ) np.testing.assert_allclose(rfromcart, model_sph[0], atol=1e-12) - def test_msh_return_mp_and_bs(self): rmp = self.typical_mp_sph[0] rbs = self.typical_bs_sph[0] np.testing.assert_array_less(rmp, rbs) - def test_non_regression(self): pass # read expected values in pickle file diff --git a/tox.ini b/tox.ini index 3785d2c..c929ef6 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ python = [testenv:flake8] basepython = python deps = flake8 -commands = flake8 space --count --select=E9,F63,F7,F82 --show-source --statistics +commands = flake8 spok --count --select=E9,F63,F7,F82 --show-source --statistics [testenv] From fd9a5369525d118d083a436b91cccb7e29a6c02e Mon Sep 17 00:00:00 2001 From: Nicolas Aunai Date: Wed, 1 May 2024 13:24:56 +0200 Subject: [PATCH 3/3] fix --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d3d522e..654c5b3 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ clean-test: ## remove test and coverage artifacts rm -fr .pytest_cache lint: ## check style with flake8 - flake8 space tests + flake8 spok tests test: ## run tests quickly with the default Python python setup.py test @@ -57,15 +57,15 @@ test-all: ## run tests on every Python version with tox tox coverage: ## check code coverage quickly with the default Python - coverage run --source space setup.py test + coverage run --source spok setup.py test coverage report -m coverage html $(BROWSER) htmlcov/index.html docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/space.rst + rm -f docs/spok.rst rm -f docs/modules.rst - sphinx-apidoc -o docs/ space + sphinx-apidoc -o docs/ spok $(MAKE) -C docs clean $(MAKE) -C docs html $(BROWSER) docs/_build/html/index.html