BYU-MicrostructureOfMaterials / OpenXY

Other
35 stars 14 forks source link

Dynamical Simulation - Error in HREBSDMain - Conversion to struct from double #25

Closed caldrews closed 3 years ago

caldrews commented 3 years ago

First, thank you for this great piece of software it has been instrumental in my research. I've run into a couple headaches when doing dynamical simulations through EMsoft and preforming strain cross correlation. After ~40 hours of cross correlation (yikes!) I received the following error. Image included below, but the error originates in HREBSDMain on line 194: Settings.AverageSSE=mean([Settings.fitMetrics.SSE]);

image

Looks like its attempting to take the mean of a value it cannot, however this error doesn't crop up when using real reference images and I cannot quite sort it out. I am going to attempt to comment out this line and run the cross correlation again to see if I can get the AnalysisParams file to output at the very least, as StrainOutput.m doesn't seem to reference an AverageSSE and it is strain I am ultimately after.

As a side-note, in digging at this problem, I noticed that 'genEBSDPatternHybrid_fromEMSoft.m' will delete generated files via onCleanup to save ones hard disk from being flooded by .h5 and euler angle files as cross correlation goes on. Which is a good idea, but the list of files to delete is generated before the code actually calls EMEBSD EMEBSDxxx.nml. Sometimes, for reasons I cannot completely understand, this leads to the angle/h5 files being deleted before the EMEBSD cmdout and missing file errors. Moving those onCleanup lines to the end of the function solved this issue on my end, but this could just be an isolated incident or compounded by other factors, but since moving those lines I haven't gotten any fortran missing file errors.

eretnek commented 3 years ago

You can definitely comment out that line, or set the value to zero to get it to run. SSE is the sum of the squared error, basically how well our measured shifts match up to a deformation gradient F. It's the numerator of the R^2 value for the linear regression to get F from the shifts, so useful, but if you're not plotting it, it shouldn't be a problem.

I'll see if I can figure out a permanent solution next week. I've had a lot of issues with the fitMetrics structure since it was implemented.

On Fri, Feb 19, 2021, 9:33 AM caldrews notifications@github.com wrote:

First, thank you for this great piece of software it has been instrumental in my research. I've run into a couple headaches when doing dynamical simulations through EMsoft and preforming strain cross correlation. After ~40 hours of cross correlation (yikes!) I received the following error. Image included below, but the error originates in HREBSDMain on line 194: Settings.AverageSSE=mean([Settings.fitMetrics.SSE]);

[image: image] https://user-images.githubusercontent.com/79323764/108529000-03dcc300-72a2-11eb-9fb8-808bdc212a06.png

Looks like its attempting to take the mean of a value it cannot, however this error doesn't crop up when using real reference images and I cannot quite sort it out. I am going to attempt to comment out this line and run the cross correlation again to see if I can get the AnalysisParams file to output at the very least, as StrainOutput.m doesn't seem to reference an AverageSSE and it is strain I am ultimately after.

As a side-note, in digging at this problem, I noticed that 'genEBSDPatternHybrid_fromEMSoft.m' will delete generated files via onCleanup to save ones hard disk from being flooded by .h5 and euler angle files as cross correlation goes on. Which is a good idea, but the list of files to delete is generated before the code actually calls EMEBSD EMEBSDxxx.nml. Sometimes, for reasons I cannot completely understand, this leads to the angle/h5 files being deleted before the EMEBSD cmdout and missing file errors. Moving those onCleanup lines to the end of the function solved this issue on my end, but this could just be an isolated incident or compounded by other factors, but since moving those lines I haven't gotten any fortran missing file errors.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BYU-MicrostructureOfMaterials/OpenXY/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWHJDI6LWXJPEOG3Y6LLN3S72HERANCNFSM4X4VBICA .

eretnek commented 3 years ago

caldrews,

I managed to duplicate your error (I believe I have encountered it before). The problem is with these lines in GetDeformationGradient:

catch ME F1 = eye(3); sigma = eye(3); XX(Settings.NumROIs,3) = 0; fitMetrics1.SSE = computations.metrics.fitMetrics; end

Basically, if there is a problem with the calculations, we catch the error with a try/catch and assign dummy values to the output parameters so the show can go on. However, the dummy structure we use for fitMetrics seems to be the wrong shape, hence the error. This won't show up for all data sets, only one where a problematic (for whatever reason) pattern is missing. We will try to fix this. In the meantime, if you really want your SSE values, you can look at the data you ran with SSE commented out and find where F=eye(3) and delete those patterns from your data set (the code handles missing patterns much better apparently than with this error).

-Tim

On Fri, Feb 19, 2021 at 10:56 AM Tim Ruggles timmyruggs@gmail.com wrote:

You can definitely comment out that line, or set the value to zero to get it to run. SSE is the sum of the squared error, basically how well our measured shifts match up to a deformation gradient F. It's the numerator of the R^2 value for the linear regression to get F from the shifts, so useful, but if you're not plotting it, it shouldn't be a problem.

I'll see if I can figure out a permanent solution next week. I've had a lot of issues with the fitMetrics structure since it was implemented.

On Fri, Feb 19, 2021, 9:33 AM caldrews notifications@github.com wrote:

First, thank you for this great piece of software it has been instrumental in my research. I've run into a couple headaches when doing dynamical simulations through EMsoft and preforming strain cross correlation. After ~40 hours of cross correlation (yikes!) I received the following error. Image included below, but the error originates in HREBSDMain on line 194: Settings.AverageSSE=mean([Settings.fitMetrics.SSE]);

[image: image] https://user-images.githubusercontent.com/79323764/108529000-03dcc300-72a2-11eb-9fb8-808bdc212a06.png

Looks like its attempting to take the mean of a value it cannot, however this error doesn't crop up when using real reference images and I cannot quite sort it out. I am going to attempt to comment out this line and run the cross correlation again to see if I can get the AnalysisParams file to output at the very least, as StrainOutput.m doesn't seem to reference an AverageSSE and it is strain I am ultimately after.

As a side-note, in digging at this problem, I noticed that 'genEBSDPatternHybrid_fromEMSoft.m' will delete generated files via onCleanup to save ones hard disk from being flooded by .h5 and euler angle files as cross correlation goes on. Which is a good idea, but the list of files to delete is generated before the code actually calls EMEBSD EMEBSDxxx.nml. Sometimes, for reasons I cannot completely understand, this leads to the angle/h5 files being deleted before the EMEBSD cmdout and missing file errors. Moving those onCleanup lines to the end of the function solved this issue on my end, but this could just be an isolated incident or compounded by other factors, but since moving those lines I haven't gotten any fortran missing file errors.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BYU-MicrostructureOfMaterials/OpenXY/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWHJDI6LWXJPEOG3Y6LLN3S72HERANCNFSM4X4VBICA .

caldrews commented 3 years ago

Awesome, thanks for looking into this. I wonder if its missing/referenced simulated patterns causing the issue, because this didn't crop up with real grain referencing (no missing patterns) and has only occurred once I started doing dynamical simulations. I know I've got some missing pattern warning outputs from EMEBSD on some runs, and I really need to spend some more time understanding what that code is doing. Anyway, thank you, and I will close out this issue.