MechMicroMan / DefDAP

A python library for correlating EBSD and HRDIC data
Apache License 2.0
32 stars 13 forks source link

Questions about EBSD analyses in Defdap #89

Closed jluo28 closed 1 year ago

jluo28 commented 2 years ago

Hi all,

I have 2 questions about EBSD analyses in Defdap.

1) I found there is a class for linking multiple EBSD maps (i.e. ebsd. Linker) in defdap, and this is exactly what I want to use for my data analyses. What I want to do is to align the EBSD maps at several deformation stages. I had a go myself with the code provided in API documentation but failed to get the results I expect. Below is a screenshot of my code, there are no errors when I run the code but I also don't think I've successfully linked these 2 ebsd maps. I expect that after the linking, the grains in the 2nd ebsd map will have the same IDs as that in the 1st ebsd. Could anyone give me some advice on how I should modify/add code for this? Or did I misunderstand the code shown in the documentation and they won't work in this way?

![image](https://user-images.githubusercontent.com/88724049/129312975-e764fe37-50a8-409d-a157-636111550929.png)

2) I'm working on multiphase steels and for some of the analyses, I want to study only one phase, would it be possible for Defdap to only analyse one phase for multiphase material? for example, only plot IPF for one phase, only show the grain ID for one phase, only show max shear strain for one phase etc.

Any advice is much appreciated!

Thanks, Jie

mikesmic commented 2 years ago

Hi Jie,

The EBSD linker class is a very old feature that I never really took the time to keep up to date when making changes to the core parts of the library. I can't exactly remember how it worked but it was quite manual I think, it would cycle through every grain in the first map, guess the corresponding grain in the other maps based on the location and then ask you to confirm that it guessed correctly. I will have a look through the code and try and make it work again for you when I have a chance.

For your second question, the multiphase analysis features are a newish addition and not really complete. Some of what you list is possible, here are some snippets of code for you to try:

# print phases in your map
for i, phase in enumerate(ebsdMap.phases):
    print(f'ID: {i}')
    print(phase)
    print()
# Set the primary phase, used in functions not changed 
# to work with multiple phases
ebsdMap.primaryPhaseID = 0
# pass a list of phase ID. Will work for multiple
# and the correct symmetry will be used for each
ebsdMap.plotIPFMap([0,0,1], phases=[0])
phase_id = 0
# Change primary phase so correct symmetry used in 
ebsdMap.primaryPhaseID = phase_id
# Filter grains based on phase id 
dic_grain_ids = [grain.grainID for grain in dicMap 
                 if grain.ebsdGrain.phaseID == phase_id]
# Plot in an IPF
dicMap.plotGrainDataIPF([0,0,1], mapData=dicMap.crop(dicMap.eMaxShear), 
                        grainIds=dic_grain_ids, marker='o')

Let me know if you want me to explain the code in more detail, I ran this in these in the example notebook using the example data. We can discuss further If you have specific type of plot you want to produce

jluo28 commented 2 years ago

Hi Michael,

Thank you very much for the reply. This is really helpful to me! I tried the code you provided and it worked well with the IPF colouring map and plotting grains in an IPF. The code looks very clear so I understand how it works. I have just one more question, now that we found the grainIDs of one phase, is it possible for Defdap to only plot these grain numbers rather than all the grain numbers in a dic map?

I tried plot.addGrainNumbers(), but this would plot all the grain IDs on the map.

I also have a follow-up question for the last issue I posted here. I cleaned the EBSD data and tried to load it into Defdap but I get the error below. (I did this in AztecCrystal, and when it export the CPR files, these files don't contain edx data). Is it that Defdap can only read the files containing both EBSD and EDX data? image

Thanks, Jie

mikesmic commented 2 years ago

The EBSD grain linker should be working as intended again now with the commit I made on the dev branch. Can you give this a try and let me know if you have any issues. It is quite a manual process but I can help you with improving the functionality if it is something you are interested in. Usage:

Let me know if you have questions.

jluo28 commented 2 years ago

Hi Mike,

Thanks very much for your instructions on this. I tried to follow your instructions above, but I still have 2 questions about it:

Screen Shot 2021-08-25 at 08 00 46

image

Thanks, Jie

mikesmic commented 2 years ago

Hi Jie,

It looks like you might not have installed from the dev branch. You need to use git to clone the repository and then checkout the dev branch. You then install by running pip install -e . in the root of the package.

jluo28 commented 2 years ago

Hi Mike.

Thanks very much. Now it's working! I was wondering if i want to link all the grains that appear in the area of interest, do i need to click on all the grains to make the link? If so, would there be a way to do this a bit more automatically?

Thanks, JIe

jluo28 commented 2 years ago

Hi Mike,

Thanks to the code you shared previously, I can now make links between several EBSD maps. This is great and I really appreciate your help. Now I'd like to link all the grains within the same region at different strain levels and track how each grain deforms. I've been manually linking each grain and recording the grain IDs, grain properties and strains for each grain at different global strain levels. This works alright but for microstructure that has smaller grains, it could be a bit slow to analyse all the grains within the area of interest. I was wondering do you have any ideas or advice on how to link a large number of grains a bit quicker? Hopefully I explained my thoughts clearly, and again, any ideas are much appreciated.

Cheers, Jie

mikesmic commented 2 years ago

What data have you collected? Is for multiple EBSD maps or is this for HRDIC measurements. It might be best to have a call to discuss what you are trying to do and I'll try to point you in the right direction. Send me a message on slack and we can organise something.

jluo28 commented 2 years ago

That would be great. Thank you Mike very much. I'll message you shortly.