scipp.compat.dict.from_dict#

scipp.compat.dict.from_dict(dict_obj)#

Convert a Python dict to a Scipp Variable, DataArray or Dataset.

If the input keys contain both ‘coords’ and ‘data’, then a DataArray is returned. If the input keys contain both ‘dims’ and ‘values’, as Variable is returned. Otherwise, a Dataset is returned.

Parameters:

dict_obj (dict) – A python dict to be converted to a scipp object.

Returns:

VariableLike – A Scipp Variable, DataArray or Dataset.

See also

scipp.to_dict