Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorization of xrd_simulator #9

Merged
merged 321 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
321 commits
Select commit Hold shift + click to select a range
b5d0571
trying macos build
Jan 5, 2022
19b0c58
macos workflow work
Jan 5, 2022
7df7e76
trying macos build
Jan 5, 2022
bb7bbc6
macos ci sudo priviledge
Jan 5, 2022
35f6d7b
logo added
Jan 5, 2022
8a39580
logo tweak
Jan 5, 2022
e8eecfe
repair the docs
Jan 5, 2022
b97814c
remove image target
Jan 5, 2022
2cf6043
fixing docs
Jan 5, 2022
9ec2f11
rolback to Weilzl algorithm as implemented in miniball
Jan 5, 2022
8aee9eb
Work on docs
Jan 5, 2022
82f54d4
bumping version to 0.1.6 and distributing
Jan 5, 2022
863836e
igonre release file
Jan 5, 2022
3e99450
remove autoreleae
Jan 5, 2022
285fd79
bumping version to 0.1.7 and distributing
Jan 5, 2022
b7eb8a2
bumping version to 0.1.8 and distributing
Jan 5, 2022
ad64874
bumping version to 0.1.9 and distributing
Jan 5, 2022
b5d8fd7
bumping version to 0.2.0 and distributing
Jan 5, 2022
2cf84ad
bumping version to 0.2.1 and distributing
Jan 5, 2022
8e56393
bumping version to 0.2.2 and distributing
Jan 5, 2022
d64af93
bumping version to 0.2.3 and distributing
Jan 5, 2022
ca12056
bumping version to 0.2.4 and distributing
Jan 5, 2022
f4422c0
bumping version to 0.2.5 and distributing
Jan 5, 2022
8e32ed0
bumping version to 0.2.6 and distributing
Jan 5, 2022
0d094a6
bumping version to 0.2.7 and distributing
Jan 5, 2022
25b2c41
Readme
Jan 7, 2022
2b4fa9c
readme changes
Jan 7, 2022
32db795
README update
Jan 7, 2022
43a3ae0
README updates
Jan 7, 2022
5b160dd
readme
Jan 7, 2022
c8521f5
Bumped version to 0.2.9 and released to pypi.org
Jan 7, 2022
26b8ed1
Bumped version to 0.3.0 and released to pypi.org
Jan 7, 2022
8a00ad1
Released pypi version 0.3.0 to anaconda.org
Jan 7, 2022
231cd6c
README credits added
Jan 7, 2022
518f74b
automating code inclusion in README.rst
Jan 8, 2022
f61beff
Refactoring detector and examples
Jan 8, 2022
866ad3d
fix docs logo rendering
Jan 8, 2022
8d8f510
Alpha release tag added
Jan 8, 2022
692a471
Work on basic walkthrough examples
Jan 8, 2022
ade65a5
Allow for strain representation of polycrystal
Jan 8, 2022
25298cb
test polycrystal and add mesh saving
Jan 9, 2022
d95acc0
Adding a motion example
AxelHenningsson Jan 9, 2022
820d2b9
some pep8 comforming
AxelHenningsson Jan 9, 2022
117b820
Running flake8 and cleaning up
AxelHenningsson Jan 9, 2022
2db5a7d
work on end to end example and example parameter tuning
AxelHenningsson Jan 9, 2022
2c799ed
remove mesh saving in example
AxelHenningsson Jan 9, 2022
ce60a74
remove ignored files from git cache
AxelHenningsson Jan 9, 2022
8637b5d
impleent :lines: in serve doc
AxelHenningsson Jan 9, 2022
d722577
Added diffraction pattern example image
AxelHenningsson Jan 9, 2022
d2dc62c
Align example image
AxelHenningsson Jan 9, 2022
3c5d04c
updates to README
AxelHenningsson Jan 9, 2022
661b63b
README updates
AxelHenningsson Jan 9, 2022
a213a69
more readme updates
AxelHenningsson Jan 10, 2022
74ed5a3
fix some readme bugs
AxelHenningsson Jan 10, 2022
6719533
Add transform() example to readme
AxelHenningsson Jan 10, 2022
c5f5042
fix readme typo
AxelHenningsson Jan 10, 2022
db68b20
update filename readme
AxelHenningsson Jan 10, 2022
9c7566c
readme language
AxelHenningsson Jan 10, 2022
51242cc
Bumped version to 0.3.1 and released to pypi.org
AxelHenningsson Jan 10, 2022
20cc626
Released pypi version 0.3.1 to anaconda.org
AxelHenningsson Jan 10, 2022
42c3982
replace Welzl miniball by a simplified iterative method
AxelHenningsson Jan 10, 2022
204b9dc
Trying to add -conda-forge to .condarc
AxelHenningsson Jan 11, 2022
db1ce61
Bumped version to 0.3.2 and released to pypi.org
AxelHenningsson Jan 11, 2022
227779a
removed build in meat.yaml
AxelHenningsson Jan 11, 2022
c991197
solving python version issues
AxelHenningsson Jan 11, 2022
736b61f
Bumped version to 0.3.3 and released to pypi.org
AxelHenningsson Jan 11, 2022
b821768
removing redundant build.sh
AxelHenningsson Jan 11, 2022
2f977b6
Bumped version to 0.3.4 and released to pypi.org
AxelHenningsson Jan 11, 2022
ce29aea
Released pypi version 0.3.4 to anaconda.org
AxelHenningsson Jan 11, 2022
cb07a46
try to specify conda-forge dependecy
AxelHenningsson Jan 11, 2022
0d895f7
Bumped version to 0.3.5 and released to pypi.org
AxelHenningsson Jan 11, 2022
dfff20f
temporary rollback conda forge manual adding
AxelHenningsson Jan 11, 2022
9d40150
Released pypi version 0.3.5 to anaconda.org
AxelHenningsson Jan 11, 2022
202e8d8
serve docs and try meta.yaml updates
AxelHenningsson Jan 13, 2022
cff68b4
try to specify channel in meta.yaml
AxelHenningsson Jan 13, 2022
6283116
try some more channel dependecy stuff
AxelHenningsson Jan 13, 2022
8d1b8e6
make conda respect python in meta.yaml
AxelHenningsson Jan 13, 2022
e131dd0
Bumped version to 0.3.6 and released to pypi.org
AxelHenningsson Jan 13, 2022
c87d53c
change python specs
AxelHenningsson Jan 13, 2022
29a3a5f
messing about with the conda recipie
AxelHenningsson Jan 13, 2022
9bc4cde
Bumped version to 0.3.7 and released to pypi.org
AxelHenningsson Jan 13, 2022
8369d4a
Released pypi version 0.3.7 to anaconda.org
AxelHenningsson Jan 13, 2022
54c37f5
add forge back to build scripts
AxelHenningsson Jan 13, 2022
8d81425
updates to .yaml and urls
AxelHenningsson Jan 13, 2022
8cc8dfb
trying noarch distribution for conda
AxelHenningsson Jan 13, 2022
2f40600
Bumped version to 0.3.8 and released to pypi.org
AxelHenningsson Jan 13, 2022
ee6fe7c
Released pypi version 0.3.8 to anaconda.org
AxelHenningsson Jan 13, 2022
c49b9b4
Allow for arbitrary matplotlib versions, trying to extend python vers…
AxelHenningsson Jan 13, 2022
37c6378
Bumped version to 0.3.9 and released to pypi.org
AxelHenningsson Jan 13, 2022
f6c6661
try to get python verison in there
AxelHenningsson Jan 13, 2022
c3b78f6
Bumped version to 0.3.10 and released to pypi.org
AxelHenningsson Jan 13, 2022
e0fb588
Released pypi version 0.3.10 to anaconda.org
AxelHenningsson Jan 13, 2022
afa4e5a
update actions
AxelHenningsson Jan 13, 2022
753e015
conda install from conda-forge updated
AxelHenningsson Jan 14, 2022
8d19b81
reserve the docs
AxelHenningsson Jan 14, 2022
1682c86
add beam unittest for setting vertices
AxelHenningsson Jan 16, 2022
c77a84e
update readme
AxelHenningsson Jan 16, 2022
0bc6871
Initiating owork on documentation and refactoring cleanup
AxelHenningsson Jan 16, 2022
22fc5d4
end to end test changes
AxelHenningsson Jan 19, 2022
b7e61bd
fix lorentz factor normalisation
AxelHenningsson Jan 20, 2022
d2e0dd6
notes
AxelHenningsson Jan 20, 2022
96d8119
cleanup polycrystal __init__ and some minor unittest changes
AxelHenningsson Jan 25, 2022
65ffea3
Support save via pickle for class RigidBodyMotion
AxelHenningsson Jan 25, 2022
c8c4f94
Change to print from sys
AxelHenningsson Jan 29, 2022
86f14ae
fail at renderig when structure_factors are true but .cif is lacking
AxelHenningsson Feb 3, 2022
7cd9c9f
Add xfab mod missing LICENSE.txt file
AxelHenningsson Feb 6, 2022
31a425e
work on air scattering
AxelHenningsson Mar 16, 2022
3a0722a
fix passing cif path in test_templates.py
AxelHenningsson Mar 16, 2022
119084d
updates to lorentz
AxelHenningsson Mar 16, 2022
31b20b7
Add point spread function to detector class.
AxelHenningsson Mar 18, 2022
cd1b0ca
Transition pickling to dill allowing mutating psf
AxelHenningsson Mar 18, 2022
a91dcb8
removing dependecy version pinns.
AxelHenningsson Mar 18, 2022
63af341
Bumped version to 0.3.11 and released to pypi.org
AxelHenningsson Mar 18, 2022
4131231
latest conda build
AxelHenningsson Mar 18, 2022
3cf655b
Remove bundled xfab version in favor of external version (now on cond…
AxelHenningsson Apr 2, 2022
a8887a0
Seperate conda build and pytest by using semi-manual build actions
AxelHenningsson Apr 2, 2022
8ca9a44
Remove last-updated badge from README
AxelHenningsson Apr 2, 2022
aa40c12
make release scripts local
AxelHenningsson Apr 2, 2022
bc3caad
Remove extra scripts
AxelHenningsson Apr 2, 2022
cb4d0cc
Bumped version to 0.3.12 and released to pypi.org
AxelHenningsson Apr 2, 2022
801c388
README updates
AxelHenningsson Apr 6, 2022
bfc9c73
updates to docs
AxelHenningsson Apr 9, 2022
2c406cd
Updates to beam.py docs
AxelHenningsson Apr 9, 2022
6df398b
Make save and load custom and module level
AxelHenningsson Apr 9, 2022
78f5ead
Re-rendered docs
AxelHenningsson Apr 9, 2022
3c22d10
Improve polycrystal.py docs
AxelHenningsson Apr 10, 2022
580a15c
Refactor scatterer.py
AxelHenningsson Apr 10, 2022
97f3dfa
Fix example
AxelHenningsson Apr 10, 2022
4ecb9fd
Bumped version to 0.3.13 and released to pypi.org
AxelHenningsson Apr 10, 2022
40cbd9b
Update detector.py docs
AxelHenningsson Apr 10, 2022
49df25a
Updates to motion.py docs
AxelHenningsson Apr 10, 2022
af3e41e
Update laue.py docs
AxelHenningsson Apr 10, 2022
e5c7354
Refactor parametric laue
AxelHenningsson Apr 10, 2022
9e3c0cf
Updates to mesh.py docs
AxelHenningsson Apr 10, 2022
5a3b88c
update mesh image
AxelHenningsson Apr 10, 2022
d63262a
updates to mesh docs
AxelHenningsson Apr 10, 2022
5766a6e
Removed unused code in mesh.py
AxelHenningsson Apr 10, 2022
268cbaf
updates to phase.py docs
AxelHenningsson Apr 10, 2022
7b688f1
updates to phase.py docs
AxelHenningsson Apr 10, 2022
72aac78
Updates to scattering_unit.py
AxelHenningsson Apr 10, 2022
bc295f5
updates to templates.py docs
AxelHenningsson Apr 10, 2022
be3de95
re-serve docs
AxelHenningsson Apr 10, 2022
79c7c56
cleanup tests
AxelHenningsson Apr 10, 2022
76162e8
Minimal unittests for mesh.py
AxelHenningsson Apr 10, 2022
1af23fe
docs fixes for mesh.py
AxelHenningsson Apr 10, 2022
75c265f
Bumped version to 0.3.14 and released to pypi.org
AxelHenningsson Apr 10, 2022
ec4fdf1
GitHub Action updates
AxelHenningsson Apr 10, 2022
31a2235
fix windows build
AxelHenningsson Apr 10, 2022
9c7616f
fix windows build yml
AxelHenningsson Apr 10, 2022
23d527b
updates to README
AxelHenningsson Apr 10, 2022
fb06258
updates and render to README
AxelHenningsson Jun 8, 2022
a59611f
add h5py and netcdf4 to setup.py
AxelHenningsson Jun 8, 2022
898940a
Bumped version to 0.3.15 and released to pypi.org
AxelHenningsson Jun 8, 2022
dd4b8b7
readme docs updates
AxelHenningsson Jun 10, 2022
951d08e
New titles for .xdmf fields in polycrystal.save()
AxelHenningsson Jun 10, 2022
4c6af08
README typo correction
AxelHenningsson Jun 10, 2022
fa910ff
Bug fix to polycrystal save
AxelHenningsson Jul 31, 2022
6370923
Fix Detector frame size bug
AxelHenningsson Jul 31, 2022
b8d7817
Vectorize pixel coordinate creation for speed
AxelHenningsson Jul 31, 2022
50bb789
Throttle diffraction progress bar update rate
AxelHenningsson Aug 2, 2022
b3b11b1
prepping for faster proximity checks
AxelHenningsson Aug 2, 2022
d2ce422
.gitignore updates
AxelHenningsson Aug 2, 2022
65d18ce
Performance boosts to Polycrystal.transform
AxelHenningsson Aug 2, 2022
4e2c088
Added approximate collision detection as default for speed
AxelHenningsson Aug 2, 2022
c93200f
Diffraction loop optimisation
AxelHenningsson Aug 2, 2022
cbe4814
optimization
AxelHenningsson Aug 29, 2022
83f1d5d
optimization to beam
AxelHenningsson Aug 29, 2022
4dbeec1
Adding parallel runs for diffraction computation
AxelHenningsson Aug 29, 2022
37ea024
optimization
AxelHenningsson Aug 30, 2022
7b49fb8
work on optimisation of proximity intervalls
AxelHenningsson Aug 31, 2022
81e3fca
Heavy optimisation and fixed rotation axis frame splitting implemented
AxelHenningsson Sep 1, 2022
53ca14a
optimize frame splitting
AxelHenningsson Sep 1, 2022
73280c1
OPtimisation and paralellisation to rendering
AxelHenningsson Sep 2, 2022
b7dc7f6
ODF docs example
AxelHenningsson Sep 6, 2022
d354fa0
fix import in example docs
AxelHenningsson Sep 6, 2022
ebec3b6
Fix np.nan bug in detector and add unit test
AxelHenningsson Sep 6, 2022
0e41c9c
Remove debug leftovers
AxelHenningsson Sep 6, 2022
4de1582
docs for templates
AxelHenningsson Sep 16, 2022
f077b19
doc fixes
AxelHenningsson Sep 16, 2022
90a2914
Bumped version to 0.4.0 and released to pypi.org
AxelHenningsson Sep 16, 2022
6f3efea
theta eta computation utility added to detector
AxelHenningsson Sep 20, 2022
56e6826
Handle corner case feasible points with zeros in slack
AxelHenningsson Sep 24, 2022
d6b2186
Added centroid rendering with better scintilator models
AxelHenningsson Oct 4, 2022
290949e
Docs and fixes for new optional rendering method
AxelHenningsson Oct 5, 2022
993d8ff
handle non-orthogonal detector sides
AxelHenningsson Oct 13, 2022
2f0fbe2
add translate and rotate funcs on mesh
AxelHenningsson Oct 24, 2022
cb83ab3
Default to Green-Lagrange large strain tensor interpretation
AxelHenningsson Oct 26, 2022
6119f34
Fixes for workflow tests on linux
AxelHenningsson Oct 26, 2022
4dbb87f
Investigating Linux build errors
AxelHenningsson Oct 26, 2022
65a5e9b
Investigating Linux build errors
AxelHenningsson Oct 26, 2022
ece55eb
Investigating Linux build errors
AxelHenningsson Oct 26, 2022
4f6f0fb
README updates
AxelHenningsson Oct 26, 2022
1a4b182
packaging for more python version
AxelHenningsson Nov 14, 2022
ad26d2f
packaging for more python version
AxelHenningsson Nov 14, 2022
f514230
Bumped version to 0.4.1 and released to pypi.org
AxelHenningsson Nov 14, 2022
fc48f6d
adding optional origin argument to RigidBodyMotion
AxelHenningsson Nov 17, 2022
d8cbfc7
Making RigidBodyMotion.rotate detached from the origin for vector rot…
AxelHenningsson Nov 18, 2022
11dfffa
Added package citation links
AxelHenningsson Apr 7, 2023
90df8dc
patching github actions
AxelHenningsson Apr 7, 2023
054c11b
Update README.rst
AxelHenningsson Jun 15, 2023
89fb26b
Allow new python versions
jonwright Oct 27, 2023
dad60ec
tighten bounds on possible scattering angles
AxelHenningsson Dec 4, 2023
ed2f71c
Merge pull request #5 from AxelHenningsson/main
AxelHenningsson Dec 4, 2023
a20a8fd
Modifications in mesh polycrystal and utils for performance (Tensor o…
Mar 5, 2024
b74cbe5
Modified files to proceed with vectorization
Mar 6, 2024
2b88661
reflections_df summarizes all relevant data in _diffract
Mar 6, 2024
838c734
Diffraction method almost fully vectorized
Mar 8, 2024
334367d
Sample generation and diffraction vectorized. Missing euler angles wh…
Mar 11, 2024
2030a49
All working, but sample creation slow. Starting _eB optimization
Mar 12, 2024
fe37029
Vectorized the eB calculation in polycrystal.py
Mar 12, 2024
9f7bd65
tests adapted to file structure
Mar 12, 2024
9ba46d2
Gitignore updated
Mar 13, 2024
5d42499
Vectorization in progress for tomographic runs"
Mar 14, 2024
c6f0b66
Further optimized for tomography
Mar 14, 2024
af4e447
Added breakpoints
Mar 18, 2024
2e884a6
Breakpoint
Mar 18, 2024
5e593d0
debug
Mar 18, 2024
f42c27d
debug
Mar 18, 2024
8eecd45
debug
Mar 18, 2024
e80c026
debug
Mar 18, 2024
8156860
debug
Mar 18, 2024
bc021a2
changed stuff in get_G
Mar 18, 2024
ee89688
debug
Mar 18, 2024
58c85d8
debug
Mar 18, 2024
591b342
debug
Mar 18, 2024
0810983
debug
Mar 18, 2024
e7c5165
The issue is probably in the BB filtering due to too many reflections…
Mar 18, 2024
c167af4
Added radius of mean ecentroid to BB
Mar 18, 2024
153c453
Found out that BB was failing for confusing xyz
Mar 18, 2024
8cb11c5
BB_intersection updated to use the radius of each grain
Mar 19, 2024
e79e4fc
Removed original files
Apr 8, 2024
ec52894
makefile added to gitignore
Apr 10, 2024
307a7d0
Merge branch 'vectorization'
Marcraven Apr 11, 2024
8c061bf
Some comments added
Marcraven Apr 11, 2024
2c1af48
Bug fixed in polycrystal.py
Marcraven Apr 11, 2024
d3143a2
Pandas added to the required packages to install in setup.py
Marcraven Apr 30, 2024
516af6f
Corrected minor bugs
Marcraven Apr 30, 2024
1899b63
Tests verified to pass with the vectorized implementation.
Marcraven May 31, 2024
d673d31
Removed unnecesary imports
Marcraven May 31, 2024
adf039b
"Strange docstring fixed in render"
Marcraven Jun 12, 2024
00aea38
minor docstring fix
Marcraven Jun 12, 2024
1639084
Fixed the docstring of lab_strain_to_B_matrix
Marcraven Jun 12, 2024
2f9e274
Docstring added. Som internal functions hidden to the user
Marcraven Jun 12, 2024
c3e1f42
Docstring modified.
Marcraven Jun 12, 2024
73eb1c2
Hidden functions modified wherever they were called
Marcraven Jun 12, 2024
33308e0
Added by Axel
Marcraven Jun 12, 2024
4b4ec3e
Changes with respect to radii
Marcraven Jun 12, 2024
12ed080
Added some docstrings
Marcraven Jun 12, 2024
b0d4e70
ConvexHull added back to polycrystal
Marcraven Jun 12, 2024
7acef6c
Minor bug in new test_compute_mesh_spheres
Marcraven Jun 13, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ vscode
.vscode/
.vscode/*
*/.VSCodeCounter/*

makefile
*.pyc

# Local History for Visual Studio Code
Expand Down Expand Up @@ -123,6 +123,7 @@ venv/
ENV/
env.bak/
venv.bak/
.micromamba

# Spyder project settings
.spyderproject
Expand Down Expand Up @@ -150,4 +151,3 @@ cspell.json
tmp_profile_dump
pypi_release/
extras/

1 change: 0 additions & 1 deletion docs/source/examples/example_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,5 @@
polycrystal.diffract(beam, detector, motion)
##example:

import os
path = os.path.join( os.path.dirname(__file__), "..", 'images', "diffraction_pattern.png")
fig.savefig(os.path.abspath(path), bbox_inches='tight', transparent=True)
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
"dill",
"xfab",
"netcdf4",
"h5py"]
"h5py",
"pandas"]
)
1 change: 1 addition & 0 deletions tests/end_to_end_tests/powder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from xrd_simulator.beam import Beam
from xrd_simulator.motion import RigidBodyMotion
from xrd_simulator.templates import get_uniform_powder_sample
import os

pixel_size = 75.
detector_size = pixel_size * 1024
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Xdmf Version="3.0"><Domain><Grid Name="Grid"><Geometry GeometryType="XYZ"><DataItem DataType="Float" Dimensions="27 3" Format="HDF" Precision="4">fast_polycrystal_from_odf.h5:/data0</DataItem></Geometry><Topology TopologyType="Tetrahedron" NumberOfElements="55" NodesPerElement="4"><DataItem DataType="Int" Dimensions="55 4" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data1</DataItem></Topology><Attribute Name="$\epsilon_{11}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data2</DataItem></Attribute><Attribute Name="$\epsilon_{22}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data3</DataItem></Attribute><Attribute Name="$\epsilon_{33}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data4</DataItem></Attribute><Attribute Name="$\epsilon_{12}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data5</DataItem></Attribute><Attribute Name="$\epsilon_{13}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data6</DataItem></Attribute><Attribute Name="$\epsilon_{23}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data7</DataItem></Attribute><Attribute Name="$\varphi_{1}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data8</DataItem></Attribute><Attribute Name="$\Phi$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data9</DataItem></Attribute><Attribute Name="$\varphi_{2}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data10</DataItem></Attribute><Attribute Name="Phases" AttributeType="Scalar" Center="Cell"><DataItem DataType="Int" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data11</DataItem></Attribute></Grid></Domain></Xdmf>
<Xdmf Version="3.0"><Domain><Grid Name="Grid"><Geometry GeometryType="XYZ"><DataItem DataType="Float" Dimensions="27 3" Format="HDF" Precision="4">fast_polycrystal_from_odf.h5:/data0</DataItem></Geometry><Topology TopologyType="Tetrahedron" NumberOfElements="55" NodesPerElement="4"><DataItem DataType="Int" Dimensions="55 4" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data1</DataItem></Topology><Attribute Name="$\epsilon_{11}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data2</DataItem></Attribute><Attribute Name="$\epsilon_{22}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data3</DataItem></Attribute><Attribute Name="$\epsilon_{33}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data4</DataItem></Attribute><Attribute Name="$\epsilon_{12}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data5</DataItem></Attribute><Attribute Name="$\epsilon_{13}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data6</DataItem></Attribute><Attribute Name="$\epsilon_{23}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data7</DataItem></Attribute><Attribute Name="$\varphi_{1}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data8</DataItem></Attribute><Attribute Name="$\Phi$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data9</DataItem></Attribute><Attribute Name="$\varphi_{2}$" AttributeType="Scalar" Center="Cell"><DataItem DataType="Float" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data10</DataItem></Attribute><Attribute Name="Phases" AttributeType="Scalar" Center="Cell"><DataItem DataType="Int" Dimensions="55" Format="HDF" Precision="8">fast_polycrystal_from_odf.h5:/data11</DataItem></Attribute></Grid></Domain></Xdmf>
61 changes: 47 additions & 14 deletions tests/test_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def test_centroid_render(self):
scattered_wave_vector = 2 * np.pi * scattered_wave_vector / \
(np.linalg.norm(scattered_wave_vector) * wavelength)

zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])
zd2,yd2 = tuple(self.detector.get_intersection(scattered_wave_vector,verts2.mean(axis=0)[np.newaxis,:])[0])

data = os.path.join(
os.path.join(
os.path.dirname(__file__),
Expand All @@ -86,7 +89,10 @@ def test_centroid_render(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd1)

scattering_unit2 = ScatteringUnit(ch2,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -96,7 +102,9 @@ def test_centroid_render(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd2,
yd=yd2)

self.detector.frames.append([scattering_unit1, scattering_unit2])
diffraction_pattern = self.detector.render(
Expand Down Expand Up @@ -162,6 +170,9 @@ def test_centroid_render_with_scintillator(self):
scattered_wave_vector = 2 * np.pi * scattered_wave_vector / \
(np.linalg.norm(scattered_wave_vector) * wavelength)

zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])
zd2,yd2 = tuple(self.detector.get_intersection(scattered_wave_vector,verts2.mean(axis=0)[np.newaxis,:])[0])

data = os.path.join(
os.path.join(
os.path.dirname(__file__),
Expand All @@ -182,7 +193,9 @@ def test_centroid_render_with_scintillator(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd1)
scattering_unit2 = ScatteringUnit(ch2,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -192,8 +205,9 @@ def test_centroid_render_with_scintillator(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)

element_index=0,
zd=zd2,
yd=yd2)
self.detector.frames.append([scattering_unit1, scattering_unit2])
self.detector.point_spread_kernel_shape = (3,3)
diffraction_pattern = self.detector.render(
Expand All @@ -208,6 +222,8 @@ def test_centroid_render_with_scintillator(self):
verts1 = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]]) + \
v * np.sqrt(2) * self.detector_size / 2. + self.pixel_size_z*0.1 # tetra at detector center perturbed
ch1 = ConvexHull(verts1)
zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])

scattering_unit1 = ScatteringUnit(ch1,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -217,7 +233,9 @@ def test_centroid_render_with_scintillator(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd1)
self.detector.frames[-1] = [scattering_unit1, scattering_unit2]
diffraction_pattern_2 = self.detector.render(
frames_to_render=0,
Expand All @@ -232,6 +250,8 @@ def test_centroid_render_with_scintillator(self):
v = v / np.linalg.norm(v)
verts1 = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]]) - np.array([0, 1.5, 2.0 ])*self.pixel_size_z
ch1 = ConvexHull(verts1)
zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])

scattering_unit1 = ScatteringUnit(ch1,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -241,7 +261,9 @@ def test_centroid_render_with_scintillator(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd1)
self.detector.frames[-1] = [scattering_unit1, scattering_unit2]
diffraction_pattern_3 = self.detector.render(
frames_to_render=0,
Expand All @@ -255,6 +277,8 @@ def test_centroid_render_with_scintillator(self):
v = v / np.linalg.norm(v)
verts1 = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]]) + np.array([0, 246*self.pixel_size_y, 196 *self.pixel_size_z ])
ch1 = ConvexHull(verts1)
zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])

scattering_unit1 = ScatteringUnit(ch1,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -264,7 +288,9 @@ def test_centroid_render_with_scintillator(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd2)
self.detector.frames[-1] = [scattering_unit1, scattering_unit2]
diffraction_pattern_3 = self.detector.render(
frames_to_render=0,
Expand Down Expand Up @@ -362,6 +388,8 @@ def test_projection_render(self):
phase.setup_diffracting_planes(
wavelength, 0, 20 * np.pi / 180)

zd1,yd1 = tuple(self.detector.get_intersection(scattered_wave_vector,hull_points.mean(axis=0)[np.newaxis,:])[0])

scattering_unit = ScatteringUnit(sphere_hull,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -371,7 +399,9 @@ def test_projection_render(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd1,
yd=yd1)

self.detector.frames.append([scattering_unit])
diffraction_pattern = self.detector.render(
Expand Down Expand Up @@ -429,7 +459,8 @@ def test_get_intersection(self):
# central normal algined ray
ray_direction = np.array([2.23, 0., 0.])
source_point = np.array([0., 0., 0.])
z, y = self.detector.get_intersection(ray_direction, source_point)

z, y = tuple(self.detector.get_intersection(ray_direction, source_point[np.newaxis,:])[0])
self.assertAlmostEqual(
z, 0, msg="central detector-normal algined ray does not intersect at 0")
self.assertAlmostEqual(
Expand All @@ -438,7 +469,7 @@ def test_get_intersection(self):
# translate the ray
source_point += self.detector.ydhat * self.pixel_size_y
source_point -= self.detector.zdhat * 2 * self.pixel_size_z
z, y = self.detector.get_intersection(ray_direction, source_point)
z, y = tuple(self.detector.get_intersection(ray_direction, source_point[np.newaxis,:])[0])
self.assertAlmostEqual(
z,
-2 * self.pixel_size_z,
Expand All @@ -452,7 +483,7 @@ def test_get_intersection(self):
ang = np.arctan(self.pixel_size_y / self.detector_size)
frac = np.tan(ang) * np.linalg.norm(ray_direction)
ray_direction += self.detector.ydhat * frac * 3
z, y = self.detector.get_intersection(ray_direction, source_point)
z, y = tuple(self.detector.get_intersection(ray_direction, source_point[np.newaxis,:])[0])
self.assertAlmostEqual(
z, -2 * self.pixel_size_z, msg="translated and tilted ray does not intersect properly")
self.assertAlmostEqual(
Expand Down Expand Up @@ -578,7 +609,7 @@ def test_eta0_render(self):
phase = Phase(unit_cell, sgname, path_to_cif_file=data)
phase.setup_diffracting_planes(
wavelength, 0, 20 * np.pi / 180)

zd,yd = tuple(self.detector.get_intersection(scattered_wave_vector,verts1.mean(axis=0)[np.newaxis,:])[0])
scattering_unit = ScatteringUnit(ch,
scattered_wave_vector=scattered_wave_vector,
incident_wave_vector=incident_wave_vector,
Expand All @@ -588,7 +619,9 @@ def test_eta0_render(self):
time=0,
phase=phase,
hkl_indx=0,
element_index=0)
element_index=0,
zd=zd,
yd=yd)

self.detector.frames.append([scattering_unit])

Expand Down
Loading
Loading