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

[FEATURE] Strain calculation for particules with defects #23

Open
ewbellec opened this issue Oct 16, 2023 · 0 comments
Open

[FEATURE] Strain calculation for particules with defects #23

ewbellec opened this issue Oct 16, 2023 · 0 comments
Milestone

Comments

@ewbellec
Copy link
Collaborator

Impossible to completely remove the phase wrapping when you have toppological defect (dislocations).
Solution : Changing the phase by an offset (and not unwrapping) moves the wrapping region. Simply compute the strain for 3 phase offsets. At each positions, at least 2 strain maps should be equal.
Here's a rough try of a function that might work in cdiutils :

def compute_normal_strain_defects(
displacement: np.ndarray,
q_vector: Union[np.ndarray, tuple, list],
voxel_size: Union[np.ndarray, tuple, list],
gradient_method: str="hybrid",
phase_shift=np.pi/2.,
) -> np.ndarray:
factor = ? # factor that you use to go from phase to displacement.
displacement1 = np.mod(displacement, 2.pifactor)
displacement2 = np.mod(displacement + phase_shift, 2.pifactor)
displacement3 = np.mod(displacement + 2. * phase_shift , 2.pifactor)

strain1 = compute_normal_strain(displacement1, q_vector, voxel_size)
strain2 = compute_normal_strain(displacement2, q_vector, voxel_size)
strain3 = compute_normal_strain(displacemen3, q_vector, voxel_size)

strain_clean = np.zeros(strain1.shape)
strain_clean[np.isnan(strain1)] = np.nan # Not sure you need that.

mask = np.isclose(strain1,strain2)
strain_clean[mask==1] = strain1[mask==1]
    
mask = np.isclose(strain1,strain3)
strain_clean[mask==1] = strain1[mask==1]

mask = np.isclose(strain2,strain3)
strain_clean[mask==1] = strain2[mask==1]

return strain_clean

It works fine for me. You may get problems for particles with few pixels or with several defects. You could imagine making more than 3 strain maps in that case. But for me it worked fine on 2 different particles.

If you want to test on a particle with a defect, you can use this one :
/data/visitor/ihhc3936/id01/20231010/RAW_DATA/PtYSZ/PtYSZ_0001/PtYSZ_0001.h5
scan 54

@clatlan clatlan added this to the 0.2.0 release milestone Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants