Refactor Electron Diffraction Simulations#197
Conversation
c0c36cc to
5010048
Compare
…ator and DiffractionGenerator to all use `orix.Phase`
|
@hakonanes Okay so this is starting to look better now but there might be a bit to go and this is going to probably end up being way too large of a PR. This rewrites a lot of the simulation stuff in I can try split up some of this as well if that makes more sense. A couple more things: I think that the Structure Library Class is redundant. I'm already of the opinion that there are too many classes, but I think it is reasonable to just directly create a DiffractionGenerator object like: from diffsims.crystallography import CrystalPhase
from diffpy.structure import Lattice, Atom, Structure
from diffsims.generators.diffraction_generator import DiffractionGenerator
from diffsims.generators.library_generator import DiffractionLibraryGenerator
# Creating a crystal phase to which we will make the template library from
crystal = CrystalPhase("al",
space_group=225,
structure=Structure(lattice=Lattice(4.04, 4.04, 4.04, 90, 90, 90),
atoms=[Atom("Al", [0, 0, 1])],),
)
# Creating a DiffractionGenerator to generate the diffraction patterns
calc = DiffractionGenerator(300.0) # 300 keV
# Creating a DiffractionLibraryGenerator to generate the library
dfl = DiffractionLibraryGenerator(names=["al_phase"],
phases=[crystal,],
orientations = [ crystal.constrained_rotation(),],
electron_diffraction_calculator=calc,
reciprocal_radius=1.0) |
|
I'm sorry, but I'm not familiar enough with the spot pattern diffraction simulation setup to review this PR as thoroughly as I would like to. However, I can give my two cents regarding the snippet you propose above:
Regarding the setup of simulations of spot patterns, I've made a comment in the relevant issue #198 (comment). If possible, I suggest to support two routes for creating simulation libraries in one or two minor releases. Users using the old route should be warned somehow that they should use the new route. I know that maintenance resources are extremely scarce. And that this requires more work. But, it would be very welcome, since my impression is that template matching in pyxem is more and more used. I'm sorry I can't be of more help with the implementation. |
Totally fine. I might be able to ping a couple of people to review the actual spot pattern diffraction simulation. The advice on how to structure it it very valuable.
I'm okay with that! Less classes are a good thing in this case as I already feel there are too many!
Hmm, yea it should. We just probably have to handle the case of two phases with the same name. But we can just add "name_1" and "name_2" in that case.
Yea let's get rid of the rots = phase. get_constrained_rotation(1.0)
# vs
from orix.sampling import get_constrained_rotation
get_constrained_rotation(1.0, phase.space_group, phase.point_group)Just a thought...
Thanks! I think we want the workflows between
I'm happy to accommodate. I'm probably going to add the deprecation wrappers here as well and then I can start making some smaller PRs
This is super helpful :) |
Yes, that is a reasonable solution. The user of course shouldn't have a phases with identical names in the list, but raising an error might be too harsh. The phase name can just be changed after indexing anyway.
These functions return rotations or orientations. When we want orientations, the only inputs are sample resolution and proper point group symmetry. We should therefore add them as class methods to the rotation and orientation classes. (Specifying a However, I'm not sure returning rotations with the first Euler angle always 0 and rotations around a "zone axis" to orix. Perhaps the former is general enough. The latter is diffraction specific and should thus reside in diffsims. But, having a separate utility function for |
Just because I'm not very used to simulations where everything isn't in a straight line, the distinction here is that a orientation just refers to a vector direction within some object and a rotation can be defined by two vectors.
I would like everything in |
|
@hakonanes I'm still trying to figure a couple of things out. Maybe I should be using the Vector3D class to define the orientations for the Library. One option would be to have both a I'm a little unsure of how to visualize the stereographic projections from a |
|
Close in favor of #201 |
Description of the change
Based on some changes from @din14970 I figured I would pick up this work a little bit
Progress of the PR
ConstrainedRotationclass for building rotations for accelerated template matchingConstrainedRotationStructureLibraryMinimal example of the bug fix or new feature
For reviewers
__init__.py.unreleased section in
CHANGELOG.rst.creditsindiffsims/release_info.pyandin
.zenodo.json.