Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a8334f8
Initial attempt at including diffusion
drowenhorst-nrl Oct 17, 2024
6854fbf
First attempt to add a scale bar to ipf images
drowenhorst-nrl Oct 22, 2024
4b800c0
Set diffusion offset to be a scalar added to the center weighted kernel.
drowenhorst-nrl Oct 22, 2024
983e43b
Include basic font in manifest
drowenhorst-nrl Oct 22, 2024
bb4a0c6
Attempt to fix manifest
drowenhorst-nrl Oct 23, 2024
dff1e36
Some improvements to scalebar attachment.
drowenhorst-nrl Oct 23, 2024
dbd2e72
Signed-off by: David Rowenhorst <david.rowenhorst@nrl.navy.mil>
drowenhorst-nrl Oct 24, 2024
44760be
add_scalebar --> addscalebar. Rearrange to be able to rescale any im…
drowenhorst-nrl Oct 24, 2024
92f942b
Changed default cpu core usage behavior to be more optimal.
drowenhorst-nrl Oct 24, 2024
af526f7
another function name change addscalebar --> _addscalebar
drowenhorst-nrl Oct 24, 2024
0eae939
Another code rearrangement and some documentation.
drowenhorst-nrl Oct 29, 2024
447621b
Change behavior for norescale if no scale bar.
drowenhorst-nrl Oct 29, 2024
00f2977
Added grayscale option to IPF maps.
drowenhorst-nrl Oct 30, 2024
628cbf4
More pleasing contrast for fitinv.
drowenhorst-nrl Oct 30, 2024
52fb338
Clean up some code.
drowenhorst-nrl Oct 30, 2024
7fc579d
Changed upscale_xsize --> zoom_xsize. Added zoom_kwargs.
drowenhorst-nrl Oct 31, 2024
8bbf4c3
Refactor to micronbar to avoid confusion with matplotlib_scalebar pac…
drowenhorst-nrl Oct 31, 2024
55e2165
Fix PQ
drowenhorst-nrl Oct 31, 2024
94c60a0
Updated CL programs for new PQ metric.
drowenhorst-nrl Oct 31, 2024
c694835
Try and correct a rare divide by 0
drowenhorst-nrl Oct 31, 2024
1e01ab1
Fix bandindex arrays
drowenhorst-nrl Nov 1, 2024
51a8839
Improved QUEST weighting.
drowenhorst-nrl Nov 1, 2024
b92c26e
Gamma function for images.
drowenhorst-nrl Nov 1, 2024
3217f22
More consistent scaling for PQ value.
drowenhorst-nrl Nov 1, 2024
6d5168c
Better automated CPU allocation.
drowenhorst-nrl Nov 1, 2024
98b80e8
Fixed pole assignment issue
drowenhorst-nrl Nov 4, 2024
2e28d3f
Fixed array indexing issue.
drowenhorst-nrl Nov 4, 2024
a641313
Using un-weighted fit.
drowenhorst-nrl Nov 4, 2024
145817b
Another rare exception caught.
drowenhorst-nrl Nov 4, 2024
0eafdb9
Update tutorial for indexing. Introduced the IQ metric.
drowenhorst-nrl Nov 4, 2024
a4e11dd
Fixed array slicing on CPU band detection.
drowenhorst-nrl Nov 5, 2024
eb8055d
Fixed keeping pattern mask with indexer object.
drowenhorst-nrl Nov 5, 2024
c3c68f0
Start Adding DM5 file type.
drowenhorst-nrl Nov 27, 2024
f812300
Fix numba typing error
drowenhorst-nrl Dec 5, 2024
6bbd3b7
Merge branch 'develop' into nlstem
drowenhorst-nrl Dec 5, 2024
3d50614
Suppress bogus warnings on NVIDIA Opencl
drowenhorst-nrl Dec 6, 2024
dd4c02b
Fix for Windows needing integer valued font size.
drowenhorst-nrl Dec 6, 2024
0cc0088
Keep from resetting warnings
drowenhorst-nrl Dec 6, 2024
35c7b6f
Merge branch 'develop' into nlstem
drowenhorst-nrl Dec 9, 2024
a934022
Better warning handling around OpenCL builds.
drowenhorst-nrl Dec 9, 2024
baa818e
Better warning handling around OpenCL builds.
drowenhorst-nrl Dec 9, 2024
627c88f
Merge branch 'develop' into nlstem
drowenhorst-nrl Dec 9, 2024
2d4f7e1
First attempt at NLPAR for 4D STEM.
drowenhorst-nrl Dec 12, 2024
10bacbf
Default oh5 files to OIM 9.1 specification.
drowenhorst-nrl Dec 13, 2024
92d0268
Default oh5 to OIM 8.6 spec, 9.1 spec enabled with version='9.1'
drowenhorst-nrl Dec 13, 2024
a65a1ae
Merge branch 'develop' into nlstem
drowenhorst-nrl Feb 3, 2025
96e674f
Update tests to oldest python 3.8
drowenhorst-nrl Feb 3, 2025
5236216
Added SpaceGroupNumber to oh5 metadata
drowenhorst-nrl Feb 6, 2025
6e4e850
Add helper functions for when no opencl is found.
drowenhorst-nrl Feb 6, 2025
2b4c398
Update tests to oldest python 3.8
drowenhorst-nrl Feb 3, 2025
bbe3f62
Added SpaceGroupNumber to oh5 metadata
drowenhorst-nrl Feb 6, 2025
821778c
Merge branch 'develop' into nlstem
drowenhorst-nrl Feb 6, 2025
434a075
Merge branch 'develop' into nlstem
drowenhorst-nrl Apr 1, 2025
30b05f1
Slightly improved error handling if things go very wrong.
drowenhorst-nrl Apr 10, 2025
d98155d
Preliminary support for version 6 ebsp files.
drowenhorst-nrl May 16, 2025
a695fbf
Allow for PC to be an array of values, one for each pattern to be ind…
drowenhorst-nrl Jul 21, 2025
d9e7d94
Set up kernel object reuse - should be more efficient, and eliminate …
drowenhorst-nrl Aug 4, 2025
111d5c8
Bump actions/checkout from 4 to 5
dependabot[bot] Aug 12, 2025
531cd43
Bump actions/setup-python from 5 to 6
dependabot[bot] Sep 8, 2025
f62a332
Provide ability to set a user defined background pattern.
drowenhorst-nrl Oct 1, 2025
ae9e081
Merge branch 'develop' of github.com:drowenhorst-nrl/PyEBSDIndex into…
drowenhorst-nrl Oct 1, 2025
4e6bba3
Merge commit '531cd43f87422022d0fb13ee846b0d9972968def' into develop
drowenhorst-nrl Oct 1, 2025
c78cd0c
Fixed issue that prevented autonlpar from using user defined lambda.
drowenhorst-nrl Oct 2, 2025
ce26c29
Fixed bug in reading step size in ebsp files.
drowenhorst-nrl Oct 10, 2025
9432a49
Merge develop
Nov 18, 2025
29793d5
Include helper functions
Nov 18, 2025
2c6db69
Finish merge with develop
Nov 18, 2025
a0c43d2
Begin block cpu NLPAR
Nov 19, 2025
7e9ff54
Continuing interrupted merge from develop
Nov 19, 2025
5838a53
calcnlpar_cpu now block chunked
Nov 19, 2025
466c998
Check point
Nov 19, 2025
b815dd3
Moved sigma calculation (and also lambda optimization) to block-based…
Nov 20, 2025
0c28b0d
Merge branch 'blocknlpar' into mergenlstemblock
Nov 21, 2025
f6ba08d
More consistent return format.
Nov 21, 2025
a2ebca4
Merge branch 'blocknlpar' into mergenlstemblock
Nov 21, 2025
9e5e4a5
Bump actions/checkout from 5 to 6
dependabot[bot] Nov 24, 2025
37b9d38
Adjusted stem_scale scaling to sqrt() [not log()]. Corrected method …
Nov 24, 2025
52a63c8
Decide on best NLPAR version on import.
Nov 24, 2025
9c9b9b4
Better flexibility on choosing NLPAR implementation.
Nov 24, 2025
deb7eda
Checkpoint
Nov 25, 2025
3d48e9e
Checkpoint
Nov 25, 2025
678fbf5
Checkpoint
Nov 25, 2025
1420226
Checkpoint
Nov 26, 2025
cb9786c
Checkpoint
Nov 26, 2025
ad1b273
Removed alternate sigma calculation. That effort is stored on NLPAR2…
Dec 2, 2025
2bc4ef2
Significant code clean-up, removing redundant keywords within NLPAR.
Dec 4, 2025
d058421
Merge branch 'mergenlstemblock' into blocknlpar
Dec 4, 2025
7a31b76
Merge branch 'mergenlstemblock' into develop
Dec 4, 2025
ddc1bb1
First steps to numba parallel
Dec 5, 2025
7dfede4
Appears to be working - numba multi-threading
Dec 6, 2025
c442571
Checkpoint
drowenhorst-nrl Dec 6, 2025
b68fb39
Checkpoint
drowenhorst-nrl Dec 6, 2025
2e63e46
Adjust multiprocessor settings. Add addphaselist method.
drowenhorst-nrl Dec 8, 2025
5e3e1d3
SubPrograms in triplevote to assist numba parallel.
Dec 8, 2025
46460fe
Changing multiprocessing optimal values for number of indexing proces…
Dec 8, 2025
f455481
Upped max number of patterns per chunk in distributed indexing.
Dec 8, 2025
ff6a060
More scheduling adjustments.
Dec 9, 2025
51c394c
Final performance tweaking ... for now.
Dec 11, 2025
b0ed820
removed unused attribute phaseName (was actually using phasename)
Dec 11, 2025
5438f56
Beginning of a pyebsdindex save/restore.
Dec 11, 2025
1d919e8
First attempt at a indexer file save.
Dec 12, 2025
79688ef
Small bug fixes to allow for saving indexer object in an HDF5
Jan 26, 2026
f8299d8
Prepare for 0.3.9 release
drowenhorst-nrl Jan 26, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

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

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
name: check manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: '3.11'

Expand All @@ -49,10 +49,10 @@ jobs:
DEPENDENCIES: matplotlib==3.3 numba==0.55.1 ray[default]==2.9
LABEL: -oldest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

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

Expand Down
50 changes: 44 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,68 @@ Changelog
All notable changes to PyEBSDIndex will be documented in this file. The format is based
on `Keep a Changelog <https://keepachangelog.com/en/1.1.0>`_.


0.3.9 (2026-01-26)
==================

Added
-----
- Now have the ability to save an indexer object to an HDF5 file using
the ``ebsd_index.indexer.saveindexer(filename='indexer.pyindx')`` method. It can similarly be
restored using the ``indexer_obj = ebsd_index.restoreindexer(filename='indexer.pyindx')`` function.
This should be considered a beta-level capability, as there might be situations that yield incompatible
values for HDF5 and variable that are defined as ``None``.

- Some preliminary support for DM5 files for use in the NLPAR algorithm.

Changed
-------
- The band indexing steps in the ``triplevote`` module are now mostly multi-threaded using Numba.
This causes a long delay on the first index process, but should be much faster overall, espeically when
indexing using a single process mode (non-distributed).

- Rebalanced the default number of processes used when using the distributed (aka multi-process) indexing,
given that the band indexing is now multi-threaded.

- NLPAR now always breaks a scan into blocks of patterns, rather than defaulting to always using a full
row of patterns. This was always the case for the GPU version of NLPAR, but now also works for the CPU version,
and hopefully prevents memory issues for larger scans on machines with lower RAM totals.

- the ``EBSDImage.IPFcolor`` and ``EBSDImage.scalarimage`` now use the keywords ``ncols`` and ``nrows`` to
keep some consistency with the rest of the package. ``xsize`` and ``ysize`` will still be respected for backwards
compatibility, but at some point in the future will be depreciated.


Fixed
-----
- openCL should now stop spewing warning messages about reuse of programming objects.



0.3.8 (2025-04-01)
==================

Added
-----
- Ability to add micron bars to IPF and scalar values maps. Use the ``addmicronbar`` keyword
to ``makeipf`` and ``scalarimage`` functions.
to ``makeipf`` and ``scalarimage`` functions.
- When using ``ebsd_index`` function, if the machine has multiple GPUs, the desired GPU
can be chosen using the ``gpu_id`` keyword.
can be chosen using the ``gpu_id`` keyword.
- When making IPF maps, a grayscale mix can be added using ``graychannel`` keyword.
- New pattern quality parameter, ``iq`` which is the mean intensity of the convolved peaks
divided by the mean intensity of the radon. Typical values are 1.8--2.0
divided by the mean intensity of the radon. Typical values are 1.8--2.0
- Initial support for Thermo-Fisher ``.pat`` files.

Changed
-------
- Minimum official support is now python 3.9
- pyebsdinex[parallel] now uses a minimum Ray v2.9
- oh5 files are currently written with OIM 8.6.
OIM 9.1 oh5 files can be specified using ``version=9.1``
OIM 9.1 oh5 files can be specified using ``version=9.1``
- The ``fit`` value now is the _unweighted_ mean angular deviation. Previously this was
the weighted eigen value from the QUEST algorithm.
the weighted eigen value from the QUEST algorithm.
- Automatic CPU scheduling is changed for distributed indexing, avoiding spinning up many
processes on large workstations.
processes on large workstations.


Fixed
Expand Down
74 changes: 38 additions & 36 deletions doc/tutorials/NLPAR_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "257eb666-089b-45c8-9350-70d5bbd1c2ed",
"metadata": {},
"outputs": [],
"source": [
"from pyebsdindex import nlpar"
"from pyebsdindex import nlpar\n",
"#from pyebsdindex import nlpar_cpu as nlpar"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "307a4120-d677-4a3b-a496-9d247839c852",
"metadata": {},
"outputs": [],
Expand All @@ -30,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "8207251c-fd5a-41ae-a43e-ef8e4f05fb49",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -66,35 +67,35 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "83a724b4-120f-408b-834e-f05e17cda4b4",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Chunk size set to nrows: 278\n",
"Block 0\n"
"The number of scan columns is set to one, which is unusual, and may indicate that\n",
"the number of columns is not saved as metadata in the pattern file. Consider manually\n",
"entering the number of columns/rows with ``nlobj.ncols={number of your scan columns}`` and \n",
"``nlobj.nrows={number of your scan rows}``.\n",
"The number of scan columns is set to one, which is unusual, and may indicate that\n",
"the number of columns is not saved as metadata in the pattern file. Consider manually\n",
"entering the number of columns/rows with ``nlobj.ncols={number of your scan columns}`` and \n",
"``nlobj.nrows={number of your scan rows}``.\n",
"Range of lambda values: [0.001 0.001 0.41923828]\n",
"Optimal Choice: 0.001\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Block 278\n",
"Block 556\n",
"Block 834\n",
"Range of lambda values: [0.65239258 0.90292969 1.15952148]\n",
"Optimal Choice: 0.9029296874999998\n"
]
"data": {
"text/plain": [
"array([0.001 , 0.001 , 0.41923828])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand Down Expand Up @@ -125,13 +126,19 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Chunk size set to nrows: 278\n",
"0.90292966 4 0.0\n",
"Block 0\n",
"Block 278\n",
"Block 556\n",
"Block 834\n"
"lambda: 0.9039062 search radius: 4 dthresh: 0.0\n",
"tiles complete: 36/36\r"
]
},
{
"data": {
"text/plain": [
"'/Users/dave/Desktop/SLMtest/scan2v3_NLPAR_l0.90sr4.up1'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand Down Expand Up @@ -199,7 +206,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.13 ('PyEBSDIndex')",
"display_name": "PyEBSDIndex",
"language": "python",
"name": "python3"
},
Expand All @@ -213,12 +220,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"vscode": {
"interpreter": {
"hash": "3cacad8e052162ebde31eae56cfe36e34759a2ea87d5d6503dd4028aeda06101"
}
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
384 changes: 343 additions & 41 deletions doc/tutorials/ebsd_index_demo.ipynb

Large diffs are not rendered by default.

54 changes: 30 additions & 24 deletions pyebsdindex/EBSDImage/IPFcolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,17 @@
from pyebsdindex.EBSDImage import micronbar, scalarimage


def makeipf(ebsddata, indexer, vector=np.array([0,0,1.0]), xsize = None, ysize = None,
addmicronbar=False, graychannel=None, gamma=1.0, **kwargs):
def makeipf(ebsddata, indexer, vector=np.array([0,0,1.0]), ncols = None, nrows = None,
addmicronbar=False, graychannel=None, gamma=1.0,
xsize = None, ysize = None, # these are kept for backwards compatability.
**kwargs):

# kept around for backwards compatability.
if xsize is not None:
ncols=xsize
if ysize is not None:
nrows = ysize

nphase = len(indexer.phaseLib)

npoints = ebsddata.shape[-1]
Expand All @@ -57,42 +66,39 @@ def makeipf(ebsddata, indexer, vector=np.array([0,0,1.0]), xsize = None, ysize =
ipfout[ebsddata[-1]['fit'] > 179,:] = 0


if xsize is not None:
xsize = int(xsize)
#if ysize is None:
#print(ysize)
if ncols is not None:
ncols = int(ncols)

else:
xsize = indexer.fID.nCols
#xsize = int(npoints)
#ysize = 1
ncols = indexer.fID.nCols

if ysize is not None:
ysize = int(ysize)

if nrows is not None:
nrows = int(nrows)
else:
ysize = int(npoints // xsize + np.int64((npoints % xsize) > 0))
nrows = int(npoints // ncols + np.int64((npoints % ncols) > 0))


ipf_out = np.zeros((ysize, xsize,3), dtype=np.float32)
ipf_out = np.zeros((nrows, ncols, 3), dtype=np.float32)
ipf_out = ipf_out.flatten()
npts = min(int(npoints), int(xsize*ysize))
# if int(xsize*ysize) < npoints:
# npts = int(xsize*ysize)
npts = min(int(npoints), int(ncols * nrows))

ipf_out[0:npts*3] = ipfout[0:npts,:].flatten()
ipf_out = ipf_out.reshape(ysize, xsize, 3)
ipf_out = ipf_out.reshape(nrows, ncols, 3)

if graychannel is not None:
if graychannel == 'fit':
gchan = 'fitinv'
else:
gchan = graychannel
gray = scalarimage.scalarimage(ebsddata, indexer,
xsize=xsize,
ysize=ysize,
addmicronbar=False,
datafield=gchan,
cmap='gray',
rescalenice=True, **kwargs
)
ncols=ncols,
nrows=nrows,
addmicronbar=False,
datafield=gchan,
cmap='gray',
rescalenice=True, **kwargs
)
ipf_out *= gray**gamma


Expand Down
Loading