From cab14fe9b1c849e88ac0af3473d3b8ad046d4a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 21 Jan 2021 18:55:05 +0100 Subject: [PATCH 01/12] Update the release guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- RELEASE.rst | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/RELEASE.rst b/RELEASE.rst index f8a66319..c8ba9bc8 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -1,53 +1,46 @@ How to make a new release of ``kikuchipy`` ========================================== -This guide should be updated after every new release! - - Create a release branch v..x. If a new minor release is to be made, branch off of master via the GitHub repo, and pull this branch locally. If a new patch release is to be made, pull the existing minor branch locally and branch off of it. - -- Review and clean up doc/changelog.rst as per Keep a Changelog. Make sure all +- Review and clean up `doc/changelog.rst` as per Keep a Changelog. Make sure all contributors and reviewers are acknowledged. Increment the version number in `release.py`. Make a PR to the release branch. - - Create a PR from the release branch to master. Discuss the changelog with - others, and make the changes directly to the release branch. After all checks - are green and the PR is merged, cherry-pick any resulting changes to the - release branch. - -- Make sure that the documentation, with the changelog updates, can be - successfully built from the release branch by making Read the Docs build the - release branch: https://readthedocs.org/projects/kikuchipy/. - + others, and make the changes *directly* to the release branch. After all + checks pass the PR is merged, cherry-pick any resulting changes to the release + branch. - On the master branch, increment the version number in `release.py` to the next - ``.dev0``. - + `.dev0`. +- If a release candidate (RC) is to be made, make a PR to the release branch + with `-rc.1` added to the version name, like v0.42.0-rc.1, merge the PR after + all checks pass, and publish an RC release off of the release branch. See that + it is made available via PyPI, download it with the `dev` dependencies, and + run the tests to make sure everything is as it should be. - Create a release draft (tag) via the GitHub repo from the release branch with the correct tag version name, e.g. v0.42.x and release title (see previous releases). Add the new release notes from the changelog. Publish the release. - -- Monitor Travis CI to ensure the release is successfully published to PyPI. +- Monitor the publish GitHub Action to ensure the release is successfully + published to PyPI. +- Download the new version from PyPI with the `dev` dependencies locally and run + the tests to make sure everything is as it should be. +- Make a PR to master with any updates to this guide if necessary. conda-forge ----------- - A kikuchipy build recipe is available at https://github.com/conda-forge/kikuchipy-feedstock. conda-forge documentation is available at https://conda-forge.org/docs/index.html. - Fork the feedstock. - - Create a new release branch named v..x off of master. - - Increment the version number in `recipe/meta.yml`. Get the SHA256 for the package distribution (`.tar.gz`) from PyPI https://pypi.org/project/kikuchipy/. - - Make a PR to master from the release branch. Follow the relevant instructions from the conda-forge documentation on updating packages. Merge the PR after all checks are green. - - Monitor the Azure pipeline CI to ensure the release is successfully published to conda-forge. From 5a377ea4a3686a32855147d0457647a7c1b82d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 21 Jan 2021 18:55:52 +0100 Subject: [PATCH 02/12] Increment minor version to v0.4.0dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- kikuchipy/release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kikuchipy/release.py b/kikuchipy/release.py index 198bc5e7..efb7607a 100644 --- a/kikuchipy/release.py +++ b/kikuchipy/release.py @@ -34,4 +34,4 @@ name = "kikuchipy" platforms = ["Linux", "MacOS X", "Windows"] status = "Development" -version = "0.3.0" +version = "0.4.0dev" From c5779c075b97e3a21a0de06a3468bca04b3cd9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 21 Jan 2021 19:52:41 +0100 Subject: [PATCH 03/12] Update PR template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- .github/pull_request_template.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 756681d5..4ab34571 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,25 +1,23 @@ #### Description of the change -#### Progress of the PR +#### Progress of the PR - [ ] [Docstrings for all functions](https://github.com/numpy/numpy/blob/master/doc/example.py) - [ ] Unit tests with pytest for all lines - [ ] Clean code style by [running black via pre-commit](https://kikuchipy.org/en/latest/contributing.html#code-style) #### Minimal example of the bug fix or new feature - ```python >>> import kikuchipy as kp ->>> import numpy as np ->>> s = kp.signals.EBSD(np.zeros((10, 10, 10, 10))) +>>> s = kp.data.nickel_ebsd_small() +>>> s + >>> # Your new feature... ``` #### For reviewers - -- [ ] Check that the PR title is short, concise, and will make sense 1 year - later. -- [ ] Check that new functions are imported in corresponding `__init__.py`. -- [ ] Check that new features, API changes, and deprecations are mentioned in - the unreleased section in `doc/changelog.rst`. +- [ ] The PR title is short, concise, and will make sense 1 year later. +- [ ] New functions are imported in corresponding `__init__.py`. +- [ ] New features, API changes, and deprecations are mentioned in the + unreleased section in `doc/changelog.rst`. From 0d7c242587648d6dcbddacaae20f40c7a310c8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Fri, 22 Jan 2021 10:31:17 +0100 Subject: [PATCH 04/12] Fix release version links used by Binder and nbsphinx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/changelog.rst | 12 ++++++++++++ doc/conf.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 6a048068..110d0a1f 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -12,6 +12,18 @@ project adheres to `Semantic Versioning `_. Contributors to each release are listed in alphabetical order by first name. List entries are sorted in descending chronological order. +Unreleased +========== + +Contributors +------------ +- Håkon Wiik Ånes + +Fixed +----- +- Version link Binder uses to make the Jupyter Notebooks run in the browser. + (`#301 `_) + 0.3.0 (2021-01-22) ================== diff --git a/doc/conf.py b/doc/conf.py index 579e3fb0..079b8c34 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -113,7 +113,7 @@ if "dev" in version: release_version = "master" else: - release_version = version + release_version = "v" + version # This is processed by Jinja2 and inserted before each notebook nbsphinx_prolog = ( r""" From dac8c869ee3d976e01b30c4663433d9b7bc3da15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Fri, 22 Jan 2021 11:10:55 +0100 Subject: [PATCH 05/12] Update release version, notebook argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- RELEASE.rst | 4 +++- doc/changelog.rst | 4 ++-- doc/pattern_matching.ipynb | 3 ++- kikuchipy/release.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/RELEASE.rst b/RELEASE.rst index c8ba9bc8..f6916d7f 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -18,7 +18,9 @@ How to make a new release of ``kikuchipy`` with `-rc.1` added to the version name, like v0.42.0-rc.1, merge the PR after all checks pass, and publish an RC release off of the release branch. See that it is made available via PyPI, download it with the `dev` dependencies, and - run the tests to make sure everything is as it should be. + run the tests to make sure everything is as it should be. Also check that + Binder can build the repository successfully by going to the Read the Docs PR + check in the RC PR above after the RC release. - Create a release draft (tag) via the GitHub repo from the release branch with the correct tag version name, e.g. v0.42.x and release title (see previous releases). Add the new release notes from the changelog. Publish the release. diff --git a/doc/changelog.rst b/doc/changelog.rst index 110d0a1f..3278dc62 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -12,8 +12,8 @@ project adheres to `Semantic Versioning `_. Contributors to each release are listed in alphabetical order by first name. List entries are sorted in descending chronological order. -Unreleased -========== +0.3.1 (2021-01-22) +================== Contributors ------------ diff --git a/doc/pattern_matching.ipynb b/doc/pattern_matching.ipynb index 5a19a53c..c236f7c4 100644 --- a/doc/pattern_matching.ipynb +++ b/doc/pattern_matching.ipynb @@ -69,7 +69,8 @@ "import kikuchipy as kp\n", "\n", "\n", - "s = kp.data.nickel_ebsd_large() # Use kp.load(\"data.h5\") to load your own data\n", + "# Use kp.load(\"data.h5\") to load your own data\n", + "s = kp.data.nickel_ebsd_large(allow_download=True) # External download\n", "s" ] }, diff --git a/kikuchipy/release.py b/kikuchipy/release.py index efb7607a..2c9ea81c 100644 --- a/kikuchipy/release.py +++ b/kikuchipy/release.py @@ -34,4 +34,4 @@ name = "kikuchipy" platforms = ["Linux", "MacOS X", "Windows"] status = "Development" -version = "0.4.0dev" +version = "0.3.1" From 96c6ac89a46b5fc44b3555e393cc05f791a9a3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Fri, 22 Jan 2021 11:42:56 +0100 Subject: [PATCH 06/12] Fix changelog link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 3278dc62..2b2ab4ce 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -22,7 +22,7 @@ Contributors Fixed ----- - Version link Binder uses to make the Jupyter Notebooks run in the browser. - (`#301 `_) + (`#301 `_) 0.3.0 (2021-01-22) ================== From cb7ac5d65cc7a56bbcbf522a39b4b1876e9df01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Fri, 22 Jan 2021 12:42:05 +0100 Subject: [PATCH 07/12] Increment version again from 0.3.1 in release.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- kikuchipy/release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kikuchipy/release.py b/kikuchipy/release.py index 2c9ea81c..efb7607a 100644 --- a/kikuchipy/release.py +++ b/kikuchipy/release.py @@ -34,4 +34,4 @@ name = "kikuchipy" platforms = ["Linux", "MacOS X", "Windows"] status = "Development" -version = "0.3.1" +version = "0.4.0dev" From 20767f5a9419417827a7768d94910bc91d30d477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 28 Jan 2021 14:29:32 +0100 Subject: [PATCH 08/12] Fix creation of spatial arrays for xmap after pattern matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- .../indexing/_static_pattern_matching.py | 11 ++--- .../tests/test_static_pattern_matching.py | 44 +++++++++---------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/kikuchipy/indexing/_static_pattern_matching.py b/kikuchipy/indexing/_static_pattern_matching.py index 2593ca49..ae5bcdcd 100644 --- a/kikuchipy/indexing/_static_pattern_matching.py +++ b/kikuchipy/indexing/_static_pattern_matching.py @@ -141,7 +141,6 @@ def __call__( spatial_arrays = _get_spatial_arrays( shape=axes_manager.navigation_shape, extent=axes_manager.navigation_extent, - step_sizes=[i.scale for i in axes_manager.navigation_axes], ) n_nav_dims = axes_manager.navigation_dimension if n_nav_dims == 0: @@ -200,18 +199,16 @@ def __call__( def _get_spatial_arrays( - shape: tuple, extent: tuple, step_sizes: tuple + shape: tuple, extent: tuple ) -> Union[tuple, np.ndarray]: n_nav_dims = len(shape) if n_nav_dims == 0: return () if n_nav_dims == 1: x0, x1 = extent - dx = step_sizes[0] - return np.arange(x0, x1 + dx, dx) + return np.linspace(x0, x1, shape[0]) else: x0, x1, y0, y1 = extent - dx, dy = step_sizes - x = np.tile(np.arange(x0, x1 + dx, dx), shape[1]) - y = np.tile(np.arange(y0, y1 + dy, dy), shape[0]) + x = np.tile(np.linspace(x0, x1, shape[0]), shape[1]) + y = np.tile(np.linspace(y0, y1, shape[1]), shape[0]) return x, y diff --git a/kikuchipy/indexing/tests/test_static_pattern_matching.py b/kikuchipy/indexing/tests/test_static_pattern_matching.py index 6811a1b5..2087feda 100644 --- a/kikuchipy/indexing/tests/test_static_pattern_matching.py +++ b/kikuchipy/indexing/tests/test_static_pattern_matching.py @@ -143,45 +143,45 @@ def test_signal_varying_dimensions( assert res.shape == desired_xmap_shape @pytest.mark.parametrize( - "nav_slice, step_sizes, desired_arrays", + "shape, extent, desired_arrays", [ # 0d - ((0, 0), (1, 1), ()), - ((slice(0, 0), slice(0, 0)), (1, 1), (np.array([]),) * 2), + ((), (), ()), + ((0, 0), (0.0, 2.0, 0.0, 2.0), (np.array([]),) * 2), # 1d - ((0, slice(None)), (1, 1.5), np.tile(np.arange(0, 4.5, 1.5), 3)), + ((3,), (0.0, 3.0), np.tile(np.linspace(0, 4.5, 3), 3)), # 2d ( - (slice(None), slice(0, 2)), - (2, 1.5), + (3, 2), + (0.0, 4.0, 0.0, 1.5), ( - np.tile(np.arange(0, 6, 2), 2), - np.tile(np.arange(0, 3, 1.5), 3), + np.tile(np.linspace(0, 4, 3), 2), + np.tile(np.linspace(0, 1.5, 2), 3), ), ), ( - (slice(None), slice(0, 2)), - (0.5, 1), + (3, 2), + (0.0, 1.0, 0.0, 1.0), ( - np.tile(np.arange(0, 1.5, 0.5), 2), - np.tile(np.arange(0, 2, 1), 3), + np.tile(np.linspace(0, 1, 3), 2), + np.tile(np.linspace(0, 1, 2), 3), + ), + ), + ( + (136, 249), + (79.5, 99.75, 30.0, 67.2), + ( + np.tile(np.linspace(79.5, 99.75, 136), 249), + np.tile(np.linspace(30.0, 67.2, 249), 136), ), ), ], ) - def test_get_spatial_arrays(self, nav_slice, step_sizes, desired_arrays): + def test_get_spatial_arrays(self, shape, extent, desired_arrays): """Ensure spatial arrays for 0d, 1d and 2d EBSD signals are returned correctly. """ - s = nickel_ebsd_small() - s.axes_manager["x"].scale = step_sizes[0] - s.axes_manager["y"].scale = step_sizes[1] - axes_manager = s.inav[nav_slice].axes_manager - spatial_arrays = _get_spatial_arrays( - shape=axes_manager.navigation_shape, - extent=axes_manager.navigation_extent, - step_sizes=[i.scale for i in axes_manager.navigation_axes], - ) + spatial_arrays = _get_spatial_arrays(shape, extent) if len(spatial_arrays) == 0: assert spatial_arrays == desired_arrays From 8f7003e8cd44001654fdcc96f4527861977477ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 28 Jan 2021 14:44:38 +0100 Subject: [PATCH 09/12] Update changelog, fix typos in pattern matching notebook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/changelog.rst | 13 +++++++++++++ doc/pattern_matching.ipynb | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 2b2ab4ce..eb381be8 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -12,6 +12,19 @@ project adheres to `Semantic Versioning `_. Contributors to each release are listed in alphabetical order by first name. List entries are sorted in descending chronological order. +Unreleased +========== + +Contributors +------------ +- Håkon Wiik Ånes + +Fixed +----- +- Pattern matching sometimes failing to generate a crystal map due to incorrect + creation of spatial arrays + (`#306 `_) + 0.3.1 (2021-01-22) ================== diff --git a/doc/pattern_matching.ipynb b/doc/pattern_matching.ipynb index c236f7c4..180fdc73 100644 --- a/doc/pattern_matching.ipynb +++ b/doc/pattern_matching.ipynb @@ -38,7 +38,7 @@ "\n", "Before we can generate a dictionary of\n", "simulated patterns, we need a master pattern containing all possible scattering\n", - "vectors for a candidate phase. This can simulated done using EMsoft\n", + "vectors for a candidate phase. This can be simulated using EMsoft\n", "Callahan and De Graef (2013)\n", "Jackson et al. (2014), and then read\n", "into kikuchipy." @@ -48,7 +48,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "First, we import libraries and load the small experimental Nickel test data." + "First, we import libraries and load the small experimental Nickel test data" ] }, { @@ -101,7 +101,7 @@ "source": [ "Next, we load a dynamically simulated Nickel master pattern generated with\n", "EMsoft, in the northern hemisphere projection of the square Lambert projection\n", - "for an accelerating voltage of 20 keV." + "for an accelerating voltage of 20 keV" ] }, { @@ -129,7 +129,7 @@ "source": [ "The Nickel phase information, specifically the crystal symmetry, asymmetric atom\n", "positions, and crystal lattice, is conveniently stored in an\n", - "[orix.crystal_map.Phase](https://orix.readthedocs.io/en/stable/reference.html#orix.crystal_map.phase_list.Phase)." + "[orix.crystal_map.Phase](https://orix.readthedocs.io/en/stable/reference.html#orix.crystal_map.phase_list.Phase)" ] }, { @@ -171,7 +171,7 @@ "4$^{\\circ}$ characteristic distance between orientations (we can either pass\n", "in the proper point group, or the space group, which is a subgroup of the proper\n", "point group) using\n", - "[orix.sampling.get_sample_fundamental()](https://orix.readthedocs.io/en/stable/reference.html#orix.sampling.sample_generators.get_sample_fundamental)." + "[orix.sampling.get_sample_fundamental()](https://orix.readthedocs.io/en/stable/reference.html#orix.sampling.sample_generators.get_sample_fundamental)" ] }, { @@ -197,7 +197,7 @@ "Note\n", "\n", "A characteristic distance of 4$^{\\circ}$ results in a course sampling of\n", - "orientation space; a shorter distance should be used for real experimental work.\n", + "orientation space; a shorter distance should be used for experimental work.\n", "\n", "" ] @@ -235,7 +235,7 @@ "source": [ "Let's double check the projection/pattern center (PC) position on the detector\n", "using\n", - "[plot()](reference.rst#kikuchipy.detectors.ebsd_detector.EBSDDetector.plot)." + "[plot()](reference.rst#kikuchipy.detectors.ebsd_detector.EBSDDetector.plot)" ] }, { @@ -279,7 +279,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's inspect the three first of the 14423 simulated patterns." + "Let's inspect the three first of the 14423 simulated patterns" ] }, { @@ -332,7 +332,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The results can be exported to an HDF5 file re-readable by orix." + "The results can be exported to an HDF5 file re-readable by orix" ] }, { @@ -351,7 +351,7 @@ "metadata": {}, "source": [ "Let's inspect our matching results by plotting a map of the highest $r$\n", - "(stored in the `scores` property)." + "(stored in the `scores` property)" ] }, { @@ -371,7 +371,7 @@ "metadata": {}, "source": [ "We can use the crystal map property `simulation_indices` to get the best\n", - "matching simulated patterns from the dictionary of simulated patterns." + "matching simulated patterns from the dictionary of simulated patterns" ] }, { @@ -404,7 +404,7 @@ "outputs": [], "source": [ "ncc_navigator = hs.signals.Signal2D(xmap.get_map_data(xmap.scores[:, 0]))\n", - "hs.plot.plot_signals([s, s_best], navigator=hs.signals.Signal2D(ncc_navigator))" + "hs.plot.plot_signals([s, s_best], navigator=ncc_navigator)" ] }, { From 7899265c8ba6b9cf74038bbf325c88a264040352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Thu, 28 Jan 2021 14:52:38 +0100 Subject: [PATCH 10/12] Fix link in changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index eb381be8..4efeab35 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -23,7 +23,7 @@ Fixed ----- - Pattern matching sometimes failing to generate a crystal map due to incorrect creation of spatial arrays - (`#306 `_) + (`#307 `_) 0.3.1 (2021-01-22) ================== From a9ff191a2ed6ea60bad8e26938fb8022054a3c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Mon, 1 Feb 2021 10:04:49 +0100 Subject: [PATCH 11/12] Correct deletion of temp files in temp dirs in user guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- .gitignore | 3 +++ doc/changelog.rst | 2 ++ doc/geometrical_ebsd_simulations.ipynb | 17 +++++++++-------- doc/load_save_data.ipynb | 13 ++++++++++++- doc/pattern_matching.ipynb | 4 +++- doc/virtual_backscatter_electron_imaging.ipynb | 4 +++- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index b90f1e7c..b2804f35 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ ENV/ #auto changing files build/ src/ + +# Backport +.backportrc.json \ No newline at end of file diff --git a/doc/changelog.rst b/doc/changelog.rst index 4efeab35..9daa6341 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -21,6 +21,8 @@ Contributors Fixed ----- +- Deletion of temporary files saved to temporary directories in user guide + (`#311 `_) - Pattern matching sometimes failing to generate a crystal map due to incorrect creation of spatial arrays (`#307 `_) diff --git a/doc/geometrical_ebsd_simulations.ipynb b/doc/geometrical_ebsd_simulations.ipynb index 66caab53..fb7a1966 100644 --- a/doc/geometrical_ebsd_simulations.ipynb +++ b/doc/geometrical_ebsd_simulations.ipynb @@ -415,8 +415,8 @@ "outputs": [], "source": [ "nav_x, nav_y = s.axes_manager.indices\n", - "temp_dir = tempfile.mkdtemp()\n", - "fname = temp_dir + f\"/geosim_y{nav_y}_x{nav_x}.png\"\n", + "temp_dir = tempfile.mkdtemp() + \"/\"\n", + "fname = temp_dir + f\"geosim_y{nav_y}_x{nav_x}.png\"\n", "s._plot.signal_plot.figure.savefig(fname, bbox_inches=bbox, dpi=150)" ] }, @@ -444,7 +444,7 @@ "outputs": [], "source": [ "nav_x, nav_y = s.axes_manager.indices\n", - "fname = temp_dir + f\"/geosim_y{nav_y}_x{nav_x}.png\"\n", + "fname = temp_dir + f\"geosim_y{nav_y}_x{nav_x}.png\"\n", "s._plot.signal_plot.figure.savefig(fname, bbox_inches=bbox, dpi=150)" ] }, @@ -602,13 +602,14 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "nbsphinx": "hidden" - }, + "metadata": {}, "outputs": [], "source": [ - "from shutil import rmtree\n", - "rmtree(temp_dir) # Remove files written to disk in this user guide" + "# Remove files written to disk in this user guide\n", + "import os\n", + "for file in [\"geosim_y0_x0.png\", \"geosim_y1_x2.png\"]:\n", + " os.remove(temp_dir + file)\n", + "os.rmdir(temp_dir)" ] } ], diff --git a/doc/load_save_data.ipynb b/doc/load_save_data.ipynb index d7a02839..fcf3a715 100644 --- a/doc/load_save_data.ipynb +++ b/doc/load_save_data.ipynb @@ -397,7 +397,7 @@ "metadata": {}, "outputs": [], "source": [ - "temp_dir = tempfile.mkdtemp()\n", + "temp_dir = tempfile.mkdtemp() + \"/\"\n", "s.save(temp_dir + \"patterns\")" ] }, @@ -957,7 +957,18 @@ }, "outputs": [], "source": [ + "# Remove files written to disk in this user guide\n", "import os\n", + "for file in [\n", + " \"patterns.h5\",\n", + " \"patterns_new.h5\",\n", + " \"patterns.dat\",\n", + " \"master_pattern.hspy\",\n", + " \"vbse.tif\",\n", + "]:\n", + " os.remove(temp_dir + file)\n", + "for i in range(25):\n", + " os.remove(temp_dir + f\"vbse{i}.png\")\n", "os.rmdir(temp_dir)" ] } diff --git a/doc/pattern_matching.ipynb b/doc/pattern_matching.ipynb index 180fdc73..11b05320 100644 --- a/doc/pattern_matching.ipynb +++ b/doc/pattern_matching.ipynb @@ -341,7 +341,7 @@ "metadata": {}, "outputs": [], "source": [ - "temp_dir = tempfile.mkdtemp()\n", + "temp_dir = tempfile.mkdtemp() + \"/\"\n", "xmap_file = temp_dir + \"ni.h5\"\n", "io.save(xmap_file, xmap)" ] @@ -449,7 +449,9 @@ }, "outputs": [], "source": [ + "# Remove files written to disk in this user guide\n", "import os\n", + "os.remove(xmap_file)\n", "os.rmdir(temp_dir)" ] } diff --git a/doc/virtual_backscatter_electron_imaging.ipynb b/doc/virtual_backscatter_electron_imaging.ipynb index 495e1c39..400f40f0 100644 --- a/doc/virtual_backscatter_electron_imaging.ipynb +++ b/doc/virtual_backscatter_electron_imaging.ipynb @@ -120,7 +120,7 @@ "metadata": {}, "outputs": [], "source": [ - "temp_dir = tempfile.mkdtemp()\n", + "temp_dir = tempfile.mkdtemp() + \"/\"\n", "plt.imsave(temp_dir + \"vbse1.png\", arr=vbse.data)" ] }, @@ -377,7 +377,9 @@ }, "outputs": [], "source": [ + "# Remove files written to disk in this user guide\n", "import os\n", + "os.remove(temp_dir + \"vbse1.png\")\n", "os.rmdir(temp_dir)" ] } From fb0db15a045be2d5bae1cbcae80cfde0926ea3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Mon, 1 Feb 2021 10:10:52 +0100 Subject: [PATCH 12/12] Fix link in changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 9daa6341..01902499 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -22,7 +22,7 @@ Contributors Fixed ----- - Deletion of temporary files saved to temporary directories in user guide - (`#311 `_) + (`#312 `_) - Pattern matching sometimes failing to generate a crystal map due to incorrect creation of spatial arrays (`#307 `_)