I noticed while working on #645 that the following snippet of code gives no error:
import orix.crystal_map as ocm
import orix.vector as ove
ph = ocm.Phase()
m = ove.Miller.random(10, phase=ph)
but then printing m raises the following error:
AttributeError: 'NoneType' object has no attribute 'name'
Which, tracing back, occurs because giving no point group or space group to Phase means there is no Phase.point_group.name attribute to use for Phase.name
One solution is just to add the following logic to Phase.__init__ so that a phase always has a symmetry:
if space_group is None and point_group is None:
warnings.warn("No symmety given, using point group C1")
point_group = C1
However, maybe we want to be able to have empty phases?
Either way though, something should be done to ensure phases passed into a crystal vector have a defined symmetry, either by setting a default phase symmetry or a if/then/else check in the Miller class.
I noticed while working on #645 that the following snippet of code gives no error:
but then printing
mraises the following error:Which, tracing back, occurs because giving no point group or space group to
Phasemeans there is noPhase.point_group.nameattribute to use forPhase.nameOne solution is just to add the following logic to
Phase.__init__so that a phase always has a symmetry:However, maybe we want to be able to have empty phases?
Either way though, something should be done to ensure phases passed into a crystal vector have a defined symmetry, either by setting a default phase symmetry or a if/then/else check in the Miller class.