Skip to content

[low priority] lazy Phase definitions can lead to unexpected errors with Miller #649

Description

@argerlt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions