usnistgov / AusteniteCalculator

Software and GUI for uncertainty quantification of austenite phase fraction
Other
1 stars 0 forks source link

Phase fractions of each phase #13

Closed creuzige closed 2 years ago

creuzige commented 2 years ago

I was able to revise the code to:

This works pretty well, but the changes to how cif files get imported has resulted in a new issue. The calculate_phase_fraction function tacitly assumed we'd return a DataFrame with the results from just the austenite phase. It's probably a good change to return the results for all phases, but I wasn't sure how best to do this.

Currently I put a DataFrame for each phase in a dictionary, but didn't return it until we sorted this out. The code uses the last DataFrame created, so it runs but the output is messed up.

I'd be interested to hear your thoughts. I'd like to have tables for each phase, but I'm not sure how dash would handle a dictionary of 'n' DataFrames. It seems like it prefers a defined number.

maxgarman commented 2 years ago

This could work, because technically dicts don't need a defined size, but it may be something where we have to find the size of the dict before we use it, which isn't very difficult. It could just come down to writing a semi-complex loop to be able to get all of the data out in a reasonable way.

dnewton600 commented 2 years ago

If I understand correctly, I think the easiest option is to combine everything into one DataFrame, with 'Phase' as one of the columns (and we could even add blank rows for formatting).

If we do want to have multiple tables (where the number depends on the number of phases), we can do that too, either managing the layout dynamically, or 'cheating' by having say 5 blank tables, filling in the first 'n' as needed, and leaving the rest empty.

If there are any preferences I'll go ahead and get this implemented.

creuzige commented 2 years ago

I'm a little concerned about putting 'everything' in one dataframe, but I do like consolidating things as much as we can. Currently we have dataframes for:

So I don't know which of these would be good to combine, or how best to do it and wanted to discuss.

dnewton600 commented 2 years ago

Agreed, sorry I wasn't clear lol, I meant 'everything' as in combining the phase fraction data into a single dataframe, instead of having a dictionary of n dataframes. If this sounds OK, I'll go ahead and implement this -- we can always separate the DF into multiple tables for display, but might be nice to have all of the phase fraction data in a single dataframe (where we have some column variable for 'phase').

So I agree to your first two points, and that we can keep discussing bullet 3 as we dig deeper into the peak fitting procedure.

creuzige commented 2 years ago

I'm having a hard time imagining what the data structure might would look like, maybe a quick mock up would help? I'm just trying to avoid asking you all to expend a bunch of time developing something that may not match what's in my brain but that I'm unable to articulate...

creuzige commented 2 years ago

Chatting with David, I think we've reached a consensus to sort things in the following dataframes:

In addition to the absolute uncertainty value, I've been considering adding a relative uncertainty as well. To me, relative uncertainties can help flag problematic areas. But these kind of tacitly assume that each term is equally weighted in the phase fraction fit.