qcodes/data/data_set.py
def xarray_dictionary_to_dataset(
    xarray_dictionary: Dict[str, Any],
) -> DataSet:
    """Convert xarray dictionary to Qcodes DataSet.

    Args:
        xarray_dictionary: data to convert

    Returns:
        QCoDeS dataSet with converted data.
    """
    dataset = new_data()
    dataset.metadata.update(xarray_dictionary["attrs"])

    grid_coords: List[Any] = []
    set_array_names = []
    for array_key, coord_dictionary in xarray_dictionary["coords"].items():
        preset_data = np.array(coord_dictionary["data"])

        tiled_preset_data = np.tile(preset_data, [g.size for g in grid_coords] + [1])
        grid_coords.append(preset_data)

        data_array = xarray_data_array_dictionary_to_data_array(
            array_key, coord_dictionary, True, preset_data=tiled_preset_data
        )
        dataset.add_array(data_array)
        set_array_names.append(array_key)
    for array_key, datavar_dictionary in xarray_dictionary["data_vars"].items():
        set_arrays = tuple(dataset.arrays[name] for name in set_array_names)

        data_array = xarray_data_array_dictionary_to_data_array(
            array_key, datavar_dictionary, False
        )
        data_array.set_arrays = set_arrays
        dataset.add_array(data_array)

    return dataset
Convert xarray dictionary to Qcodes DataSet.

    Args:
        xarray_dictionary: data to convert

    Returns:
        QCoDeS dataSet with converted data.
    
Convert xarray dictionary to Qcodes DataSet.
Convert xarray dictionary to Qcodes DataSet .
def xarray_dictionary_to_dataset(
    xarray_dictionary: Dict[str, Any],
) -> DataSet:
    dataset = new_data()
    dataset.metadata.update(xarray_dictionary["attrs"])
    grid_coords: List[Any] = []
    set_array_names = []
    for array_key, coord_dictionary in xarray_dictionary["coords"].items():
        preset_data = np.array(coord_dictionary["data"])
        tiled_preset_data = np.tile(preset_data, [g.size for g in grid_coords] + [1])
        grid_coords.append(preset_data)
        data_array = xarray_data_array_dictionary_to_data_array(
            array_key, coord_dictionary, True, preset_data=tiled_preset_data
        )
        dataset.add_array(data_array)
        set_array_names.append(array_key)
    for array_key, datavar_dictionary in xarray_dictionary["data_vars"].items():
        set_arrays = tuple(dataset.arrays[name] for name in set_array_names)
        data_array = xarray_data_array_dictionary_to_data_array(
            array_key, datavar_dictionary, False
        )
        data_array.set_arrays = set_arrays
        dataset.add_array(data_array)
    return dataset
def xarray_dictionary_to_dataset ( xarray_dictionary : Dict [ str , Any ] , ) -> DataSet : dataset = new_data ( ) dataset . metadata . update ( xarray_dictionary [ "attrs" ] ) grid_coords : List [ Any ] = [ ] set_array_names = [ ] for array_key , coord_dictionary in xarray_dictionary [ "coords" ] . items ( ) : preset_data = np . array ( coord_dictionary [ "data" ] ) tiled_preset_data = np . tile ( preset_data , [ g . size for g in grid_coords ] + [ 1 ] ) grid_coords . append ( preset_data ) data_array = xarray_data_array_dictionary_to_data_array ( array_key , coord_dictionary , True , preset_data = tiled_preset_data ) dataset . add_array ( data_array ) set_array_names . append ( array_key ) for array_key , datavar_dictionary in xarray_dictionary [ "data_vars" ] . items ( ) : set_arrays = tuple ( dataset . arrays [ name ] for name in set_array_names ) data_array = xarray_data_array_dictionary_to_data_array ( array_key , datavar_dictionary , False ) data_array . set_arrays = set_arrays dataset . add_array ( data_array ) return dataset
Convert xarray dictionary to Qcodes DataSet.
Convert xarray dictionary to Qcodes DataSet .
"""Convert xarray dictionary to Qcodes DataSet.

    Args:
        xarray_dictionary: data to convert

    Returns:
        QCoDeS dataSet with converted data.
    """
QCoDeS dataSet with converted data.
QCoDeS dataSet with converted data .
xarray_dictionary
Dict[str, Any]
data to convert
data to convert