Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
26d1fed
Remove use of deprecated NumPy np.float
hakonanes May 12, 2022
886b62a
Update contributors list (add and sort)
hakonanes May 12, 2022
2c23aa0
Update license identifier to GPLv3+, temp. set orix==0.9.0rc2
hakonanes May 12, 2022
a7d422c
Minor cosmetic updates to CI build config file
hakonanes May 12, 2022
7883b8a
Update CI publish workflow file to use PyPI tokens
hakonanes May 12, 2022
ad99da6
Bump release to 0.5.0rc1
hakonanes May 12, 2022
98e5136
Add contributors file for Zenodo, add TODO in PR template
hakonanes May 15, 2022
01667ce
Revert minimal orix version to 0.5
hakonanes May 18, 2022
30e7bc4
Remove use of "convention" parameter in Rotation.from_euler()
hakonanes May 18, 2022
d2e06dc
Update API reference locations of dependencies, linkcode_resolve()
hakonanes May 18, 2022
e4ff1c5
Update "Unreleased" in changelog
hakonanes May 18, 2022
e6ddee2
Bump min. version of orix to 0.9 due to changes in from_euler()
hakonanes May 19, 2022
cfe7345
Test DiffractionSimulation.size
hakonanes May 19, 2022
1180b4b
Touch up imports in rotation list generators file
hakonanes May 20, 2022
7c010b0
Revert "Touch up imports in rotation list generators file"
hakonanes May 20, 2022
64910fa
Update date in changelog
hakonanes May 27, 2022
0e33b12
Merge branch 'master' into prepare-0.5.0-release
pc494 May 31, 2022
e5e0ec4
Merge branch 'master' into prepare-0.5.0-release
hakonanes Jun 1, 2022
a385b07
Merge branch 'prepare-0.5.0-release' of github.com:hakonanes/diffsims…
hakonanes Jun 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
- [ ] New functions are imported in corresponding `__init__.py`.
- [ ] New features, API changes, and deprecations are mentioned in the
unreleased section in `CHANGELOG.rst`.
- [ ] Contributor(s) are listed correctly in `credits` in `diffsims/release_info.py` and
in `.zenodo.json`.
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install dependencies
run: pip install manifix

- name: Check MANIFEST.in file
run: python setup.py manifix

Expand All @@ -31,31 +34,39 @@ jobs:
- os: ubuntu-latest
python-version: 3.6
OLDEST_SUPPORTED_VERSION: true
# orix requires matplotlib 3.3, matplotlib 3.3 requires numpy 1.15
# numba requires scipy==1.0
DEPENDENCIES: diffpy.structure==3.0.0 matplotlib==3.3 numpy==1.17 orix==0.5.0 scipy==1.0 tqdm==4.9
LABEL: -oldest
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Display Python and pip versions
run: python -V; pip -V
- name: Install depedencies and package
run: |
python -V
pip -V

- name: Install dependencies and package
shell: bash
run: pip install -U -e .'[tests]'

- name: Install oldest supported version
if: ${{ matrix.OLDEST_SUPPORTED_VERSION }}
run: pip install ${{ matrix.DEPENDENCIES }}

- name: Display package versions
run: pip list

- name: Run tests
run: pytest --cov=diffsims --pyargs diffsims

- name: Generate line coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: coverage report --show-missing

- name: Upload coverage to Coveralls
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: AndreMiras/coveralls-python-action@develop
Expand Down
42 changes: 30 additions & 12 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,49 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow runs when a tagged release is created or it is triggered manually.
# For more information see:
# - Python docs: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# - GitHub action: https://github.com/marketplace/actions/pypi-publish
# - GitHub docs: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# The source distribution (sdist) is built with the `build` package
# (https://pypa-build.readthedocs.io/en/stable/index.html).
# The sdist is attempted uploaded to TestPyPI and PyPI whenever the workflow is run

name: Upload Python Package
name: Upload to PyPI

on:
release:
types: [published]
workflow_dispatch:
workflow: "*"

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
pip install build

- name: Build package
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python -m build

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
65 changes: 65 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"creators": [
{
"name": "Duncan Johnstone"
},
{
"name":"Phillip Crout",
"orcid": "0000-0001-5754-0938"
},
{
"name":"Håkon Wiik Ånes",
"orcid": "0000-0002-1213-2911",
"affiliation": "Norwegian University of Science and Technology"
},
{
"name":"Eric Prestat"
},
{
"name":"Rob Tovey"
},
{
"name":"Simon Høgås"
},
{
"name":"Ben Martineau"
},
{
"name":"Joonatan Laulainen"
},
{
"name":"Niels Cautaerts",
"orcid": "0000-0002-6402-9879"
},
{
"name":"Isabel Wood"
},
{
"name":"Sean Collins"
},
{
"name":"Stef Smeets"
},
{
"name":"Alex Borrelli"
},
{
"name": "Tiarnan Doherty"
},
{
"name":"Jedrzej Morzy"
},
{
"name":"Endre Jacobsen"
},
{
"name":"Tina Bergh"
},
{
"name":"Tomas Ostasevicius"
},
{
"name":"Eirik Opheim"
}
]
}
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0>`_
and this project adheres to `Semantic Versioning
<https://semver.org/spec/v2.0.0.html>`_.

Unreleased
==========
2022-05-30 - version 0.5.0
==========================

Added
-----
Expand All @@ -20,7 +20,7 @@ Added

Changed
-------
- Minimal version of dependencies numpy >= 1.17 and tqdm >= 4.9.
- Minimal version of dependencies orix >= 0.9, numpy >= 1.17 and tqdm >= 4.9.
- The Laue group representing the rotation list sampling of "hexagonal" from 6/m to
6/mmm.
- Loosened the angle tolerance in ``DiffractionLibrary.get_library_entry()`` from
Expand Down
2 changes: 1 addition & 1 deletion diffsims/crystallography/reciprocal_lattice_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
)


_FLOAT_EPS = np.finfo(np.float).eps # Used to round values below 1e-16 to zero
_FLOAT_EPS = np.finfo(float).eps # Used to round values below 1e-16 to zero


class ReciprocalLatticePoint:
Expand Down
10 changes: 5 additions & 5 deletions diffsims/generators/rotation_list_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_list_from_orix(grid, rounding=2):
rotation_list : list of tuples
A rotation list
"""
z = grid.to_euler(convention="bunge")
z = grid.to_euler()
rotation_list = z.data.tolist()
i = 0
while i < len(rotation_list):
Expand Down Expand Up @@ -122,7 +122,7 @@ def get_local_grid(resolution=2, center=None, grid_width=10):
"""
if isinstance(center, tuple):
z = np.deg2rad(np.asarray(center))
center = Rotation.from_euler(z, convention="bunge", direction="crystal2lab")
center = Rotation.from_euler(z)

orix_grid = get_sample_local(
resolution=resolution, center=center, grid_width=grid_width
Expand Down Expand Up @@ -153,11 +153,11 @@ def get_grid_around_beam_direction(beam_rotation, resolution, angular_range=(0,
Examples
--------
>>> from diffsims.generators.zap_map_generator import get_rotation_from_z_to_direction
>>> beam_rotation = get_rotation_from_z_to_direction(structure,[1,1,1])
>>> grid = get_grid_around_beam_direction(beam_rotation,1)
>>> beam_rotation = get_rotation_from_z_to_direction(structure, [1, 1, 1])
>>> grid = get_grid_around_beam_direction(beam_rotation, 1)
"""
z = np.deg2rad(np.asarray(beam_rotation))
beam_rotation = Rotation.from_euler(z, convention="bunge", direction="crystal2lab")
beam_rotation = Rotation.from_euler(z)

angles = np.deg2rad(
np.arange(start=angular_range[0], stop=angular_range[1], step=resolution)
Expand Down
25 changes: 14 additions & 11 deletions diffsims/release_info.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
name = "diffsims"
version = "0.5.dev0"
version = "0.5.0rc1"
author = "Duncan Johnstone, Phillip Crout"
copyright = "Copyright 2017-2022, The pyXem developers"
copyright = "Copyright 2017-2022, The diffsims developers"
# Initial committer first, then listed by line additions
credits = [
"Duncan Johnstone",
"Phillip Crout",
"Håkon Wiik Ånes",
"Eric Prestat",
"Rob Tovey",
"Simon Høgås",
"Ben Martineau",
"Isabel Wood",
"Håkon Wiik Ånes",
"Niels Cautaerts",
"Joonatan Laulainen",
"Stef Smeets",
"Isabel Wood",
"Sean Collins",
"Endre Jacobsen",
"Niels Cautaerts",
"Eric Prestat",
"Stef Smeets",
"Alex Borrelli",
"Tiarnan Doherty",
"Jedrzej Morzy",
"Tomas Ostasevicius",
"Alex Borrelli",
"Endre Jacobsen",
"Tina Bergh",
"Tomas Ostasevicius",
"Eirik Opheim",
]
license = "GPLv3"
license = "GPLv3+"
maintainer = "Duncan Johnstone, Phillip Crout, Håkon Wiik Ånes"
email = "pyxem.team@gmail.com"
status = "Development"
5 changes: 3 additions & 2 deletions diffsims/tests/generators/test_rotation_list_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with diffsims. If not, see <http://www.gnu.org/licenses/>.

import pytest
import numpy as np
import pytest

from diffsims.generators.rotation_list_generators import (
get_local_grid,
get_grid_around_beam_direction,
Expand Down Expand Up @@ -73,7 +74,7 @@ def test_get_grid_around_beam_direction():
],
)
def test_get_beam_directions_grid(crystal_system, mesh):
grid = get_beam_directions_grid(crystal_system, 5, mesh=mesh)
_ = get_beam_directions_grid(crystal_system, 5, mesh=mesh)


@pytest.mark.parametrize(
Expand Down
7 changes: 5 additions & 2 deletions diffsims/tests/sims/test_diffraction_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

import numpy as np
import pytest
from diffsims.sims.diffraction_simulation import DiffractionSimulation
from diffsims.sims.diffraction_simulation import ProfileSimulation

from diffsims.sims.diffraction_simulation import (
DiffractionSimulation, ProfileSimulation
)


def test_wrong_calibration_setting():
Expand Down Expand Up @@ -140,6 +142,7 @@ def test_addition(self, diffraction_simulation):
]
),
)
assert sim.size == 4

def test_extend(self, diffraction_simulation):
diffraction_simulation.extend(diffraction_simulation)
Expand Down
12 changes: 6 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import re
import sys

from diffsims import __author__, __version__, __file__
from diffsims import __author__, __file__, __version__

# -- Project information -----------------------------------------------------

Expand Down Expand Up @@ -50,11 +50,11 @@
# Create links to references within diffsims' documentation to these packages
intersphinx_mapping = {
"diffpy.structure": ("https://www.diffpy.org/diffpy.structure", None),
"matplotlib": ("https://matplotlib.org", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
"orix": ("https://orix.readthedocs.io/en/stable", None),
"python": ("https://docs.python.org/3", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
}

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -86,7 +86,7 @@ def linkcode_resolve(domain, info):
"""Determine the URL corresponding to Python object.

This is taken from SciPy's conf.py:
https://github.com/scipy/scipy/blob/master/doc/source/conf.py.
https://github.com/scipy/scipy/blob/develop/doc/source/conf.py.
"""
if domain != "py":
return None
Expand Down Expand Up @@ -131,12 +131,12 @@ def linkcode_resolve(domain, info):
fn = relpath(fn, start=startdir).replace(os.path.sep, "/")

if fn.startswith("diffsims/"):
m = re.match(r"^.*dev0\+([a-f0-9]+)$", __version__)
m = re.match(r"^.*dev0\+([a-f\d]+)$", __version__)
pre_link = "https://github.com/pyxem/diffsims/blob/"
if m:
return pre_link + "%s/%s%s" % (m.group(1), fn, linespec)
elif "dev" in __version__:
return pre_link + "master/%s%s" % (fn, linespec)
return pre_link + "develop/%s%s" % (fn, linespec)
else:
return pre_link + "v%s/%s%s" % (__version__, fn, linespec)
else:
Expand Down
Loading