def from_dict(cls, spec): """ Construct an |Experiment| based on a dictionary specification. Parameters ---------- spec : dict `spec` should have, at minimum, a key named ``'design'``. The value of this key specifies the |DesignTree|. See |DesignTree.from_spec| for details. The value of the key ``'filename'`` or ``'file'``, if one exists,is saved in |Experiment.filename|. All other fields are saved in |Experiment.experiment_data|. Returns ------- |Experiment| See Also -------- experimentator.Experiment.from_yaml_file """ tree = DesignTree.from_spec(spec.pop('design')) filename = spec.pop('filename', spec.pop('file', None)) self = cls.new(tree, filename=filename) self.experiment_data = spec return self