Skip to content

AxelHenningsson/crispy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c r i s p y

a CRystal population metric InSpector written in PYthon allowing for interfacing between 3DXRD / Lab-DCT and Dark-Field X-ray Microscopy (DFXM).

crispy is a Python package for analyzing crystal population metrics from 3DXRD and lab-DCT data targeting interfacing between diffraction contrast modalities.

One of the central features of crispy is the provision of per-grain reflections diffraction information for Dark-Field X-ray Microscopy (DFXM) by analyzing 3DXRD grain maps and lab-DCT grain volumes.

Interfaces for reading, analyzing, and visualizing grain maps are provided for

  • 3DXRD grain maps (3D scatter of grain centroids and grain orientations)
  • lab-DCT voxel volumes (3D voxel volumes where each voxel is a single crystal grain)
cross-platform pure python tests ubuntu-linux code style black Sphinx documentation

Authors

crispy is written and maintained by:

Axel Henningsson,

Until an associated journal publication is available, if you use this code in your research, we ask that you cite this repository.

Usecase

We can load a grain map from disc as

import crispy

# this could be a 3DXRD grain map or a lab-DCT grain volume
path_to_my_grain_map = crispy.assets.path.AL1050
grain_map = crispy.GrainMap( path_to_my_grain_map )

In this example we have a lab-DCT grain volume, we do some filtering to remove grains that are not of interest

grain_map.filter( min_grain_size_in_voxels = 200 )
grain_map.prune_boundary_grains()

Many more operations for manipulating grain maps are available -- check out the docs!

We can now write the grain map to a file to visualize in paraview

grain_map.write("grain_map.xdmf")

https://github.com/AxelHenningsson/crispy/blob/main/docs/source/images/readme_grains.png?raw=true

To search for accessible reflections in DFXM mode for eta=0, we can use the :obj:`crispy.dfxm.Goniometer` class as

motor_bounds = {
"mu": (0, 20), # degrees
"omega": (-30, 30), # degrees
"chi": (-7, 7), # degrees
"phi": (-7, 7), # degrees
"detector_z": (-0.04, 1.96), # metres
"detector_y": (-0.169, 1.16) # metres
}

goniometer = crispy.dfxm.Goniometer(grain_map,
                        energy=17,
                        detector_distance=4,
                        motor_bounds=motor_bounds)

goniometer.find_reflections()

The resulting reflections can be accessed as

polycrystal.grains[i].dfxm

Providing a dictionary with refleciton information for each grain.

{'hkl': array([[0.],
        [0.],
        [2.]]),
'mu': array([12.7388667]),
'omega': array([1.78967645]),
'chi': array([-4.23236192]),
'phi': array([-2.77428247]),
'residual': array([0.]),
'theta': array([10.37543294])}

Alternatively, we can generate a :obj:`pandas.DataFrame` with reflection information for all grains as

df = goniometer.table_of_reflections()

https://github.com/AxelHenningsson/crispy/blob/main/docs/source/images/readme_df.png?raw=true

It is also possible to load a 3DXRD grain map from a file tesselate and visualize.

path_to_my_grain_map = crispy.assets.path.FEAU
grain_map = crispy.GrainMap( path_to_my_grain_map )
grain_map.tesselate()
grain_map.colorize( np.eye(3) )
crispy.visualize.mesh( grain_map )

https://github.com/AxelHenningsson/crispy/blob/main/docs/source/images/readme_tdxrd.png?raw=true

Installation

To install crispy from source, run

git clone https://github.com/AxelHenningsson/crispy.git
cd crispy
pip install -e .

Documentation

The extended documentation is available here.

About

crispy - a CRystal population metric InSpector written in PYthon.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages