<jupyter_start><jupyter_text>Representations and TablesScipp provides a number of options for visualizing the structure and contents of variables, data arrays, and datasets in Jupyter notebooks:- `scipp.to_html` produces a HTML representation.  This is also bound to `_repr_html_`, i.e., Jupyter will display this when the name of a scipp object is typed at the end of a cell.- `scipp.show` draws a SVG representation of the contained items and their shapes.- `scipp.table` outputs a table representation of 0-D and 1-D data.In all cases, these can be called with variable, data array, and dataset, as well as slices or items of any of the former.While the outputs are mostly self-explanatory we discuss some details below. HTML represenation`scipp.to_html` is used to define `_repr_html_`.This special property is used by Jupyter in place of `__repr__`.<jupyter_code>import numpy as np
import scipp as sc
x = sc.zeros(dims=['x'], shape=(2,))
y = sc.zeros(dims=['y'], unit=sc.units.m, shape=(4,))
labels = sc.zeros(dims=['y'], shape=(4,))
d = sc.Dataset(
    data={'a':sc.zeros(dims=['y', 'x'], shape=(3, 2), with_variances=True, unit=sc.units.angstrom)},
    coords={'x':x, 'y':y, 'y_label':labels})
d['b'] = d['a']
d['c'] = 1.0 * sc.units.kg
d['a'].attrs['x_attr'] = sc.zeros(dims=['x'], shape=(2,))
d['b'].attrs['x_attr'] = sc.zeros(dims=['x'], shape=(2,))
d['b'].attrs['b_attr'] = 1.2 * sc.units.m<jupyter_output><empty_output><jupyter_text>Simply typing the name of a variable, data array, or dataset will show the HTML representation:<jupyter_code>d<jupyter_output><empty_output><jupyter_text>Note that (as usual) Jupyter only shows the last variable mentioned in a cell:<jupyter_code>a = 1
d
a<jupyter_output><empty_output><jupyter_text>In this case, `to_html` can be used to retain the HTML view, e.g., to show multiple objects in a single cell:<jupyter_code>sc.to_html(d['a'])
sc.to_html(d['c'])<jupyter_output><empty_output><jupyter_text>Typing the scipp module name at the end of a cell yields an HTML view of all scipp objects (variables, data arrays, and datasets):<jupyter_code>sc<jupyter_output><empty_output><jupyter_text>SVG representation`scipp.show` works similar to `scipp.to_html`.It should be noted that if a dimension extent is large, `show` will truncate it to avoid generation of massive and unreadable SVGs.Objects with more than three dimensions are not supported and will result in an error message.<jupyter_code>sc.show(d)<jupyter_output><empty_output><jupyter_text>Table representation`scipp.table` works similar to `scipp.to_html` and `scipp.show`.Objects with more than one dimension per variable are not supported and are omitted in the output:<jupyter_code>sc.table(d)<jupyter_output><empty_output><jupyter_text>In such cases slicing can be used to produce tables from higher-dimensional entries:<jupyter_code>sc.table(d['a']['x', 0])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12318840579710146, 'fraction_numerical': 0.005175983436853002, 'mean_word_length': 6.265664160401003, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '67933', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 980, 'n_tokens_neox': 972, 'n_words': 321, 'path': 'docs/visualization/representations-and-tables.ipynb', 'repo_name': 'nvaytet/scipp', 'size': '2898'}