Advanced API
For now, we list the remaining package documentation here.
Scida is a python package for reading and analyzing scientific big data.
config
Configuration handling.
combine_configs(configs, mode='overwrite_keys')
Combine multiple configurations recursively. Replacing entries in the first config with entries from the latter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configs |
List[Dict]
|
The list of configurations to combine. |
required |
mode |
The mode for combining the configurations. "overwrite_keys": overwrite keys in the first config with keys from the latter (default). "overwrite_values": overwrite values in the first config with values from the latter. |
'overwrite_keys'
|
Returns:
Type | Description |
---|---|
dict
|
The combined configuration. |
Source code in src/scida/config.py
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 122 123 124 |
|
copy_defaultconfig(overwrite=False)
Copy the configuration example to the user's home directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
overwrite |
Overwrite existing configuration file. |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/config.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
get_config(reload=False, update_global=True)
Load the configuration from the default path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reload |
bool
|
Reload the configuration, even if it has already been loaded. |
False
|
update_global |
Update the global configuration dictionary. |
True
|
Returns:
Type | Description |
---|---|
dict
|
The configuration dictionary. |
Source code in src/scida/config.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
get_config_fromfile(resource)
Load config from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource |
str
|
The name of the resource or file path. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/config.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
get_config_fromfiles(paths, subconf_keys=None)
Load and merge multiple YAML config files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths |
List[str]
|
Paths to the config files. |
required |
subconf_keys |
Optional[List[str]]
|
The keys to the correct sub configuration within each config. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/config.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
get_simulationconfig()
Get the simulation configuration. Search regular user config file, scida simulation config file, and user's simulation config file.
Returns:
Type | Description |
---|---|
dict
|
The simulation configuration. |
Source code in src/scida/config.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
merge_dicts_recursively(dict_a, dict_b, path=None, mergefunc_keys=None, mergefunc_values=None)
Merge two dictionaries recursively.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dict_a |
Dict
|
The first dictionary. |
required |
dict_b |
Dict
|
The second dictionary. |
required |
path |
Optional[List]
|
The path to the current node. |
None
|
mergefunc_keys |
Optional[callable]
|
The function to use for merging dict keys. If None, we recursively enter the dictionary. |
None
|
mergefunc_values |
Optional[callable]
|
The function to use for merging dict values. If None, collisions will raise an exception. |
None
|
Returns:
Type | Description |
---|---|
dict
|
|
Source code in src/scida/config.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
|
convenience
download_and_extract(url, path, progressbar=True, overwrite=False)
Download and extract a file from a given url.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
The url to download from. |
required |
path |
Path
|
The path to download to. |
required |
progressbar |
bool
|
Whether to show a progress bar. |
True
|
overwrite |
bool
|
Whether to overwrite an existing file. |
False
|
Returns:
Type | Description |
---|---|
str
|
The path to the downloaded and extracted file(s). |
Source code in src/scida/convenience.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
find_path(path, overwrite=False)
Find path to dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
|
required | |
overwrite |
Only for remote datasets. Whether to overwrite an existing download. |
False
|
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/convenience.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_dataset(name=None, props=None)
Get dataset by name or properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name or alias of dataset. |
None
|
|
props |
Properties to match. |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
Dataset name. |
Source code in src/scida/convenience.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
get_dataset_by_name(name)
Get dataset name from alias or name found in the configuration files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name or alias of dataset. |
required |
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/convenience.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
get_dataset_candidates(name=None, props=None)
Get dataset candidates by name or properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name or alias of dataset. |
None
|
|
props |
Properties to match. |
None
|
Returns:
Type | Description |
---|---|
list[str]:
|
List of candidate dataset names. |
Source code in src/scida/convenience.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
get_datasets_by_props(**kwargs)
Get dataset names by properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs |
Properties to match. |
{}
|
Returns:
Type | Description |
---|---|
list[str]:
|
List of dataset names. |
Source code in src/scida/convenience.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
get_testdata(name)
Get path to test data identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of test data. |
required |
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/convenience.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
load(path, units=True, unitfile='', overwrite=False, force_class=None, **kwargs)
Load a dataset or dataset series from a given path. This function will automatically determine the best-matching class to use and return the initialized instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path to dataset or dataset series. Usually the base folder containing all files of a given dataset/series. |
required |
units |
Union[bool, str]
|
Whether to load units. |
True
|
unitfile |
str
|
Can explicitly pass path to a unitfile to use. |
''
|
overwrite |
bool
|
Whether to overwrite an existing cache. |
False
|
force_class |
Optional[object]
|
Force a specific class to be used. |
None
|
kwargs |
Additional keyword arguments to pass to the class. |
{}
|
Returns:
Type | Description |
---|---|
Union[Dataset, DatasetSeries]:
|
Initialized dataset or dataset series. |
Source code in src/scida/convenience.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 |
|
customs
arepo
MTNG
dataset
Support for MTNG-Arepo datasets, see https://www.mtng-project.org/
MTNGArepoCatalog
Bases: ArepoCatalog
A dataset representing a MTNG-Arepo catalog.
Source code in src/scida/customs/arepo/MTNG/dataset.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 |
|
__init__(*args, **kwargs)
Initialize an MTNGArepoCatalog object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Source code in src/scida/customs/arepo/MTNG/dataset.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path as a candidate for the MTNG-Arepo catalog class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
Path to validate. |
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
Whether the path is a candidate for this dataset class. |
Source code in src/scida/customs/arepo/MTNG/dataset.py
148 149 150 151 152 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 |
|
MTNGArepoSnapshot
Bases: ArepoSnapshot
MTNGArepoSnapshot is a snapshot class for the MTNG project.
Source code in src/scida/customs/arepo/MTNG/dataset.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 |
|
__init__(path, chunksize='auto', catalog=None, **kwargs)
Initialize an MTNGArepoSnapshot object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to the snapshot folder, should contain "output" folder. |
required | |
chunksize |
Chunksize for the data. |
'auto'
|
|
catalog |
Explicitly state catalog path to use. |
None
|
|
kwargs |
Additional keyword arguments. |
{}
|
Source code in src/scida/customs/arepo/MTNG/dataset.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path as a candidate for the MTNG-Arepo snapshot class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
Path to validate. |
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
Whether the path is a candidate for this dataset class. |
Source code in src/scida/customs/arepo/MTNG/dataset.py
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 122 123 |
|
TNGcluster
dataset
TNGClusterSelector
Bases: Selector
Selector for TNGClusterSnapshot. Can select for zoomID, which selects a given zoom target. Can specify withfuzz=True to include the "fuzz" particles for a given zoom target. Can specify onlyfuzz=True to only return the "fuzz" particles for a given zoom target.
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
__init__()
Initialize the selector.
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
20 21 22 23 24 25 |
|
prepare(*args, **kwargs)
Prepare the selector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
TNGClusterSnapshot
Bases: ArepoSnapshot
Dataset class for the TNG-Cluster simulation.
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
173 174 175 176 177 178 179 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
|
__init__(*args, **kwargs)
Initialize a TNGClusterSnapshot object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Source code in src/scida/customs/arepo/TNGcluster/dataset.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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
return_data()
Return the data object.
Returns:
Type | Description |
---|---|
FieldContainer
|
The data object. |
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
238 239 240 241 242 243 244 245 246 247 248 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path as a candidate for TNG-Cluster snapshot class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
Path to validate. |
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
Whether the path is a candidate for this simulation class. |
Source code in src/scida/customs/arepo/TNGcluster/dataset.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
|
dataset
ArepoCatalog
Bases: ArepoSnapshot
Dataset class for Arepo group catalogs.
Source code in src/scida/customs/arepo/dataset.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
|
__init__(*args, **kwargs)
Initialize an ArepoCatalog object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Source code in src/scida/customs/arepo/dataset.py
691 692 693 694 695 696 697 698 699 700 701 702 703 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path to use for instantiation of this class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
|
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
|
Source code in src/scida/customs/arepo/dataset.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
|
ArepoSnapshot
Bases: SpatialCartesian3DMixin
, GadgetStyleSnapshot
Dataset class for Arepo snapshots.
Source code in src/scida/customs/arepo/dataset.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 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 503 504 505 506 507 508 509 510 511 512 513 514 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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
|
__init__(path, chunksize='auto', catalog=None, **kwargs)
Initialize an ArepoSnapshot object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to snapshot, typically a directory containing multiple hdf5 files. |
required | |
chunksize |
Chunksize to use for dask arrays. Can be "auto" to automatically determine chunksize. |
'auto'
|
|
catalog |
Path to group catalog. If None, the catalog is searched for in the parent directories. |
None
|
|
kwargs |
Additional keyword arguments. |
{}
|
Source code in src/scida/customs/arepo/dataset.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 |
|
add_catalogIDs()
Add field for halo and subgroup IDs for all particle types.
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
add_groupquantity_to_particles(name, parttype='PartType0')
Map a quantity from the group catalog to the particles based on a particle's group index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name of quantity to map |
required | |
parttype |
Name of particle type |
'PartType0'
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
481 482 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 513 514 515 |
|
discover_catalog()
Discover the group catalog given the current path
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
get_grouplengths(parttype='PartType0')
Get the lengths, i.e. the total number of particles, of a given type in all halos.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
Name of particle type |
'PartType0'
|
Returns:
Type | Description |
---|---|
ndarray
|
|
Source code in src/scida/customs/arepo/dataset.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
|
get_groupoffsets(parttype='PartType0')
Get the array index offset of the first particle of a given type in each halo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
Name of particle type |
'PartType0'
|
Returns:
Type | Description |
---|---|
ndarray
|
|
Source code in src/scida/customs/arepo/dataset.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
|
get_subhalolengths(parttype='PartType0')
Get the lengths, i.e. the total number of particles, of a given type in all subhalos.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
|
'PartType0'
|
Returns:
Type | Description |
---|---|
ndarray
|
|
Source code in src/scida/customs/arepo/dataset.py
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
|
get_subhalooffsets(parttype='PartType0')
Get the array index offset of the first particle of a given type in each subhalo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
|
'PartType0'
|
Returns:
Type | Description |
---|---|
ndarray
|
|
Source code in src/scida/customs/arepo/dataset.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
|
grouped(fields='', parttype='PartType0', objtype='halo')
Create a GroupAwareOperation object for applying operations to groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fields |
Union[str, Array, List[str], Dict[str, Array]]
|
Fields to pass to the operation. Can be a string, a dask array, a list of strings or a dictionary of dask arrays. |
''
|
parttype |
Particle type to operate on. |
'PartType0'
|
|
objtype |
Type of object to operate on. Can be "halo" or "subhalo". Default: "halo" |
'halo'
|
Returns:
Type | Description |
---|---|
GroupAwareOperation
|
|
Source code in src/scida/customs/arepo/dataset.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
|
load_catalog(overwrite_cache=False, units=False, cosmological=False, catalog_cls=None)
Load the group catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs |
Keyword arguments passed to the catalog class. |
required | |
catalog_cls |
Class to use for the catalog. If None, the default catalog class is used. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 |
|
map_group_operation(func, cpucost_halo=10000.0, nchunks_min=None, chunksize_bytes=None, nmax=None, idxlist=None, objtype='halo')
Apply a function to each halo in the catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
objtype |
Type of object to process. Can be "halo" or "subhalo". Default: "halo" |
'halo'
|
|
idxlist |
List of halo indices to process. If not provided, all halos are processed. |
None
|
|
func |
Function to apply to each halo. Must take a dictionary of arrays as input. |
required | |
cpucost_halo |
"CPU cost" of processing a single halo. This is a relative value to the processing time per input particle used for calculating the dask chunks. Default: 1e4 |
10000.0
|
|
nchunks_min |
Minimum number of particles in a halo to process it. Default: None |
None
|
|
chunksize_bytes |
|
None
|
|
nmax |
Only process the first nmax halos. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
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 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
|
register_field(parttype, name=None, construct=False)
Register a field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
str
|
name of particle type |
required |
name |
str
|
name of field |
None
|
construct |
bool
|
construct field immediately |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
|
return_data()
Return data object of this snapshot.
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
217 218 219 220 221 222 223 224 225 226 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path to use for instantiation of this class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
|
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
|
Source code in src/scida/customs/arepo/dataset.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 209 210 211 212 213 214 215 |
|
ChainOps
Chain operations together.
Source code in src/scida/customs/arepo/dataset.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
|
__init__(*funcs)
Initialize a ChainOps object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
funcs |
Functions to chain together. |
()
|
Source code in src/scida/customs/arepo/dataset.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
GroupAwareOperation
Class for applying operations to groups.
Source code in src/scida/customs/arepo/dataset.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
|
apply(func, final=False)
Apply a passed function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Function to apply. |
required | |
final |
Whether this is the final operation in the chain. |
False
|
Returns:
Type | Description |
---|---|
GroupAwareOperation
|
|
Source code in src/scida/customs/arepo/dataset.py
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 |
|
chain(add_op=None, final=False)
Chain another operation to this one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
add_op |
Operation to add. Can be a string (e.g. "min", "max", "sum") or a function. |
None
|
|
final |
Whether this is the final operation in the chain. |
False
|
Returns:
Type | Description |
---|---|
GroupAwareOperation
|
|
Source code in src/scida/customs/arepo/dataset.py
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 |
|
evaluate(nmax=None, idxlist=None, compute=True)
Evaluate the operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nmax |
Maximum number of halos to process. |
None
|
|
idxlist |
List of halo indices to process. If not provided, (and nmax not set) all halos are processed. |
None
|
|
compute |
Whether to compute the result immediately or return a dask object to compute later. |
True
|
Source code in src/scida/customs/arepo/dataset.py
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
|
half()
Half the number of particles in each group member. For testing purposes.
Returns:
Type | Description |
---|---|
GroupAwareOperation
|
|
Source code in src/scida/customs/arepo/dataset.py
861 862 863 864 865 866 867 868 869 |
|
max(field=None)
Get the maximum value for each group member.
Source code in src/scida/customs/arepo/dataset.py
841 842 843 844 845 846 847 848 849 |
|
min(field=None)
Get the minimum value for each group member.
Source code in src/scida/customs/arepo/dataset.py
831 832 833 834 835 836 837 838 839 |
|
sum(field=None)
Sum the values for each group member.
Source code in src/scida/customs/arepo/dataset.py
851 852 853 854 855 856 857 858 859 |
|
Temperature(arrs, ureg=None, **kwargs)
Compute gas temperature given (ElectronAbundance,InternalEnergy) in [K].
Source code in src/scida/customs/arepo/dataset.py
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 |
|
compute_haloindex(gidx, halocelloffsets, *args, index_unbound=None)
Computes the halo index for each particle with dask.
Source code in src/scida/customs/arepo/dataset.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 |
|
compute_haloquantity(gidx, halocelloffsets, hvals, *args)
Computes a halo quantity for each particle with dask.
Source code in src/scida/customs/arepo/dataset.py
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 |
|
compute_localsubhaloindex(gidx, halocelloffsets, shnumber, shcounts, shcellcounts, index_unbound=None)
Compute the local subhalo index for each particle with dask. The local subhalo index is the index of the subhalo within each halo, starting at 0 for the central subhalo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gidx |
|
required | |
halocelloffsets |
|
required | |
shnumber |
|
required | |
shcounts |
|
required | |
shcellcounts |
|
required | |
index_unbound |
|
None
|
Source code in src/scida/customs/arepo/dataset.py
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
|
get_hidx(gidx_start, gidx_count, celloffsets, index_unbound=None)
Get halo index of a given cell
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gidx_start |
The first unique integer ID for the first particle |
required | |
gidx_count |
The amount of halo indices we are querying after "gidx_start" |
required | |
celloffsets |
array
|
An array holding the starting cell offset for each halo. Needs to include the offset after the last halo. The required shape is thus (Nhalo+1,). |
required |
index_unbound |
integer
|
The index to use for unbound particles. If None, the maximum integer value of the dtype is used. |
None
|
Source code in src/scida/customs/arepo/dataset.py
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 |
|
get_localshidx(gidx_start, gidx_count, celloffsets, shnumber, shcounts, shcellcounts, index_unbound=None)
Get the local subhalo index for each particle. This is the subhalo index within each halo group. Particles belonging to the central galaxies will have index 0, particles belonging to the first satellite will have index 1, etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gidx_start |
int
|
|
required |
gidx_count |
int
|
|
required |
celloffsets |
NDArray[int64]
|
|
required |
shnumber |
|
required | |
shcounts |
|
required | |
shcellcounts |
|
required | |
index_unbound |
The index to use for unbound particles. If None, the maximum integer value of the dtype is used. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
|
Source code in src/scida/customs/arepo/dataset.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 |
|
get_shcounts_shcells(SubhaloGrNr, hlength)
Returns the id of the first subhalo and count of subhalos per halo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
SubhaloGrNr |
The group identifier that each subhalo belongs to respectively |
required | |
hlength |
The number of halos in the snapshot |
required |
Returns:
Name | Type | Description |
---|---|---|
shcounts |
ndarray
|
The number of subhalos per halo |
shnumber |
ndarray
|
The index of the first subhalo per halo |
Source code in src/scida/customs/arepo/dataset.py
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 |
|
map_group_operation(func, offsets, lengths, arrdict, cpucost_halo=10000.0, nchunks_min=None, chunksize_bytes=None, entry_nbytes_in=4, fieldnames=None, nmax=None, idxlist=None)
Map a function to all halos in a halo catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idxlist |
Optional[ndarray]
|
Only process the halos with these indices. |
None
|
nmax |
Optional[int]
|
Only process the first nmax halos. |
None
|
func |
|
required | |
offsets |
Offset of each group in the particle catalog. |
required | |
lengths |
Number of particles per halo. |
required | |
arrdict |
|
required | |
cpucost_halo |
|
10000.0
|
|
nchunks_min |
Optional[int]
|
Lower bound on the number of halos per chunk. |
None
|
chunksize_bytes |
Optional[int]
|
|
None
|
entry_nbytes_in |
Optional[int]
|
|
4
|
fieldnames |
Optional[List[str]]
|
|
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 |
|
map_group_operation_get_chunkedges(lengths, entry_nbytes_in, entry_nbytes_out, cpucost_halo=1.0, nchunks_min=None, chunksize_bytes=None)
Compute the chunking of a halo operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lengths |
The number of particles per halo. |
required | |
entry_nbytes_in |
|
required | |
entry_nbytes_out |
|
required | |
cpucost_halo |
|
1.0
|
|
nchunks_min |
|
None
|
|
chunksize_bytes |
|
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/dataset.py
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 |
|
memorycost_limiter(cost_memory, cost_cpu, list_chunkedges, cost_memory_max)
If a chunk too memory expensive, split into equal cpu expense operations.
Source code in src/scida/customs/arepo/dataset.py
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
|
wrap_func_scalar(func, offsets_in_chunks, lengths_in_chunks, *arrs, block_info=None, block_id=None, func_output_shape=(1), func_output_dtype='float64', fill_value=0)
Wrapper for applying a function to each halo in the passed chunk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
|
required | |
offsets_in_chunks |
|
required | |
lengths_in_chunks |
|
required | |
arrs |
|
()
|
|
block_info |
|
None
|
|
block_id |
|
None
|
|
func_output_shape |
|
(1)
|
|
func_output_dtype |
|
'float64'
|
|
fill_value |
|
0
|
Source code in src/scida/customs/arepo/dataset.py
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
|
helpers
Helper functions for arepo snapshots/simulations.
grp_type_str(gtype)
Mapping between common group names and numeric group types.
Source code in src/scida/customs/arepo/helpers.py
4 5 6 7 8 9 10 |
|
part_type_num(ptype)
Mapping between common particle names and numeric particle types.
Source code in src/scida/customs/arepo/helpers.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
selector
Selector for ArepoSnapshot
ArepoSelector
Bases: Selector
Selector for ArepoSnapshot. Can select for haloID, subhaloID, and unbound particles.
Source code in src/scida/customs/arepo/selector.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 |
|
__init__()
Initialize the selector.
Source code in src/scida/customs/arepo/selector.py
18 19 20 21 22 23 |
|
select_group(snap, idx, objtype='Group')
Select particles for given group/subhalo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snap |
|
required | |
idx |
|
required | |
objtype |
|
'Group'
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/selector.py
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 122 |
|
select_unbound(snap)
Select unbound particles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snap |
|
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/arepo/selector.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
series
Contains Series class for Arepo simulations.
ArepoSimulation
Bases: GadgetStyleSimulation
A series representing an Arepo simulation.
Source code in src/scida/customs/arepo/series.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
__init__(path, lazy=True, async_caching=False, **interface_kwargs)
Initialize an ArepoSimulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to the simulation folder, should contain "output" folder. |
required | |
lazy |
Whether to load data files lazily. |
True
|
|
interface_kwargs |
Additional keyword arguments passed to the interface. |
{}
|
Source code in src/scida/customs/arepo/series.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate a path as a candidate for this simulation class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to validate. |
required | |
args |
Additional positional arguments. |
()
|
|
kwargs |
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
Whether the path is a candidate for this simulation class. |
Source code in src/scida/customs/arepo/series.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
gadgetstyle
dataset
Defines the GadgetStyleSnapshot class, mostly used for deriving subclasses for related codes/simulations.
GadgetStyleSnapshot
Bases: Dataset
A dataset representing a Gadget-style snapshot.
Source code in src/scida/customs/gadgetstyle/dataset.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
__init__(path, chunksize='auto', virtualcache=True, **kwargs)
We define gadget-style snapshots as nbody/hydrodynamical simulation snapshots that follow the common /PartType0, /PartType1 grouping scheme.
Source code in src/scida/customs/gadgetstyle/dataset.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
merge_data(secondobj, fieldname_suffix='', root_group=None)
Merge data from other snapshot into self.data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secondobj |
|
required | |
fieldname_suffix |
|
''
|
|
root_group |
Optional[str]
|
|
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/gadgetstyle/dataset.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
merge_hints(secondobj)
Merge hints from other snapshot into self.hints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secondobj |
Other snapshot to merge hints from. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/customs/gadgetstyle/dataset.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
register_field(parttype, name=None, description='')
Register a field for a given particle type by returning through decorator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parttype |
Particle type name to register with. If None, register for the base field container. |
required | |
name |
Name of the field to register. |
None
|
|
description |
Description of the field to register. |
''
|
Returns:
Type | Description |
---|---|
callable
|
|
Source code in src/scida/customs/gadgetstyle/dataset.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
validate_path(path, *args, expect_grp=False, **kwargs)
classmethod
Check if path is valid for this interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, PathLike]
|
path to check |
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/scida/customs/gadgetstyle/dataset.py
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
series
Defines a series representing a Gadget-style simulation.
GadgetStyleSimulation
Bases: DatasetSeries
A series representing a Gadget-style simulation.
Source code in src/scida/customs/gadgetstyle/series.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 |
|
__init__(path, prefix_dict=None, subpath_dict=None, arg_dict=None, lazy=True, **interface_kwargs)
Initialize a GadgetStyleSimulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to the simulation folder, should contain "output" folder. |
required | |
prefix_dict |
Optional[Dict]
|
|
None
|
subpath_dict |
Optional[Dict]
|
|
None
|
arg_dict |
Optional[Dict]
|
|
None
|
lazy |
|
True
|
|
interface_kwargs |
|
{}
|
Source code in src/scida/customs/gadgetstyle/series.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 |
|
discovertypes
Functionality to determine the dataset or dataseries type of a given path.
CandidateStatus
Bases: Enum
Enum to indicate our confidence in a candidate.
Source code in src/scida/discovertypes.py
22 23 24 25 26 27 28 29 30 |
|
fields
DerivedFieldRecipe
Bases: FieldRecipe
Recipe for a derived field.
Source code in src/scida/fields.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
__init__(name, func, description='', units=None)
See FieldRecipe for parameters.
Source code in src/scida/fields.py
73 74 75 76 77 78 79 80 81 |
|
FieldContainer
Bases: MutableMapping
A mutable collection of fields. Attempt to construct from derived fields recipes if needed.
Source code in src/scida/fields.py
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 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 503 504 505 506 507 508 509 510 511 512 513 514 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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
|
dataframe
property
Return a dask dataframe of the fields in this container.
Returns:
Type | Description |
---|---|
DataFrame
|
|
fieldcount
property
Return the number of fields.
Returns:
Type | Description |
---|---|
int
|
|
fieldlength
property
Try to infer the number of entries for the fields in this container. If all fields have the same length, return this length. Otherwise, return None.
Returns:
Type | Description |
---|---|
Optional[int]
|
|
__init__(*args, fieldrecipes_kwargs=None, containers=None, aliases=None, withunits=False, ureg=None, parent=None, name=None, **kwargs)
Construct a FieldContainer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
fieldrecipes_kwargs |
default kwargs used for field recipes |
None
|
|
containers |
list of containers to add. FieldContainers in the list will be deep copied. If a list element is a string, a new FieldContainer with the given name will be created. |
None
|
|
aliases |
|
None
|
|
withunits |
|
False
|
|
ureg |
|
None
|
|
parent |
Optional[FieldContainer]
|
parent container |
None
|
kwargs |
|
{}
|
Source code in src/scida/fields.py
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
__repr__()
Return a string representation of the object.
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/fields.py
450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
add_alias(alias, name)
Add an alias for a field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alias |
Alias name |
required | |
name |
Field name |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/fields.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
|
add_container(key, deep=False, **kwargs)
Add a sub-container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
|
required | |
deep |
If True, make a deep copy of the container. |
False
|
|
kwargs |
keyword arguments for the FieldContainer constructor. |
{}
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/fields.py
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
|
copy()
Perform a deep (?) copy of the FieldContainer.
Returns:
Type | Description |
---|---|
FieldContainer
|
|
Source code in src/scida/fields.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
|
copy_skeleton()
Copy the skeleton of the container (i.e., only the containers, not the fields).
Returns:
Type | Description |
---|---|
FieldContainer
|
|
Source code in src/scida/fields.py
177 178 179 180 181 182 183 184 185 186 187 188 |
|
get(key, value=None, allow_derived=True, force_derived=False)
Get a field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
|
required | |
value |
|
None
|
|
allow_derived |
Allow derived fields. |
True
|
|
force_derived |
Use the derived field description over instantiated fields. |
False
|
Returns:
Type | Description |
---|---|
Array
|
|
Source code in src/scida/fields.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
|
get_dataframe(fields=None)
Return a dask dataframe of the fields in this container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fields |
List of fields to include. If None, include all. |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
|
Source code in src/scida/fields.py
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 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
get_ureg(discover=True)
Get the unit registry.
Source code in src/scida/fields.py
165 166 167 168 169 170 171 172 173 174 175 |
|
info(level=0, name=None)
Return a string representation of the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level |
Level in case of nested containers. |
0
|
|
name |
Optional[str]
|
Name of the container. |
None
|
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/fields.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
items(withrecipes=True, withfields=True, evaluate=True)
Return a list of tuples for keys/values in the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
withrecipes |
Whether to include recipes. |
True
|
|
withfields |
Whether to include fields. |
True
|
|
evaluate |
Whether to evaluate recipes. |
True
|
Returns:
Type | Description |
---|---|
list
|
|
Source code in src/scida/fields.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
keys(withgroups=True, withrecipes=True, withinternal=False, withfields=True)
Return a list of keys in the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
withgroups |
bool
|
Include sub-containers. |
True
|
withrecipes |
bool
|
Include recipes (i.e. not yet instantiated fields). |
True
|
withinternal |
bool
|
Include internal fields. |
False
|
withfields |
bool
|
Include fields. |
True
|
Source code in src/scida/fields.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
merge(collection, overwrite=True)
Merge another FieldContainer into this one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection |
FieldContainer
|
Container to merge. |
required |
overwrite |
bool
|
Overwrite existing fields if true. |
True
|
Source code in src/scida/fields.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
register_field(containernames=None, name=None, description='', units=None)
Decorator to register a field recipe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
containernames |
Name of the sub-container(s) to register to, or "all" for all, or None for self. |
None
|
|
name |
Optional[str]
|
Name of the field. If None, the function name is used. |
None
|
description |
Description of the field. |
''
|
|
units |
Units of the field. |
None
|
Returns:
Type | Description |
---|---|
callable
|
|
Source code in src/scida/fields.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
remove_container(key)
Remove a sub-container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
Name of the sub-container. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/fields.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
|
set_ureg(ureg=None, discover=True)
Set the unit registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ureg |
Unit registry. |
None
|
|
discover |
Attempt to discover unit registry from fields. |
True
|
Source code in src/scida/fields.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
values(evaluate=True)
Return fields/recipes the container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
evaluate |
Whether to evaluate recipes. |
True
|
Returns:
Type | Description |
---|---|
list
|
|
Source code in src/scida/fields.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
FieldRecipe
Bases: object
Recipe for a field.
Source code in src/scida/fields.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
__init__(name, func=None, arr=None, description='', units=None, ftype=FieldType.IO)
Recipes for a field. Either specify a function or an array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name of the field. |
required | |
func |
Function to construct array of the field. |
None
|
|
arr |
Array to construct the field. |
None
|
|
description |
Description of the field. |
''
|
|
units |
Units of the field. |
None
|
|
ftype |
Type of the field. |
IO
|
Source code in src/scida/fields.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
FieldType
Bases: Enum
Enum for field types.
Source code in src/scida/fields.py
22 23 24 25 26 27 28 29 |
|
walk_container(cntr, path='', handler_field=None, handler_group=None, withrecipes=False)
Recursively walk a container and call handlers on fields and groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cntr |
Container to walk. |
required | |
path |
relative path in hierarchy to this container |
''
|
|
handler_field |
Function to call on fields. |
None
|
|
handler_group |
Function to call on subcontainers. |
None
|
|
withrecipes |
Include recipes. |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/fields.py
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
|
helpers_hdf5
Helper functions for hdf5 and zarr file processing.
create_mergedhdf5file(fn, files, max_workers=None, virtual=True, groupwise_shape=False)
Creates a virtual hdf5 file from list of given files. Virtual by default.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
file to write to |
required | |
files |
files to merge |
required | |
max_workers |
parallel workers to process files |
None
|
|
virtual |
whether to create linked ("virtual") dataset on disk (otherwise copy) |
True
|
|
groupwise_shape |
whether to require shapes to be the same within a group |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/helpers_hdf5.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
get_dtype(obj)
Get the data type of given h5py.Dataset or zarr.Array object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
object to get dtype from |
required |
Returns:
Name | Type | Description |
---|---|---|
dtype |
dtype
|
dtype of the object |
Source code in src/scida/helpers_hdf5.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
walk_group(obj, tree, get_attrs=False, scalar_to_attr=True)
Walks through a h5py.Group or zarr.Group object and fills the tree dictionary with information about the datasets and groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
object to walk through |
required | |
tree |
dictionary to fill recursively |
required | |
get_attrs |
whether to get attributes of each object |
False
|
|
scalar_to_attr |
whether to convert scalar datasets to attributes |
True
|
Source code in src/scida/helpers_hdf5.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
walk_hdf5file(fn, tree, get_attrs=True)
Walks through a hdf5 file and fills the tree dictionary with information about the datasets and groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
file path to hdf5 file to walk through |
required | |
tree |
dictionary to fill recursively |
required | |
get_attrs |
whether to get attributes of each object |
True
|
Returns:
Name | Type | Description |
---|---|---|
tree |
dict
|
filled dictionary |
Source code in src/scida/helpers_hdf5.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
walk_zarrfile(fn, tree, get_attrs=True)
Walks through a zarr file and fills the tree dictionary with information about the datasets and groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
file path to zarr file to walk through |
required | |
tree |
dictionary to fill recursively |
required | |
get_attrs |
whether to get attributes of each object |
True
|
Returns:
Name | Type | Description |
---|---|---|
tree |
dict
|
filled dictionary |
Source code in src/scida/helpers_hdf5.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
helpers_misc
RecursiveNamespace
Bases: SimpleNamespace
A SimpleNamespace that can be created recursively from a dict
Source code in src/scida/helpers_misc.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__elt(elt)
Recurse into elt to create leaf namespace objects.
Source code in src/scida/helpers_misc.py
42 43 44 45 46 47 48 49 50 |
|
__init__(**kwargs)
Create a SimpleNamespace recursively
Source code in src/scida/helpers_misc.py
35 36 37 38 39 40 |
|
computedecorator(func)
Decorator introducing compute keyword to evalute dask array returns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Function to decorate |
required |
Returns:
Type | Description |
---|---|
callable
|
Decorated function |
Source code in src/scida/helpers_misc.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
get_args(func)
Get the positional arguments of a function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
|
required |
Returns:
Type | Description |
---|---|
list
|
Positional arguments of the function |
Source code in src/scida/helpers_misc.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
get_kwargs(func)
Get the keyword arguments of a function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Function to get keyword arguments from |
required |
Returns:
Type | Description |
---|---|
dict
|
Keyword arguments of the function |
Source code in src/scida/helpers_misc.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
hash_path(path)
Hash a path to a fixed length string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
|
required |
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/helpers_misc.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
make_serializable(v)
Make a value JSON serializable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v |
Object to make JSON serializable |
required |
Returns:
Type | Description |
---|---|
any
|
JSON serializable object |
Source code in src/scida/helpers_misc.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
map_blocks(func, *args, name=None, token=None, dtype=None, chunks=None, drop_axis=None, new_axis=None, enforce_ndim=False, meta=None, output_units=None, **kwargs)
map_blocks with units
Source code in src/scida/helpers_misc.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
parse_humansize(size)
Parse a human-readable size string to bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size |
Human readable size string, e.g. 1.5GiB |
required |
Returns:
Type | Description |
---|---|
int
|
Size in bytes |
Source code in src/scida/helpers_misc.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
sprint(*args, end='\n', **kwargs)
Print to a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
Arguments to print |
()
|
|
end |
String to append at the end |
'\n'
|
|
kwargs |
Keyword arguments to pass to print |
{}
|
Returns:
Type | Description |
---|---|
str
|
String to print |
Source code in src/scida/helpers_misc.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
interface
Base dataset class and its handling.
BaseDataset
Base class for all datasets.
Source code in src/scida/interface.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 |
|
__dask_tokenize__()
Token for dask to be derived -- naively from the file location.
Returns:
Type | Description |
---|---|
int
|
|
Source code in src/scida/interface.py
251 252 253 254 255 256 257 258 259 |
|
__hash__()
Hash for Dataset instance to be derived from the file location.
Returns:
Type | Description |
---|---|
int
|
|
Source code in src/scida/interface.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
__init__(path, chunksize='auto', virtualcache=True, overwrite_cache=False, fileprefix='', hints=None, **kwargs)
Initialize a dataset object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to the dataset. |
required | |
chunksize |
Chunksize for dask arrays. |
'auto'
|
|
virtualcache |
Whether to use virtual caching. |
True
|
|
overwrite_cache |
Whether to overwrite existing cache. |
False
|
|
fileprefix |
Prefix for files to scan for. |
''
|
|
hints |
Hints for the dataset. |
None
|
|
kwargs |
Additional keyword arguments. |
{}
|
Source code in src/scida/interface.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 |
|
__init_subclass__(*args, **kwargs)
Register subclasses in the dataset type registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/interface.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
__repr__()
Return a string representation of the object.
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/interface.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
info(listfields=False)
Print information about the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
listfields |
bool
|
If True, list all fields in the dataset. |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/interface.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
return_data()
Return the data container.
Returns:
Type | Description |
---|---|
FieldContainer
|
|
Source code in src/scida/interface.py
261 262 263 264 265 266 267 268 269 |
|
save(fname, fields='all', overwrite=True, zarr_kwargs=None, cast_uints=False, extra_attrs=None)
Save the dataset to a file using the 'zarr' format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extra_attrs |
Optional[dict]
|
additional attributes to save in the root group |
None
|
fname |
Filename to save to. |
required | |
fields |
Union[str, Dict[str, Union[List[str], Dict[str, Array]]], FieldContainer]
|
dictionary of dask arrays to save. If equal to 'all', save all fields in current dataset. |
'all'
|
overwrite |
bool
|
overwrite existing file |
True
|
zarr_kwargs |
Optional[dict]
|
optional arguments to pass to zarr |
None
|
cast_uints |
bool
|
need to potentially cast uints to ints for some compressions; TODO: clean this up |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/interface.py
271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 |
|
validate_path(path, *args, **kwargs)
abstractmethod
classmethod
Validate whether the given path is a valid path for this dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
|
required | |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/scida/interface.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
Dataset
Bases: BaseDataset
Base class for datasets with some functions to be overwritten by subclass.
Source code in src/scida/interface.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
validate_path(path, *args, **kwargs)
classmethod
Validate whether the given path is a valid path for this dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path to the dataset. |
required | |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/scida/interface.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
DatasetWithUnitMixin
Bases: UnitMixin
, Dataset
Dataset with units.
Source code in src/scida/interface.py
396 397 398 399 400 401 402 403 |
|
__init__(*args, **kwargs)
Initialize dataset with units.
Source code in src/scida/interface.py
401 402 403 |
|
MixinMeta
Bases: type
Metaclass for Mixin classes.
Source code in src/scida/interface.py
26 27 28 29 30 31 32 33 34 |
|
Selector
Bases: object
Base Class for data selection decorator factory
Source code in src/scida/interface.py
406 407 408 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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 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 |
|
__call__(fn, *args, **kwargs)
Call the selector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Function to be decorated. |
required | |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
function
|
Decorated function. |
Source code in src/scida/interface.py
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 457 |
|
__init__()
Initialize the selector.
Source code in src/scida/interface.py
409 410 411 412 413 414 415 416 417 |
|
finalize(*args, **kwargs)
Finalize the data after selection. To be implemented in subclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Source code in src/scida/interface.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
|
prepare(*args, **kwargs)
Prepare the data for selection. To be implemented in subclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
|
()
|
|
kwargs |
|
{}
|
Source code in src/scida/interface.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
|
create_datasetclass_with_mixins(cls, mixins)
Create a new class from a given class and a list of mixins.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls |
dataset class to be extended |
required | |
mixins |
Optional[List]
|
list of mixin classes to be added |
required |
Returns:
Type | Description |
---|---|
Type[BaseDataset]
|
new class with mixins |
Source code in src/scida/interface.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
io
scida.io
fits
FITS file reader for scida
fitsrecords_to_daskarrays(fitsrecords)
Convert a FITS record array to a dictionary of dask arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fitsrecords |
FITS record array |
required |
Returns:
Type | Description |
---|---|
dict
|
dictionary of dask arrays |
Source code in src/scida/io/fits.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
misc
Miscellaneous helper functions.
check_config_for_dataset(metadata, path=None, unique=True)
Check whether the given dataset can be identified to be a certain simulation (type) by its metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata |
metadata of the dataset used for identification |
required | |
path |
Optional[str]
|
path to the dataset, sometimes helpful for identification |
None
|
unique |
bool
|
whether to expect return to be unique |
True
|
Returns:
Type | Description |
---|---|
list
|
candidates |
Source code in src/scida/misc.py
232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 |
|
deepdictkeycopy(olddict, newdict)
Recursively walk nested dictionary, only creating empty dictionaries for entries that are dictionaries themselves.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
olddict |
object
|
|
required |
newdict |
object
|
|
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/misc.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
get_container_from_path(element, container=None, create_missing=False)
Get a container from a path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
str
|
|
required |
container |
FieldContainer
|
|
None
|
create_missing |
bool
|
|
False
|
Returns:
Name | Type | Description |
---|---|---|
FieldContainer |
FieldContainer
|
container specified by path |
Source code in src/scida/misc.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
map_interface_args(paths, *args, **kwargs)
Map arguments for interface if they are not lists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths |
list
|
|
required |
args |
|
()
|
|
kwargs |
|
{}
|
Returns:
Type | Description |
---|---|
generator
|
yields path, args, kwargs |
Source code in src/scida/misc.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
parse_size(size)
Parse a size string to a number in bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size |
|
required |
Returns:
Type | Description |
---|---|
int
|
size in bytes |
Source code in src/scida/misc.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
path_hdf5cachefile_exists(path, **kwargs)
Checks whether a cache file exists for given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to the dataset |
required | |
kwargs |
passed to return_hdf5cachepath |
{}
|
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/scida/misc.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
rectangular_cutout_mask(center, width, coords, pbc=True, boxsize=None, backend='dask', chunksize='auto')
Create a rectangular mask for a given set of coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center |
center of the rectangle |
required | |
width |
widths of the rectangle |
required | |
coords |
coordinates to mask |
required | |
pbc |
whether to apply PBC |
True
|
|
boxsize |
boxsize for PBC |
None
|
|
backend |
backend to use (dask or numpy) |
'dask'
|
|
chunksize |
chunksize for dask |
'auto'
|
Returns:
Name | Type | Description |
---|---|---|
ndarray |
mask |
Source code in src/scida/misc.py
179 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
return_cachefile_path(fname)
Return the path to the cache file, return None if path cannot be generated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fname |
str
|
filename of cache file |
required |
Returns:
Type | Description |
---|---|
str or None
|
|
Source code in src/scida/misc.py
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 122 123 124 |
|
return_hdf5cachepath(path, fileprefix=None)
Returns the path to the cache file for a given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to the dataset |
required | |
fileprefix |
Optional[str]
|
Can be used to specify the fileprefix used for the dataset. |
None
|
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/misc.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
str_is_float(element)
Check whether a string can be converted to a float.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
str
|
string to check |
required |
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/scida/misc.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
registries
This module contains registries for dataset and dataseries subclasses. Subclasses are automatically registered through init_subclass
series
This module contains the base class for DataSeries, which is a container for collections of dataset instances.
DatasetSeries
Bases: object
A container for collections of dataset instances
Attributes:
Name | Type | Description |
---|---|---|
datasets |
list
|
list of dataset instances |
paths |
list
|
list of paths to data |
names |
list
|
list of names for datasets |
hash |
str
|
hash of the object, constructed from dataset paths. |
Source code in src/scida/series.py
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 180 181 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 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 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
|
data: None
property
Dummy property to make user aware this is not a Dataset instance.
Returns:
Type | Description |
---|---|
None
|
|
metadata
property
writable
Return metadata dictionary for this series.
Returns:
Type | Description |
---|---|
Optional[dict]
|
metadata dictionary |
__getitem__(key)
Return dataset by index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
|
required |
Returns:
Type | Description |
---|---|
Dataset
|
|
Source code in src/scida/series.py
191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
__init__(paths, *interface_args, datasetclass=None, overwrite_cache=False, lazy=True, names=None, **interface_kwargs)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths |
Union[List[str], List[Path]]
|
list of paths to data |
required |
interface_args |
arguments to pass to interface class |
()
|
|
datasetclass |
class to use for dataset instances |
None
|
|
overwrite_cache |
whether to overwrite existing cache |
False
|
|
lazy |
whether to initialize datasets lazily |
True
|
|
names |
names for datasets |
None
|
|
interface_kwargs |
keyword arguments to pass to interface class |
{}
|
Source code in src/scida/series.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__init_subclass__(*args, **kwargs)
Register datasetseries subclass in registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
(unused) |
()
|
|
kwargs |
(unused) |
{}
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/series.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
__len__()
Return number of datasets in series.
Returns:
Type | Description |
---|---|
int
|
|
Source code in src/scida/series.py
182 183 184 185 186 187 188 189 |
|
__repr__()
Return a string representation of the datasetseries object.
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/scida/series.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
from_directory(path, *interface_args, datasetclass=None, pattern=None, **interface_kwargs)
classmethod
Create a datasetseries instance from a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to directory |
required | |
interface_args |
arguments to pass to interface class |
()
|
|
datasetclass |
force class to use for dataset instances |
None
|
|
pattern |
pattern to match files in directory |
None
|
|
interface_kwargs |
keyword arguments to pass to interface class |
{}
|
Returns:
Type | Description |
---|---|
DatasetSeries
|
|
Source code in src/scida/series.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
get_dataset(index=None, name=None, reltol=0.01, **kwargs)
Get dataset by some metadata property. In the base class, we go by list index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
Optional[int]
|
index of dataset to get |
None
|
name |
Optional[str]
|
name of dataset to get |
None
|
reltol |
relative tolerance for metadata comparison |
0.01
|
|
kwargs |
metadata properties to compare for selection |
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
|
Source code in src/scida/series.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 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 445 |
|
info()
Print information about this datasetseries.
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/series.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
validate_path(path, *args, **kwargs)
classmethod
Check whether a given path is a valid path for this dataseries class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to check |
required | |
args |
(unused) |
()
|
|
kwargs |
(unused) |
{}
|
Returns:
Type | Description |
---|---|
CandidateStatus
|
|
Source code in src/scida/series.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
DirectoryCatalog
Bases: object
A catalog consisting of interface instances contained in a directory.
Source code in src/scida/series.py
526 527 528 529 530 531 532 533 534 535 536 537 538 |
|
__init__(path)
Initialize a directory catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to directory |
required |
Source code in src/scida/series.py
529 530 531 532 533 534 535 536 537 538 |
|
HomogeneousSeries
Bases: DatasetSeries
Series consisting of same-type data sets.
Source code in src/scida/series.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
|
__init__(path, **interface_kwargs)
Initialize a homogeneous series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
path to data |
required | |
interface_kwargs |
keyword arguments to pass to interface class |
{}
|
Source code in src/scida/series.py
544 545 546 547 548 549 550 551 552 553 554 |
|
delay_init(cls)
Decorate class to delay initialization until an attribute is requested.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls |
class to decorate |
required |
Returns:
Type | Description |
---|---|
Delay
|
|
Source code in src/scida/series.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
utilities
Some utility functions
copy_to_zarr(fp_in, fp_out, compressor=None)
Reads and converts a scida Dataset to a zarr object on disk
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp_in |
object path to convert |
required | |
fp_out |
output path |
required | |
compressor |
zarr compressor to use, see https://zarr.readthedocs.io/en/stable/tutorial.html#compressors |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/scida/utilities.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|