orix icon indicating copy to clipboard operation
orix copied to clipboard

Deprecate Phase.from_cif() in favor of orix.io.load()

Open hakonanes opened this issue 5 months ago • 4 comments

I suggest to allow reading a phase from a CIF file via orix.io.load() instead of using Phase.from_cif(). I find the latter a bit weird when we already have the former.

If people agree, I'll make the change, and deprecate from_cif() in v0.14 with removal planned for v0.15.

hakonanes avatar Jul 24 '25 06:07 hakonanes

This makes sense to me.

As an additional point, most (maybe all?) other from_* functions in orix are for convention conversions. Moving this functionality would make the naming more consistent.

argerlt avatar Sep 23 '25 22:09 argerlt

Not directly relevant, but looking through #594 , the logic in Phase.point_group seems like it should maybe also be moved, perhaps into orix.quaternion.symmetry.get_point_group...

argerlt avatar Sep 25 '25 21:09 argerlt

Something else to consider before deciding this is that our IDE or type system loses the knowledge that what is returned is a phase. It is not possible to provide a type hint mapping from file extension (cif) to type (Phase) as far as I know.

On the other hand, removing from_cif() means we can remove any IO code from the phase, increasing decoupling and improving separation of concerns, which are important...

hakonanes avatar Sep 28 '25 15:09 hakonanes

As an additional point, most (maybe all?) other from_* functions in orix are for convention conversions. Moving this functionality would make the naming more consistent.

I mean this is different, as we convert between our objects, instead of actual IO in the CIF case.

hakonanes avatar Sep 28 '25 15:09 hakonanes