diff --git a/docs/practical_examples/tmp.grpah.html b/docs/practical_examples/tmp.grpah.html index c126064..55ea855 100644 --- a/docs/practical_examples/tmp.grpah.html +++ b/docs/practical_examples/tmp.grpah.html @@ -88,8 +88,8 @@
// parsing and collecting nodes and edges from the python - nodes = new vis.DataSet([{"color": "black", "id": 0, "label": "_:N25", "shape": "dot", "size": 20, "title": "_:N25"}, {"color": "#97c2fc", "id": 1, "label": "A hint", "shape": "dot", "title": "A hint"}, {"color": "#97c2fc", "id": 2, "label": "prov:Person", "shape": "dot", "title": "prov:Person"}, {"color": "#97c2fc", "id": 3, "label": "Probst", "shape": "dot", "title": "Probst"}, {"color": "#97c2fc", "id": 4, "label": "Matthias", "shape": "dot", "title": "Matthias"}]); - edges = new vis.DataSet([{"from": 0, "label": "skos:definition", "to": 1}, {"from": 2, "label": "foaf:lastName", "to": 3}, {"from": 2, "label": "foaf:firstName", "to": 4}]); + nodes = new vis.DataSet([{"color": "#97c2fc", "id": 0, "label": "prov:Person", "shape": "dot", "title": "prov:Person"}, {"color": "#97c2fc", "id": 1, "label": "Matthias", "shape": "dot", "title": "Matthias"}, {"color": "#97c2fc", "id": 2, "label": "Probst", "shape": "dot", "title": "Probst"}, {"color": "black", "id": 3, "label": "_:N25", "shape": "dot", "size": 20, "title": "_:N25"}, {"color": "#97c2fc", "id": 4, "label": "A hint", "shape": "dot", "title": "A hint"}]); + edges = new vis.DataSet([{"from": 0, "label": "foaf:firstName", "to": 1}, {"from": 0, "label": "foaf:lastName", "to": 2}, {"from": 3, "label": "skos:definition", "to": 4}]); nodeColors = {}; allNodes = nodes.get({ returnType: "Object" }); diff --git a/docs/userguide/misc/Extensions.ipynb b/docs/userguide/misc/Extensions.ipynb index 818743f..7140752 100644 --- a/docs/userguide/misc/Extensions.ipynb +++ b/docs/userguide/misc/Extensions.ipynb @@ -9,14 +9,20 @@ "\n", "The wrapper class functionalities can be extended using composition or inheritance.\n", "\n", - "## Composition\n", + "The concept of composition adds a component to a composite class. The relationship is such, that the composite class does not know the component class but wise versa. This allows to add additional functionality without changing the original code. Adding components to an existing wrapper class will be called \"registering\" here.\n", "\n", - "The concept of composition adds a component to a composite class. The relationship is such, that the composite class does not know the component class but wise versa. This allows to add additional functionality without changing the original code. Adding components to an existing wrapper class will be called \"registering\" here." + "Concretely, four different so-called accessory classes are implemented:\n", + "- `Vector`\n", + "- `Magnitude`\n", + "- `normalize`\n", + "- `to_units`\n", + "\n", + "These accessories interfaces must be activated by an import call. They generally are designed such, that they are called on a dataset or group with respective arguments, which prepares a the action being performed when data is selected. Best is, to learn by example:" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 20, "id": "a1cbc998-a747-4370-b362-d04c4d6508be", "metadata": { "tags": [] @@ -28,7 +34,7 @@ "using(\"h5py\")" ] }, - "execution_count": 1, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -43,28 +49,25 @@ "id": "a3edcad1-6c32-4d07-a581-1aa57f917259", "metadata": {}, "source": [ - "## Built-in extensions\n", - "You may add your own extensions, but the packages comes already with some, that may be useful:\n", - "\n", - "### 1. Vector\n", - "The `Vector` extension returns a `xr.Dataset` including the provided datasets when the `Vector` object is sliced. It just saves some time and makes it a one-liner to create the `xr.Dataset`." + "## 1. Vector\n", + "The `Vector` extension returns a `xr.Dataset`. First specify which of the datasets from the HDF5 should be contained in the resulting `xr.Dataset`. Then, index the data array using numpy notation or `sel()` or `isel()`. Only then, the data is loaded from the file:" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 23, "id": "7eecb901-7e7c-473d-848c-409e1f0a0e8c", "metadata": { "tags": [] }, "outputs": [], "source": [ - "from h5rdmtoolbox.extensions import vector" + "from h5rdmtoolbox.extensions import vector # make `Vector` appear as a property of groups" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 24, "id": "aa41f9f9-64d2-4d3d-8cd3-4cbcca88ae88", "metadata": { "tags": [] @@ -442,10 +445,13 @@ " * y (y) int32 2 3\n", " * x (x) int32 1 2 3\n", "Data variables:\n", - " xvel (y, x) float64 0.03456 0.9389 0.03886 0.1708 0.5039 0.8131\n", - " yvel (y, x) float64 0.1247 0.3435 0.5736 0.8872 0.6234 0.06209 " + " xvel (y, x) float64 0.9042 0.06279 0.2518 0.7133 0.5988 0.09251\n", + " yvel (y, x) float64 0.2222 0.5316 0.9987 0.251 0.3073 0.8381\n", + "Attributes:\n", + " long_name: x vel\n", + " units: m/s " ], "text/plain": [ "