Example #1
0
    def from_dict(d, t=None):
        """Convert the dictionary to a goniometer model

        Params:
            d The dictionary of parameters
            t The template dictionary to use

        Returns:
            The goniometer model

        """
        from dxtbx.model import Goniometer, MultiAxisGoniometer

        # If None, return None
        if d is None:
            if t is None:
                return None
            else:
                return from_dict(t, None)
        elif t != None:
            d = dict(t.items() + d.items())

        # Create the model from the dictionary
        if "axes" in d and "angles" in d and "scan_axis" in d:
            return MultiAxisGoniometer.from_dict(d)
        return Goniometer.from_dict(d)
Example #2
0
    def from_dict(d, t=None):
        """Convert the dictionary to a goniometer model

        Params:
            d The dictionary of parameters
            t The template dictionary to use

        Returns:
            The goniometer model
        """
        if d is None and t is None:
            return None
        joint = t.copy() if t else {}
        joint.update(d)

        # Create the model from the joint dictionary
        if {"axes", "angles", "scan_axis"}.issubset(joint):
            return MultiAxisGoniometer.from_dict(joint)
        return Goniometer.from_dict(joint)