|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 1, |
| 5 | + "execution_count": 7, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [], |
8 | 8 | "source": [ |
|
11 | 11 | "import numpy as np\n", |
12 | 12 | "from rich.pretty import pprint\n", |
13 | 13 | "\n", |
14 | | - "from oqd_dataschema.base import Dataset, GroupBase, GroupRegistry\n", |
| 14 | + "from oqd_dataschema.base import Dataset, GroupBase, GroupRegistry, condataset\n", |
15 | 15 | "from oqd_dataschema.datastore import Datastore\n", |
16 | 16 | "from oqd_dataschema.groups import (\n", |
17 | 17 | " SinaraRawDataGroup,\n", |
|
20 | 20 | }, |
21 | 21 | { |
22 | 22 | "cell_type": "code", |
23 | | - "execution_count": 2, |
| 23 | + "execution_count": 8, |
24 | 24 | "metadata": {}, |
25 | | - "outputs": [], |
| 25 | + "outputs": [ |
| 26 | + { |
| 27 | + "name": "stderr", |
| 28 | + "output_type": "stream", |
| 29 | + "text": [ |
| 30 | + "D:\\work\\Projects\\oqd-dataschema\\src\\oqd_dataschema\\base.py:265: UserWarning: Overwriting previously registered `YourCustomGroup` group of the same name.\n", |
| 31 | + " GroupRegistry.register(cls)\n" |
| 32 | + ] |
| 33 | + } |
| 34 | + ], |
26 | 35 | "source": [ |
27 | 36 | "class YourCustomGroup(GroupBase):\n", |
28 | 37 | " \"\"\"\n", |
29 | 38 | " Here we define a custom Group, which is automatically added at runtime to the GroupRegistry.\n", |
30 | 39 | " \"\"\"\n", |
31 | 40 | "\n", |
32 | | - " array: Dataset" |
| 41 | + " array: condataset(shape_constraint=(None, 10)) # type: ignore" |
33 | 42 | ] |
34 | 43 | }, |
35 | 44 | { |
36 | 45 | "cell_type": "code", |
37 | | - "execution_count": 3, |
| 46 | + "execution_count": 9, |
38 | 47 | "metadata": {}, |
39 | 48 | "outputs": [ |
40 | 49 | { |
|
47 | 56 | " 'YourCustomGroup': __main__.YourCustomGroup}" |
48 | 57 | ] |
49 | 58 | }, |
50 | | - "execution_count": 3, |
| 59 | + "execution_count": 9, |
51 | 60 | "metadata": {}, |
52 | 61 | "output_type": "execute_result" |
53 | 62 | } |
|
58 | 67 | }, |
59 | 68 | { |
60 | 69 | "cell_type": "code", |
61 | | - "execution_count": 4, |
| 70 | + "execution_count": 10, |
62 | 71 | "metadata": {}, |
63 | 72 | "outputs": [], |
64 | 73 | "source": [ |
|
73 | 82 | }, |
74 | 83 | { |
75 | 84 | "cell_type": "code", |
76 | | - "execution_count": 5, |
| 85 | + "execution_count": 11, |
77 | 86 | "metadata": {}, |
78 | 87 | "outputs": [ |
79 | 88 | { |
|
119 | 128 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">)</span>,\n", |
120 | 129 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">class_</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'YourCustomGroup'</span>\n", |
121 | 130 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">)</span>\n", |
122 | | - "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n", |
| 131 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n", |
| 132 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #808000; text-decoration-color: #808000\">attrs</span>=<span style=\"font-weight: bold\">{}</span>\n", |
123 | 133 | "<span style=\"font-weight: bold\">)</span>\n", |
124 | 134 | "</pre>\n" |
125 | 135 | ], |
|
164 | 174 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m)\u001b[0m,\n", |
165 | 175 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclass_\u001b[0m=\u001b[32m'YourCustomGroup'\u001b[0m\n", |
166 | 176 | "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", |
167 | | - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", |
| 177 | + "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", |
| 178 | + "\u001b[2;32m│ \u001b[0m\u001b[33mattrs\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n", |
168 | 179 | "\u001b[1m)\u001b[0m\n" |
169 | 180 | ] |
170 | 181 | }, |
|
184 | 195 | }, |
185 | 196 | { |
186 | 197 | "cell_type": "code", |
187 | | - "execution_count": 6, |
| 198 | + "execution_count": 12, |
188 | 199 | "metadata": {}, |
189 | 200 | "outputs": [ |
190 | 201 | { |
|
230 | 241 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">)</span>,\n", |
231 | 242 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">class_</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'YourCustomGroup'</span>\n", |
232 | 243 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">)</span>\n", |
233 | | - "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n", |
| 244 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n", |
| 245 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #808000; text-decoration-color: #808000\">attrs</span>=<span style=\"font-weight: bold\">{}</span>\n", |
234 | 246 | "<span style=\"font-weight: bold\">)</span>\n", |
235 | 247 | "</pre>\n" |
236 | 248 | ], |
|
275 | 287 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m)\u001b[0m,\n", |
276 | 288 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclass_\u001b[0m=\u001b[32m'YourCustomGroup'\u001b[0m\n", |
277 | 289 | "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", |
278 | | - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", |
| 290 | + "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", |
| 291 | + "\u001b[2;32m│ \u001b[0m\u001b[33mattrs\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n", |
279 | 292 | "\u001b[1m)\u001b[0m\n" |
280 | 293 | ] |
281 | 294 | }, |
|
287 | 300 | "parse = Datastore.model_validate_hdf5(filepath)\n", |
288 | 301 | "pprint(parse)" |
289 | 302 | ] |
290 | | - }, |
291 | | - { |
292 | | - "cell_type": "code", |
293 | | - "execution_count": null, |
294 | | - "metadata": {}, |
295 | | - "outputs": [], |
296 | | - "source": [] |
297 | 303 | } |
298 | 304 | ], |
299 | 305 | "metadata": { |
|
0 commit comments