h5
h5
⚓︎
HDF5 functions, and utils, and generators, OH MY!
Attributes⚓︎
h5.H5pyCompression = Literal['gzip', 'lzf', 'szip']
module-attribute
⚓︎
h5py mode strings (taken from h5py docstrings)):
r Readonly, file must exist (default)
r+ Read/write, file must exist
w Create file, truncate if exists
w- or x Create file, fail if exists
a Read/write if exists, create otherwise
Classes⚓︎
h5.FileInfo(groups: Dict[str, GroupInfo], attrs: Dict[str, Any], datasets: Dict[str, DatasetInfo], fspath: str, fssize: int, key: str, h5type: Literal['file'])
dataclass
⚓︎
Bases: GroupLikeInfo
Functions⚓︎
h5.FileInfo.from_h5py_file(h5py_group: h5py.File) -> FileInfo
classmethod
⚓︎
could do with dict-comprehension, but not readable (imo)
datasets_and_groups = {
obj.name: H5Group.from_h5py_group(obj)
if isinstance(obj, Group)
else H5Dataset.from_h5py_dataset(obj)
for obj in h5py_group.values()
}
Source code in libs/h5/h5/_info.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
|
Functions⚓︎
h5.as_h5py_obj(obj: T_FsPathOrGroupLike) -> Union[File, Group]
⚓︎
Convert a path or h5py object to an h5py object
Source code in libs/h5/h5/core.py
146 147 148 149 150 |
|
h5.attrs(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, HDF5-attr)
Source code in libs/h5/h5/core.py
449 450 451 452 453 454 455 456 |
|
h5.attrs_dict(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Dict[str, Dict[str, Union[str, npt.NDArray[Any], int, float]]]
⚓︎
Load an HDF5 file from a fspath into a dictionary
Given a fspath this method loads an HDF5 file into a dictionary where the key => value pairs are the HDF5-path => HDF5-dataset for the file. This method relies on the h5_dataset_gen that is in this very module to generate tuples of the form (HDF5-path, HDF5-dataset).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5_obj
|
str
|
Filepath to an HDF5 format file |
required |
h5_path
|
str
|
HDF5 path to recurse down from |
''
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Union[str, NDArray[Any], int, float]]]
|
Dictionary with key => value paris of HDF5-path => HDF5-dataset |
Source code in libs/h5/h5/core.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
|
h5.attrs_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, HDF5-attr)
Source code in libs/h5/h5/core.py
459 460 461 462 463 |
|
h5.attrs_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/core.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|
h5.datasets(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, Dataset)
Source code in libs/h5/h5/core.py
432 433 434 435 436 437 438 439 |
|
h5.datasets_dict(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Dict[str, Union[npt.NDArray[Any], np.int8, np.float64]]
⚓︎
Load an HDF5 file from a fspath into a dictionary
Given a fspath this method loads an HDF5 file into a dictionary where the key => value pairs are the HDF5-path => HDF5-dataset for the file. This method relies on the h5_dataset_gen that is in this very module to generate tuples of the form (HDF5-path, HDF5-dataset).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5_obj
|
str
|
Filepath to an HDF5 format file |
required |
h5_path
|
str
|
Path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Dict[str, Union[NDArray[Any], int8, float64]]
|
Dictionary with key => value paris of HDF5-path => HDF5-dataset |
Source code in libs/h5/h5/core.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
h5.datasets_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, Dataset)
Source code in libs/h5/h5/core.py
442 443 444 445 446 |
|
h5.datasets_gen_from_fspath(fspath: str, h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
str
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples of the form (h5-path, h5py.Dataset) tuples |
Source code in libs/h5/h5/core.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
h5.datasets_keys_list(h5py_obj: Union[File, Group, FsPath]) -> List[str]
⚓︎
Return a list of all keys/paths for an h5py object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group, FsPath]
|
h5-h5py group object |
required |
Returns:
Type | Description |
---|---|
List[str]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
|
h5.fmt_h5_path(head: str, tail: str) -> str
cached
⚓︎
Format function for HDF5-path-strings
Example
fmt_h5_path("foo", "bar") '/foo/bar'
Source code in libs/h5/h5/core.py
134 135 136 137 138 139 140 141 142 143 |
|
h5.groups(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, h5py.Group)
Source code in libs/h5/h5/core.py
466 467 468 469 470 471 472 473 |
|
h5.groups_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, h5py.Group)
Source code in libs/h5/h5/core.py
476 477 478 479 480 |
|
h5.groups_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, Group]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Group]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/core.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
h5.h5_attrs_dict(fspath: str, h5_path: str = '') -> Dict[str, H5pyAttributesDict]
⚓︎
Alias for h5.attrs_dict
Source code in libs/h5/h5/legacy.py
54 55 56 57 |
|
h5.h5_attrs_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Alias for h5.datasets_gen
Source code in libs/h5/h5/legacy.py
68 69 70 71 72 73 |
|
h5.h5_attrs_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/legacy.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
h5.h5_datasets_dict(fspath: str, h5_path: str = '') -> Dict[str, Union[npt.NDArray[Any], np.int8, np.float64]]
⚓︎
Alias for h5.datasets_dict
Source code in libs/h5/h5/legacy.py
60 61 62 63 64 65 |
|
h5.h5_datasets_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Alias for h5.datasets_gen
Source code in libs/h5/h5/legacy.py
110 111 112 113 114 115 |
|
h5.h5_datasets_gen_from_fspath(fspath: str, h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
str
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples of the form (h5-path, h5py.Dataset) tuples |
Source code in libs/h5/h5/legacy.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
h5.h5py_obj_attrs_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Recursive h5py.AttributeManager generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
h5.h5py_obj_dataset_gen(h5py_obj: Union[File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Recursive h5 dataset generator.
Given an h5 group, which is what one gets after loading an h5 file via h5py, this function yields tuples containing (1.) a path (h5_path) to a dataset in the group, and (2.) the dataset itself as a numpy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
h5.h5py_obj_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, Union[Dataset, Group, File]]]
⚓︎
Recursive h5 dataset/group generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Union[Dataset, Group, File]]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
h5.h5py_obj_groups_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, Group]]
⚓︎
Recursive h5 groups generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Group]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
h5.h5py_obj_keys_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[str]
⚓︎
Recursive h5 dataset generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[str]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
h5.is_dataset(obj: Any) -> TypeGuard[Dataset]
⚓︎
h5py.Dataset type guard
Source code in libs/h5/h5/core.py
118 119 120 |
|
h5.is_file(obj: Any) -> TypeGuard[File]
⚓︎
h5py.File type guard
Source code in libs/h5/h5/core.py
113 114 115 |
|
h5.is_group(obj: Any) -> TypeGuard[Group]
⚓︎
h5py.Group type guard
Source code in libs/h5/h5/core.py
104 105 106 |
|
h5.is_h5py_dataset(obj: Any) -> TypeGuard[Dataset]
⚓︎
h5py.Dataset type guard
Source code in libs/h5/h5/core.py
99 100 101 |
|
h5.is_h5py_file(obj: Any) -> TypeGuard[File]
⚓︎
h5py.File type guard
Source code in libs/h5/h5/core.py
94 95 96 |
|
h5.is_h5py_group(obj: Any) -> TypeGuard[Group]
⚓︎
h5py.Group type guard
Source code in libs/h5/h5/core.py
89 90 91 |
|
h5.is_hdf5(path: FsPath) -> bool
⚓︎
Check if a file is an HDF5 file
Source code in libs/h5/h5/core.py
84 85 86 |
|
h5.keys_list(h5py_obj: Union[File, Group, FsPath]) -> List[str]
⚓︎
Return a list of all keys/paths for an h5py object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group, FsPath]
|
h5-h5py group object |
required |
Returns:
Type | Description |
---|---|
List[str]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
Modules⚓︎
h5.__about__
⚓︎
Package metadata/info
h5.__main__
⚓︎
pkg entry ~ python -m h5
h5.cli
⚓︎
h5.cli
Classes⚓︎
h5.cli.H5CliConfig(datasets: bool, attributes: bool, groups: bool, include: Optional[Tuple[str, ...]] = None, exclude: Optional[Tuple[str, ...]] = None)
dataclass
⚓︎
Functions⚓︎
h5.cli.cli(debug: bool = False) -> None
⚓︎
h5 command line interface
Source code in libs/h5/h5/cli.py
132 133 134 135 136 137 138 139 |
|
h5.cli.lsd(fspath: str, json_: bool = False, include: Tuple[str, ...] = ('**/*'), exclude: Optional[Tuple[str, ...]] = None) -> None
⚓︎
List datasets
Source code in libs/h5/h5/cli.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
|
h5.cli.lsg(fspath: str, json_: bool = False, include: Tuple[str, ...] = ('**/*'), exclude: Optional[Tuple[str, ...]] = None) -> None
⚓︎
List groups
Source code in libs/h5/h5/cli.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
Modules⚓︎
h5.core
⚓︎
HDF5 functions, and utils, and generators, OH MY!
Functions⚓︎
h5.core.as_h5py_obj(obj: T_FsPathOrGroupLike) -> Union[File, Group]
⚓︎
Convert a path or h5py object to an h5py object
Source code in libs/h5/h5/core.py
146 147 148 149 150 |
|
h5.core.attrs(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, HDF5-attr)
Source code in libs/h5/h5/core.py
449 450 451 452 453 454 455 456 |
|
h5.core.attrs_dict(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Dict[str, Dict[str, Union[str, npt.NDArray[Any], int, float]]]
⚓︎
Load an HDF5 file from a fspath into a dictionary
Given a fspath this method loads an HDF5 file into a dictionary where the key => value pairs are the HDF5-path => HDF5-dataset for the file. This method relies on the h5_dataset_gen that is in this very module to generate tuples of the form (HDF5-path, HDF5-dataset).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5_obj
|
str
|
Filepath to an HDF5 format file |
required |
h5_path
|
str
|
HDF5 path to recurse down from |
''
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Union[str, NDArray[Any], int, float]]]
|
Dictionary with key => value paris of HDF5-path => HDF5-dataset |
Source code in libs/h5/h5/core.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
|
h5.core.attrs_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, HDF5-attr)
Source code in libs/h5/h5/core.py
459 460 461 462 463 |
|
h5.core.attrs_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/core.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|
h5.core.datasets(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, Dataset)
Source code in libs/h5/h5/core.py
432 433 434 435 436 437 438 439 |
|
h5.core.datasets_dict(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Dict[str, Union[npt.NDArray[Any], np.int8, np.float64]]
⚓︎
Load an HDF5 file from a fspath into a dictionary
Given a fspath this method loads an HDF5 file into a dictionary where the key => value pairs are the HDF5-path => HDF5-dataset for the file. This method relies on the h5_dataset_gen that is in this very module to generate tuples of the form (HDF5-path, HDF5-dataset).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5_obj
|
str
|
Filepath to an HDF5 format file |
required |
h5_path
|
str
|
Path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Dict[str, Union[NDArray[Any], int8, float64]]
|
Dictionary with key => value paris of HDF5-path => HDF5-dataset |
Source code in libs/h5/h5/core.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
h5.core.datasets_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, Dataset)
Source code in libs/h5/h5/core.py
442 443 444 445 446 |
|
h5.core.datasets_gen_from_fspath(fspath: str, h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
str
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples of the form (h5-path, h5py.Dataset) tuples |
Source code in libs/h5/h5/core.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
h5.core.datasets_keys_list(h5py_obj: Union[File, Group, FsPath]) -> List[str]
⚓︎
Return a list of all keys/paths for an h5py object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group, FsPath]
|
h5-h5py group object |
required |
Returns:
Type | Description |
---|---|
List[str]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
|
h5.core.fmt_h5_path(head: str, tail: str) -> str
cached
⚓︎
Format function for HDF5-path-strings
Example
fmt_h5_path("foo", "bar") '/foo/bar'
Source code in libs/h5/h5/core.py
134 135 136 137 138 139 140 141 142 143 |
|
h5.core.groups(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, h5py.Group)
Source code in libs/h5/h5/core.py
466 467 468 469 470 471 472 473 |
|
h5.core.groups_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Return a generator that yields tuples with: (HDF5-path, h5py.Group)
Source code in libs/h5/h5/core.py
476 477 478 479 480 |
|
h5.core.groups_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, Group]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Group]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/core.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
h5.core.h5py_obj_attrs_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Recursive h5py.AttributeManager generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
h5.core.h5py_obj_dataset_gen(h5py_obj: Union[File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Recursive h5 dataset generator.
Given an h5 group, which is what one gets after loading an h5 file via h5py, this function yields tuples containing (1.) a path (h5_path) to a dataset in the group, and (2.) the dataset itself as a numpy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
h5.core.h5py_obj_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, Union[Dataset, Group, File]]]
⚓︎
Recursive h5 dataset/group generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Union[Dataset, Group, File]]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
h5.core.h5py_obj_groups_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[Tuple[str, Group]]
⚓︎
Recursive h5 groups generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Group]]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
h5.core.h5py_obj_keys_gen(h5py_obj: Union[File, Group], h5_path: str = '', root: bool = True) -> Iterable[str]
⚓︎
Recursive h5 dataset generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group]
|
h5-h5py group object |
required |
h5_path
|
str
|
path so far (Default value = "") |
''
|
root
|
bool
|
if True, yield the root path (Default value = True) |
True
|
Returns:
Type | Description |
---|---|
Iterable[str]
|
Generator that yields tuples; (h5-path, h5py.AttributeManager) |
Source code in libs/h5/h5/core.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
h5.core.is_dataset(obj: Any) -> TypeGuard[Dataset]
⚓︎
h5py.Dataset type guard
Source code in libs/h5/h5/core.py
118 119 120 |
|
h5.core.is_file(obj: Any) -> TypeGuard[File]
⚓︎
h5py.File type guard
Source code in libs/h5/h5/core.py
113 114 115 |
|
h5.core.is_group(obj: Any) -> TypeGuard[Group]
⚓︎
h5py.Group type guard
Source code in libs/h5/h5/core.py
104 105 106 |
|
h5.core.is_h5py_dataset(obj: Any) -> TypeGuard[Dataset]
⚓︎
h5py.Dataset type guard
Source code in libs/h5/h5/core.py
99 100 101 |
|
h5.core.is_h5py_file(obj: Any) -> TypeGuard[File]
⚓︎
h5py.File type guard
Source code in libs/h5/h5/core.py
94 95 96 |
|
h5.core.is_h5py_group(obj: Any) -> TypeGuard[Group]
⚓︎
h5py.Group type guard
Source code in libs/h5/h5/core.py
89 90 91 |
|
h5.core.is_hdf5(path: FsPath) -> bool
⚓︎
Check if a file is an HDF5 file
Source code in libs/h5/h5/core.py
84 85 86 |
|
h5.core.keys_list(h5py_obj: Union[File, Group, FsPath]) -> List[str]
⚓︎
Return a list of all keys/paths for an h5py object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h5py_obj
|
Union[File, Group, FsPath]
|
h5-h5py group object |
required |
Returns:
Type | Description |
---|---|
List[str]
|
Generator that yields tuples; (h5-path, h5py.Dataset) |
Source code in libs/h5/h5/core.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
h5.dev
⚓︎
h5.dev ~ Under construction!
h5.legacy
⚓︎
Legacy; to be deprecated
Functions⚓︎
h5.legacy.h5_attrs_dict(fspath: str, h5_path: str = '') -> Dict[str, H5pyAttributesDict]
⚓︎
Alias for h5.attrs_dict
Source code in libs/h5/h5/legacy.py
54 55 56 57 |
|
h5.legacy.h5_attrs_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Alias for h5.datasets_gen
Source code in libs/h5/h5/legacy.py
68 69 70 71 72 73 |
|
h5.legacy.h5_attrs_gen_from_fspath(fspath: FsPath, h5_path: str = '') -> Iterable[Tuple[str, AttributeManager]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
FsPath
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, AttributeManager]]
|
Generator that yields tuples of the form (h5-path, h5py.AttributeManager) tuples |
Source code in libs/h5/h5/legacy.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
h5.legacy.h5_datasets_dict(fspath: str, h5_path: str = '') -> Dict[str, Union[npt.NDArray[Any], np.int8, np.float64]]
⚓︎
Alias for h5.datasets_dict
Source code in libs/h5/h5/legacy.py
60 61 62 63 64 65 |
|
h5.legacy.h5_datasets_gen(h5_obj: Union[FsPath, File, Group], h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Alias for h5.datasets_gen
Source code in libs/h5/h5/legacy.py
110 111 112 113 114 115 |
|
h5.legacy.h5_datasets_gen_from_fspath(fspath: str, h5_path: str = '') -> Iterable[Tuple[str, Dataset]]
⚓︎
Given a fspath to an h5, yield (h5-path, h5py.Dataset) tuples
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fspath
|
str
|
fspath to h5 format file |
required |
h5_path
|
str
|
h5 path to start from. Defaults to "". |
''
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[str, Dataset]]
|
Generator that yields tuples of the form (h5-path, h5py.Dataset) tuples |
Source code in libs/h5/h5/legacy.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
h5.testing
⚓︎
Functions⚓︎
h5.testing.make_test_hdf5_file(filepath: Union[str, Path]) -> str
⚓︎
Make test hdf5 file and return filepath
Source code in libs/h5/h5/testing.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|