Skip to content

Commit

Permalink
Update IO tutorial with new original_metadata arrays for Oxford binar…
Browse files Browse the repository at this point in the history
…y > v4

Signed-off-by: Håkon Wiik Ånes <[email protected]>
  • Loading branch information
hakonanes committed Nov 19, 2024
1 parent 9215f56 commit f50b6af
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 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 @@ -1100,10 +1106,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 +1153,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 +1162,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 +1179,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 +1218,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

0 comments on commit f50b6af

Please sign in to comment.