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

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

    Returns:
        The scan model

    '''
        from dxtbx.model import Scan
        from scitbx.array_family import flex  # import dependency

        # If None, return None
        if d == None:
            if t == None: return None
            else: return from_dict(t, None)
        elif t != None:
            d = dict(t.items() + d.items())
        if not isinstance(d['exposure_time'], list):
            d['exposure_time'] = [d['exposure_time']]

        d.setdefault('batch_offset', 0)  # backwards compatibility 20180205
        if 'valid_image_ranges' not in d:
            d['valid_image_ranges'] = {}  # backwards compatibility 20181113
        # Create the model from the dictionary
        return Scan.from_dict(d)
Exemplo n.º 2
0
    def from_dict(d, t=None):
        ''' Convert the dictionary to a scan model

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

    Returns:
        The scan model

    '''
        from dxtbx.model import Scan
        from scitbx.array_family import flex  # import dependency

        # If None, return None
        if d == None:
            if t == None: return None
            else: return from_dict(t, None)
        elif t != None:
            d = dict(t.items() + d.items())
        if not isinstance(d['exposure_time'], list):
            d['exposure_time'] = [d['exposure_time']]

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

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

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

        if not isinstance(joint["exposure_time"], list):
            joint["exposure_time"] = [joint["exposure_time"]]
        joint.setdefault("batch_offset", 0)  # backwards compatibility 20180205
        joint.setdefault("valid_image_ranges", {})  # backwards compatibility 20181113

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