Exemplo n.º 1
0
    def from_dict(d, t=None):
        ''' Convert the dictionary to a detector model

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

    Returns:
        The detector model

    '''
        from dxtbx.model import Detector

        # If None, return None
        if d == None:
            if t == None: return None
            else: return from_dict(t, None)
        elif t != None:
            if isinstance(d, list):
                d = {'panels': d}
            d2 = dict(t.items() + d.items())
        else:
            if isinstance(d, list):
                d = {'panels': d}

        # Create the model from the dictionary
        return Detector.from_dict(d)
Exemplo n.º 2
0
    def from_dict(d, t=None):
        """Convert the dictionary to a detector model

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

        Returns:
            The detector model
        """
        if d is None and t is None:
            return None
        joint = t.copy() if t else {}
        if isinstance(d, list):
            d = {"panels": d}
        joint.update(d)

        # Create the model from the joint dictionary
        return Detector.from_dict(joint)