zpreisler/XRDXRFutils

This should not be there. You should filter this when you load the phase not when you create it or write it to file.

Closed this issue · 2 comments

This should not be there. You should filter this when you load the phase not when you create it or write it to file.

Originally posted by @zpreisler in #11 (comment)

Hi, @zpreisler
I've fixed everything in commit 32c46c4.

Now we create experimental phases with the same structure as tabulated phases read from cif files.
On the other hand, when we save these newly created experimental phases, we write a cif file with the same structure as before.

I've also thought about PhaseList and list of Phase.
We want a PhaseList only when we want to fit multiple phases to the same experimental signal. On all the other cases, we want a list of Phase.
I've modified the code according to that. In particular, GammaMap.select_phases() now returns a list of Phase.
Also, when I create a GammaMap instance in my analysis notebook, I pass a list of Phase.

I'm using this notebook here.

Ready for merge? 😄

Hi, @zpreisler
More refinements.

From the beginning, the function GammaMap.select_phases() was adding new information to each phase: name and point. We may want to preserve this information when writing and reading cif file. For this reason, I've updated Phase.save_cif() and DatabaseXRD.read_cifs() to handle this new information.

Also, a note about PhaseList. We create GammaMap passing a list of phases. While we expect those elements to be Phase instances, some of them can be PhaseList. To handle this case in a more consistent way, I've defined the functions set_name() and set_point() for both classes Phase and PhaseList.

Of course, I've tested all the new functionalities and everything works as expected.