Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
f6efa1a
Overhaul of data storage in the Map classes
mikesmic Nov 22, 2021
669c609
Add reader for EDAX ang EBSD files
mikesmic Nov 23, 2021
5dea903
bump version
mikesmic Nov 24, 2021
f09ef33
More updates on the new data storage structure
mikesmic Nov 30, 2021
a9d69d0
Add documentation to `Datastore` class
mikesmic Nov 30, 2021
269b4a4
Rename metadata `dims` to `order`
mikesmic Nov 30, 2021
cf6d16c
Add option to not save data produced for by a data generator and just…
mikesmic Nov 30, 2021
f8cb8ee
Update inspector.py
rhysgt Dec 3, 2021
860ca1b
Reimplement rotateData
rhysgt Dec 3, 2021
91a064d
Refactor `calcRDR`
rhysgt Dec 3, 2021
d020724
Improve inspector panel format
rhysgt Dec 3, 2021
bf1142f
Improvements to inspector
rhysgt Dec 4, 2021
717bd8a
Fix EDX data loading
rhysgt Dec 5, 2021
3610917
Update CHANGELOG.md
rhysgt Dec 6, 2021
5d31e5b
Fix minor bugs
rhysgt Dec 6, 2021
4c5b4da
Typos
rhysgt Dec 6, 2021
cc67839
Generate documentation from example notebook
rhysgt Dec 7, 2021
6376097
Documentation bug fix
rhysgt Dec 7, 2021
66a5a3b
Update setup.py
rhysgt Dec 7, 2021
903527b
Correct typo in setup.py
rhysgt Dec 7, 2021
97a5c61
Set up GitHub Actions for testing
rhysgt Dec 7, 2021
7e15727
Update test.yml
rhysgt Dec 7, 2021
8944200
Updates for map component plotting
mikesmic Dec 7, 2021
e46dc86
Remove obsolete plotting methods
mikesmic Dec 7, 2021
c905cc3
Remove travis config
rhysgt Dec 9, 2021
f8eb002
Update example_notebook.ipynb
rhysgt Mar 18, 2022
f6b5d6e
Add new papers to documentation
rhysgt Mar 18, 2022
1a655aa
Remove deprecated in_place arg to remove_small_objects
jni Jan 12, 2023
2b6b440
Bump minimum skimage version to 0.19
jni Jan 12, 2023
be50fa7
Merge pull request #101 from jni/small-objects
mikesmic Jan 12, 2023
2866b25
Fix deprecation errors and warnings
mikesmic Jan 19, 2023
b790181
Fix bug loding oxford .cpr files
mikesmic Jan 31, 2023
8770469
Add linking of multiple datastore
mikesmic Jan 31, 2023
5406228
Create class for storing map boundaries
mikesmic Jan 31, 2023
fc98033
Lots of updates around data storage
mikesmic Feb 12, 2023
c3c9da2
Add reader for OpenPIV data files
mikesmic Mar 2, 2023
dd29c60
Lots of fixes for name changes
mikesmic Mar 2, 2023
b1b5474
Updates to Datastore
mikesmic Mar 2, 2023
24201c9
Start refactoring example notebook
mikesmic Mar 2, 2023
17d2e61
Update papers.rst
rhysgt Aug 29, 2023
e64f275
Fix docs and add papers
rhysgt Sep 27, 2023
2b7ec3b
Fix docs dependency error
rhysgt Sep 27, 2023
718fdad
Fix some bugs due to function name changes
rhysgt Sep 29, 2023
b4958c0
Continue changing variable names to snake_case
rhysgt Oct 11, 2023
ed2bd23
Updates to example notebook
mikesmic Oct 11, 2023
bd1cbd5
Update usage of scipy.stats.mode
mikesmic Oct 11, 2023
eb3adc6
Fix tests?
rhysgt Oct 11, 2023
d8c2526
Continue changing to snake_case
rhysgt Oct 12, 2023
f23284f
Merge branch 'master' into develop
mikesmic Oct 12, 2023
5498b87
Remove `base.Map.check_grains_detected`
mikesmic Oct 13, 2023
fdbf777
Fix example notebook after merge
mikesmic Oct 13, 2023
6841177
Finish changing to snake_case
rhysgt Oct 15, 2023
61ae6aa
Fix readthedocs
rhysgt Oct 16, 2023
0c9171c
Fix sphinx config
rhysgt Oct 16, 2023
9df598a
Fix bug in sphinx docs config file
rhysgt Oct 16, 2023
6249dae
Add papers
rhysgt Oct 16, 2023
43e7568
Use regionprops instead of image == label when grain-finding
jni Jun 7, 2023
bc04a5c
Use numba for accelerated flood fill
jni Oct 25, 2023
9a0664c
Use numba in hrdic flood fill
jni Jun 21, 2023
a3e9882
Copy buffer after flood fill to avoid overwriting
jni Oct 31, 2023
f8fc4f3
Add missing initial coordinate from flood-fill
jni Oct 31, 2023
4f20b66
Fix tests
mikesmic Nov 3, 2023
a7efa07
Fix paths in tests
mikesmic Nov 6, 2023
79bd335
Add tests for `ebsd.Map.find_grains`
mikesmic Nov 6, 2023
6844323
Add tests for `hrdic.Map.find_grains` with warp algorithm
mikesmic Nov 6, 2023
482017c
Merge branch 'develop' into pr/104
mikesmic Nov 6, 2023
dfd2998
Change `grain.data.point` to an array
mikesmic Nov 6, 2023
a93cc74
Fix test
mikesmic Nov 6, 2023
8e91675
Remove flood_fill methods from maps
mikesmic Nov 7, 2023
8663497
More testing of `hrdic.Map.find_grains`
mikesmic Nov 7, 2023
24ffb28
Require python >= 3.8
mikesmic Nov 7, 2023
d656cc8
Remove py 3.12
mikesmic Nov 7, 2023
1e586b1
Update use of buffer in floodfill
mikesmic Nov 7, 2023
a54de27
Merge pull request #104 from jni/optimise-grain-finding-3
mikesmic Nov 7, 2023
6ccd458
Update file reading
mikesmic Nov 9, 2023
1727c0e
Update experiment class and add example usage
mikesmic Nov 9, 2023
fcd85cd
Update example notebook
mikesmic Nov 9, 2023
b707c55
Fix tests
mikesmic Nov 10, 2023
2664393
Update proxigram and add tests
mikesmic Nov 10, 2023
dafc1ca
Fix readthedocs?
rhysgt Jan 18, 2024
6e2453a
Move RDR calculation into ebsd
rhysgt Jan 24, 2024
32aa761
Update papers.rst
rhysgt Jan 24, 2024
0496217
Update papers.rst
rhysgt Feb 15, 2024
3cb1161
Improve masking
rhysgt Apr 15, 2024
b6bef39
Fix pytest bug
rhysgt Apr 15, 2024
1c5459d
Update base.py
rhysgt Apr 15, 2024
0ac1cde
Update hrdic.py
rhysgt Apr 15, 2024
3c639ca
Store mask array in datastore and use metadata key to check if data s…
mikesmic Apr 17, 2024
7a4f5ae
Update hrdic.py
rhysgt Apr 17, 2024
b44d330
Update CHANGELOG.md
rhysgt Apr 17, 2024
d2fc3b9
Add paper
rhysgt Apr 17, 2024
4ba91e5
Pass a normal array is masking turned off
rhysgt Apr 24, 2024
bb80dbf
Update nCorrToDavis.m
rhysgt Apr 29, 2024
b299f35
Add option for both IPF triangle up and down
rhysgt Dec 3, 2024
0ee0826
DefDAP consistent with mtex/aztec for hcp
rhysgt Dec 5, 2024
b27b18a
Revert calc_fund_dirs and modify plot_ipf instead
rhysgt Dec 5, 2024
4cf32ef
Fix IPF plotting
mikesmic Dec 9, 2024
212a1b6
Update papers.rst
rhysgt Dec 16, 2024
cb858f4
Patch
rhysgt Jan 30, 2025
609e236
Add support for openpiv npz export
rhysgt Feb 3, 2025
af4ea15
Update papers.rst
rhysgt May 9, 2025
7f4ffb0
Update grain data extraction
mikesmic Jul 28, 2025
de12e34
Add loaded for pyvale dic csv files
mikesmic Jul 28, 2025
334cd25
Fix display bug
rhysgt Jul 31, 2025
fdfec1e
Update hrdic.py
rhysgt Jul 31, 2025
d880c4b
Update inspector.py
rhysgt Jul 31, 2025
82b3e35
Fix tests
rhysgt Aug 1, 2025
c8fc661
Merge branch 'develop' into dev_openpiv_npz
rhysgt Aug 1, 2025
c191d03
Add support for npz file format from openpiv
rhysgt Aug 1, 2025
5e638fe
Merge pull request #142 from MechMicroMan/develop
rhysgt Aug 4, 2025
f6d04a9
Add test for calc_ipf_colours
rhysgt Aug 4, 2025
82232ad
Fix cubic ipf colours
rhysgt Aug 4, 2025
badac70
Tidy
rhysgt Aug 4, 2025
bd4cca5
Update pyvale DIC loader for binary files
mikesmic Aug 4, 2025
5dc221e
Add test for `calc_fund_dirs`
rhysgt Aug 4, 2025
304dbc1
Add another orientation to ipf colour test
rhysgt Aug 4, 2025
15dad68
Adjust atol for allclose
rhysgt Aug 4, 2025
b23393e
Update test_quat.py
rhysgt Aug 5, 2025
dccc1ad
Update pyvale reader
mikesmic Aug 12, 2025
43e480d
Remove extra IPF convention
mikesmic Aug 12, 2025
18d3596
Fix bug with homologous point selection
mikesmic Nov 4, 2025
5edb656
Fix bugs in plotting
rhysgt Nov 4, 2025
da06ace
Merge branch 'develop' of https://github.com/MechMicroMan/DefDAP into…
mikesmic Nov 4, 2025
54b07a5
Fix bug with locate_grain with display_selected enabled
mikesmic Nov 4, 2025
fa0576a
Add `advanced_notebook`
rhysgt Nov 5, 2025
3768704
Create `plot_map` method for grains
mikesmic Nov 5, 2025
ccd2534
Update .gitignore
rhysgt Nov 5, 2025
b104244
Update hrdic.py
rhysgt Nov 5, 2025
9b631f7
Update CHANGELOG.md
rhysgt Nov 5, 2025
83465cc
Update copyright year
rhysgt Nov 5, 2025
3f6ab6c
Add extra space between IPF triangle and labels
rhysgt Nov 5, 2025
2f6547e
Update advanced_notebook.ipynb
mikesmic Nov 5, 2025
97784c0
Update example_notebook.ipynb
mikesmic Nov 5, 2025
75c8c82
Merge branch 'develop' into mask
mikesmic Nov 5, 2025
2110757
Merge pull request #122 from MechMicroMan/mask
mikesmic Nov 5, 2025
e795e64
Merge pull request #135 from MechMicroMan/hcp_ipf_fix
mikesmic Nov 5, 2025
015d247
Remove data
mikesmic Nov 5, 2025
4327048
Merge branch 'develop' of https://github.com/MechMicroMan/DefDAP into…
mikesmic Nov 5, 2025
10add04
Merge branch 'master' into develop
mikesmic Nov 5, 2025
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
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test DefDAP

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pytest
python -m pip install .[testing]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Test with pytest
run: |
pytest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ DefDAP.egg-info/

# coverage
.coverage

# vscode
.vscode
File renamed without changes.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ python:
- method: pip
path: .
extra_requirements:
- docs
- docs
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

52 changes: 43 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
# Change Log


## Current

### Added
- Each grain is assigned a phase and slip systems are automatically loaded
for a given phase based on crystal structure.
- This means that unit cells and slip traces plot correctly for grains
in a multi-phase EBSD map
- Add slip system file for FCC but in same order as DAMASK
- Use example_notebook to generate a 'How To Use' page in the documentation
- Add reader for EDAX .ang EBSD files, pyvale .csv files and openPIV-XL .npx files
- Added a `plot_map` function for grains
- Added more testing

### Changed
- All functions and arguments are now in snake_case instead of CamelCase
- Cropping and masking are now performed upon access to data
- Changed function names from CamelCase to snake_case
- Overhaul of data storage in the Map classes
- RDR calculation `calcRDR` in grain inspector is faster and more robust
- Improve formatting of grain inspector and RDR plot window
- Refactor boundary lines calculations
- Use GitHub actions to run `pytest` on commit push or pull request

### Fixed
- Fix bug in grain inspector (`None` passed to `corrAngle` inadvertently)
- Fix EBSD grain linker
- Remove `IPython` and `jupyter` as requirements
- Bug in IPF traiangle plotting now fixed with options for `up` triangle (like MTEX) and `down` triangle (like OI)


## 0.93.5 (20-11-2023)

### Added
- Add more options for colouring lines

### Fixed
- Fix bug with accessing slip systems in grain inspector
- Replace np.float with python float
- Remove in_place argument to skimage.morphology.remove_small_objects
- set_window_title has been moved from figure.canvas to figure.canvas.manager


## 0.93.5 (20-11-2023)
Expand All @@ -24,7 +58,7 @@
## 0.93.5 (17-01-2023)

### Added
- Add equality check for Quat
- Add equality check for `Quat`

### Fixed
- Fix bug in boundary line warping
Expand Down Expand Up @@ -59,7 +93,7 @@
## 0.93.2 (16-04-2021)

### Added
- Reading of Channel project files that contain EDX data
- Reading of Channel5 project files that contain EDX data

### Fixed
- Plotting unit cells
Expand All @@ -75,21 +109,21 @@

### Changed
- Speed up EBSD map data rotation
- Speed up 'warp' grain finding
- Speed up `warp` grain finding
- Store band slope and MAD arrays from EBSD
- Update nCorrToDavis.m script
- Update `nCorrToDavis.m` script
- Better description of how to use the function
- Sub-window size is subset radius * 2, as defined in nCorr
- Subset spacing is subset spacing, as defined in nCorr
- Generate phase boundary points and lines at same time as grain boundaries
- Improve histogram plotting
- Options for scatter (as before), step and bar
- Options for logx, logy, loglog and linear
- Options for scatter (as before), `step` and `bar`
- Options for `logx`, `logy`, `loglog` and `linear`
- Updates to example notebook

### Fixed
- Fixed docstring links
- Fix bug in 'warp' grain finding algorithm
- Fix bug in `warp` grain finding algorithm


## 0.93.0 (20-02-2021)
Expand All @@ -108,7 +142,7 @@
- Add misorientation calculation between neighbouring EBSD grains.
- Add a `BoundarySegment` class to represent a section of grain boundary between 2 grain in an EBSD map. Objects of this class are assigned to edges of the neighbour network and contain all the boundary points between the grains.
- Add Kuwahara filter for EBSD map noise reduction.
- Add shape property to maps.
- Add `shape` property to maps.
- Read EBSD phases from file.
- Add classes to represent phases and crystal structures.

Expand All @@ -125,7 +159,7 @@
- Change docs over to readthedocs.
- Move version number to own file.
- Update neighbour network to use grains as nodes.
- Store grainID in grain objects.
- Store `grainID` in grain objects.
- Split plotGrainDataMap into separate array construction and plotting function.
- Update neighbour network construction to use new EBSD boundary definition.
- Update flood fill algorithm for grain finding in a EBSD map.
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## How to install
- DefDAP can be installed from PyPI using the command `pip install defdap`
- If you use conda as your package manager (https://www.anaconda.com/), the prerequisite packages that are available from anaconda can be installed using the command `conda install scipy numpy matplotlib scikit-image pandas networkx jupyter ipython` (Anaconda3-2020.02 has been tested)
- If you use conda as your package manager (https://www.anaconda.com/), the prerequisite packages that are available from anaconda can be installed using the command `conda install scipy numpy matplotlib scikit-image pandas networkx` (Anaconda3-2020.02 has been tested)
- For more information, see the [documentation](https://defdap.readthedocs.io/en/latest/installation.html)

## How to use
Expand All @@ -43,8 +43,6 @@ The software uses the following open source packages:
- [pandas](http://pandas.pydata.org)
- [peakutils](https://peakutils.readthedocs.io/en/latest/)
- [matplotlib_scalebar](https://pypi.org/project/matplotlib-scalebar/)
- [IPython](https://ipython.org/)
- [jupyter](https://jupyter.org/)

## License
[Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0)
8 changes: 7 additions & 1 deletion defdap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from defdap.experiment import Experiment

defaults = {
# Convention to use when attaching an orthonormal frame to a crystal
# structure. 'hkl' or 'tsl'
Expand All @@ -14,6 +16,10 @@
'slip_system_file': {
'FCC': 'cubic_fcc',
'BCC': 'cubic_bcc',
'HCP': 'hexagonal_noca',
'HCP': 'hexagonal_withca',
},
# up or down
'ipf_triangle_convention': 'up'
}

anonymous_experiment = Experiment()
163 changes: 163 additions & 0 deletions defdap/_accelerated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Copyright 2025 Mechanics of Microstructures Group
# at The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from numba import njit
import numpy as np


@njit
def find_first(arr):
for i in range(len(arr)):
if arr[i]:
return i


@njit
def flood_fill(seed, index, points_remaining, grains, boundary_x, boundary_y,
added_coords):
"""Flood fill algorithm that uses the x and y boundary arrays to
fill a connected area around the seed point. The points are inserted
into a grain object and the grain map array is updated.

Parameters
----------
seed : tuple of 2 int
Seed point x for flood fill
index : int
Value to fill in grain map
points_remaining : numpy.ndarray
Boolean map of the points that have not been assigned a grain yet

Returns
-------
grain : defdap.ebsd.Grain
New grain object with points added
"""
x, y = seed
grains[y, x] = index
points_remaining[y, x] = False
edge = [seed]
added_coords[0] = seed
npoints = 1

while edge:
x, y = edge.pop()
moves = [(x+1, y), (x-1, y), (x, y+1), (x, y-1)]
# get rid of any that go out of the map area
if x <= 0:
moves.pop(1)
elif x > grains.shape[1] - 2:
moves.pop(0)
if y <= 0:
moves.pop(-1)
elif y > grains.shape[0] - 2:
moves.pop(-2)

for (s, t) in moves:
if grains[t, s] > 0:
continue

add_point = False

if t == y:
# moving horizontally
if s > x:
# moving right
add_point = not boundary_x[y, x]
else:
# moving left
add_point = not boundary_x[t, s]
else:
# moving vertically
if t > y:
# moving down
add_point = not boundary_y[y, x]
else:
# moving up
add_point = not boundary_y[t, s]

if add_point:
added_coords[npoints] = s, t
grains[t, s] = index
points_remaining[t, s] = False
npoints += 1
edge.append((s, t))

return added_coords[:npoints]


@njit
def flood_fill_dic(seed, index, points_remaining, grains, added_coords):
"""Flood fill algorithm that uses the combined x and y boundary array
to fill a connected area around the seed point. The points are returned and
the grain map array is updated.

Parameters
----------
seed : tuple of 2 int
Seed point x for flood fill
index : int
Value to fill in grain map
points_remaining : numpy.ndarray
Boolean map of the points remaining to assign a grain yet
grains : numpy.ndarray
added_coords : numpy.ndarray
Buffer for points in the grain

Returns
-------
numpy.ndarray
Flooded points (n, 2)

"""
# add first point to the grain
x, y = seed
grains[y, x] = index
points_remaining[y, x] = False
edge = [seed]
added_coords[0] = seed
npoints = 1

while edge:
x, y = edge.pop()

moves = [(x+1, y), (x-1, y), (x, y+1), (x, y-1)]
# get rid of any that go out of the map area
if x <= 0:
moves.pop(1)
elif x >= grains.shape[1] - 1:
moves.pop(0)
if y <= 0:
moves.pop(-1)
elif y >= grains.shape[0] - 1:
moves.pop(-2)

for (s, t) in moves:
add_point = False

if grains[t, s] == 0:
add_point = True
edge.append((s, t))

elif grains[t, s] == -1 and (s > x or t > y):
add_point = True

if add_point:
added_coords[npoints] = (s, t)
grains[t, s] = index
points_remaining[t, s] = False
npoints += 1

return added_coords[:npoints]
2 changes: 1 addition & 1 deletion defdap/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.93.6'
__version__ = '0.93.6dev'
Loading