Skip to content

Commit

Permalink
Merge pull request #704 from hakonanes/post-0.11.1-release-develop-up…
Browse files Browse the repository at this point in the history
…dates

Post 0.11.1 release develop updates
  • Loading branch information
hakonanes authored Nov 30, 2024
2 parents 4e2621a + 02ae06a commit 1c56181
Show file tree
Hide file tree
Showing 23 changed files with 791 additions and 585 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,26 @@ Changed
Removed
-------

Fixed
-----

Deprecated
----------

0.11.1 (2024-11-30)
===================

Added
-----
- Reading of unprocessed patterns from H5OINA files is now possible.
(`#701 <https://github.com/pyxem/kikuchipy/pull/701>`_)

Fixed
-----
- Reading of Oxford binary `*.ebsp` files with version 6.
(`#700 <https://github.com/pyxem/kikuchipy/pull/700>`_)
- Unnecessary reading of unprocessed patterns from H5OINA files into the EBSD original
metadata. (`#701 <https://github.com/pyxem/kikuchipy/pull/701>`_)

0.11.0 (2024-11-10)
===================
Expand Down
373 changes: 24 additions & 349 deletions conftest.py

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import inspect
import os
from os.path import dirname, relpath
from pathlib import Path
import re
import sys
import warnings

from numpydoc.docscrape_sphinx import SphinxDocString
import pyvista as pv
Expand Down Expand Up @@ -53,7 +55,6 @@
# Create links to references within kikuchipy's documentation to these
# packages
intersphinx_mapping = {
# Package
"black": ("https://black.readthedocs.io/en/stable", None),
"conda": ("https://docs.conda.io/projects/conda/en/latest", None),
"coverage": ("https://coverage.readthedocs.io/en/latest", None),
Expand Down Expand Up @@ -358,7 +359,15 @@ def _str_examples(self):
}
autosummary_generate = True

# Download example datasets prior to building the docs
print("[kikuchipy] Downloading example datasets (if not found in cache)")
_ = kp.data.nickel_ebsd_large(allow_download=True)
_ = kp.data.si_ebsd_moving_screen(0, allow_download=True)

def custom_setup():
"""Download files used in the documentation."""
print("[kikuchipy] Downloading example datasets (if not found in cache)")
try:
_ = kp.data.nickel_ebsd_large(allow_download=True)
_ = kp.data.si_ebsd_moving_screen(0, allow_download=True)
except () as e:
warnings.warn(f"Download failed. Error: {e}")


custom_setup()
34 changes: 22 additions & 12 deletions doc/tutorials/load_save_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,13 @@
"Here, the Oxford Instruments binary [file_reader()](../reference/generated/kikuchipy.io.plugins.oxford_binary.file_reader.rst) is called.\n",
"\n",
"Every pattern's flattened index into the 2D navigation map, as well as their entry in the file (map order isn't always the same as file order) can be retrieved from `s_oxford.original_metadata.map1d_id` and `s_oxford.original_metadata.file_order`, respectively.\n",
"If available in the file, every pattern's row and column beam position in microns can be retrieved from `s_oxford.original_metadata.beam_y` and `s_oxford.original_metadata.beam_x`, respectively.\n",
"The following data may be read as well, depending on their presence in the file:\n",
"\n",
"* `s_oxford.original_metadata.beam_x`: Every pattern's column in microns\n",
"* `s_oxford.original_metadata.beam_y`: Every pattern's row in microns\n",
"* `s_oxford.original_metadata.map_x`: Every pattern's column\n",
"* `s_oxford.original_metadata.map_y`: Every pattern's row\n",
"\n",
"All these are 1D arrays."
]
},
Expand Down Expand Up @@ -977,7 +983,10 @@
"As with the kikuchipy h5ebsd reader, multiple scans can be read at once.\n",
"\n",
"The projection center (PC) arrays are read into the `detector` attribute and the static background pattern is read into the `static_background` attribute.\n",
"The orientation and phase data are so far not read."
"The orientation and phase data are so far not read.\n",
"\n",
"Oxford Instruments allow writing both processed and unprocessed patterns.\n",
"To read the unprocessed patterns, pass `processed=False` when loading."
]
},
{
Expand Down Expand Up @@ -1100,10 +1109,11 @@
"## Load and save virtual BSE images\n",
"\n",
"One or more virtual backscatter electron (BSE) images in a [VirtualBSEImage](../reference/generated/kikuchipy.signals.VirtualBSEImage.rst) signal can be read and written to file using one of HyperSpy's many readers and writers.\n",
"If they are only to be used internally in HyperSpy, they can be written to and read back from HyperSpy's HDF5/zarr specification [as explained above for EBSD master patterns](#Save-patterns).\n",
"\n",
"If they are only to be used internally in HyperSpy, they can be written to and read back from HyperSpy's HDF5/zarr specification [as explained above for EBSD master patterns](#Save-patterns).\n",
"If we want to write the images to image files, HyperSpy also provides a series of image readers/writers, as explained in their [IO user guide](https://hyperspy.org/hyperspy-doc/v1.7/user_guide/io.html#images).\n",
"If we wanted to write them as a stack of TIFF images"
"\n",
"Writing as a stack of TIFF images"
]
},
{
Expand Down Expand Up @@ -1146,7 +1156,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also write them to e.g. `png` or `bmp` files with `Matplotlib`"
"Read the TIFF stack back into a `VirtualBSEImage` signal"
]
},
{
Expand All @@ -1155,16 +1165,15 @@
"metadata": {},
"outputs": [],
"source": [
"nav_size = vbse.axes_manager.navigation_size\n",
"for i in range(nav_size):\n",
" plt.imsave(temp_dir / f\"vbse{i}.png\", vbse.inav[i].data)"
"vbse2 = hs.load(temp_dir / vbse_fname, signal_type=\"VirtualBSEImage\")\n",
"vbse2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Read the TIFF stack back into a `VirtualBSEImage` signal"
"We can also write them to e.g. `png` or `bmp` files with `Matplotlib`"
]
},
{
Expand All @@ -1173,8 +1182,9 @@
"metadata": {},
"outputs": [],
"source": [
"vbse2 = hs.load(temp_dir / vbse_fname, signal_type=\"VirtualBSEImage\")\n",
"vbse2"
"nav_size = vbse.axes_manager.navigation_size\n",
"for i in range(nav_size):\n",
" plt.imsave(temp_dir / f\"vbse{i}.png\", vbse.inav[i].data)"
]
},
{
Expand Down Expand Up @@ -1211,7 +1221,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.12.7"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ src = ""
[tool.hatch.build.targets.wheel]
include = ["src/kikuchipy"]

[tool.hatch.build.targets.wheel.force-include]
"tests/" = "kikuchipy/tests"
"conftest.py" = "kikuchipy/conftest.py"

[tool.coverage.report]
precision = 2

Expand Down
2 changes: 1 addition & 1 deletion src/kikuchipy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"Carter Francis",
"Magnus Nord",
]
__version__ = "0.12.dev0"
__version__ = "0.12.dev1"

__getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__)

Expand Down
4 changes: 3 additions & 1 deletion src/kikuchipy/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ def fetch_file_path(
) -> str:
if show_progressbar is None:
show_progressbar = hs.preferences.General.show_progressbar
downloader = pooch.HTTPDownloader(progressbar=show_progressbar)
downloader = pooch.HTTPDownloader(
progressbar=show_progressbar, headers={"User-Agent": "agent"}
)

if self.is_in_package:
if self.has_correct_hash:
Expand Down
Loading

0 comments on commit 1c56181

Please sign in to comment.