|
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", |
|
29 | 29 | " Here we define a custom Group, which is automatically added at runtime to the GroupRegistry.\n", |
30 | 30 | " \"\"\"\n", |
31 | 31 | "\n", |
32 | | - " array: Dataset" |
| 32 | + " array: condataset(shape_constraint=(None, 10)) # type: ignore" |
33 | 33 | ] |
34 | 34 | }, |
35 | 35 | { |
|
119 | 119 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">)</span>,\n", |
120 | 120 | "<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 | 121 | "<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", |
| 122 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n", |
| 123 | + "<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 | 124 | "<span style=\"font-weight: bold\">)</span>\n", |
124 | 125 | "</pre>\n" |
125 | 126 | ], |
|
164 | 165 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m)\u001b[0m,\n", |
165 | 166 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclass_\u001b[0m=\u001b[32m'YourCustomGroup'\u001b[0m\n", |
166 | 167 | "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", |
167 | | - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", |
| 168 | + "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", |
| 169 | + "\u001b[2;32m│ \u001b[0m\u001b[33mattrs\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n", |
168 | 170 | "\u001b[1m)\u001b[0m\n" |
169 | 171 | ] |
170 | 172 | }, |
|
230 | 232 | "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">)</span>,\n", |
231 | 233 | "<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 | 234 | "<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", |
| 235 | + "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n", |
| 236 | + "<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 | 237 | "<span style=\"font-weight: bold\">)</span>\n", |
235 | 238 | "</pre>\n" |
236 | 239 | ], |
|
275 | 278 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m)\u001b[0m,\n", |
276 | 279 | "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclass_\u001b[0m=\u001b[32m'YourCustomGroup'\u001b[0m\n", |
277 | 280 | "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", |
278 | | - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", |
| 281 | + "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", |
| 282 | + "\u001b[2;32m│ \u001b[0m\u001b[33mattrs\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n", |
279 | 283 | "\u001b[1m)\u001b[0m\n" |
280 | 284 | ] |
281 | 285 | }, |
|
287 | 291 | "parse = Datastore.model_validate_hdf5(filepath)\n", |
288 | 292 | "pprint(parse)" |
289 | 293 | ] |
290 | | - }, |
291 | | - { |
292 | | - "cell_type": "code", |
293 | | - "execution_count": null, |
294 | | - "metadata": {}, |
295 | | - "outputs": [], |
296 | | - "source": [] |
297 | 294 | } |
298 | 295 | ], |
299 | 296 | "metadata": { |
|
0 commit comments