-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# We need a dedicated class, so we can add functions to deal with the "stiching" of TNG-Cluster zoom-ins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,42 @@ | ||
import os | ||
from typing import Union | ||
|
||
from scida import ArepoSnapshot | ||
from scida.discovertypes import CandidateStatus | ||
from scida.io import load_metadata | ||
|
||
|
||
class TNGClusterSnapshot(ArepoSnapshot): | ||
_fileprefix_catalog = "fof_subhalo_tab" | ||
_fileprefix = "snapshot_" # underscore is important! | ||
_fileprefix_catalog = "fof_subhalo_tab_" | ||
_fileprefix = "snap_" | ||
|
||
@classmethod | ||
def validate_path( | ||
cls, path: Union[str, os.PathLike], *args, **kwargs | ||
) -> CandidateStatus: | ||
tkwargs = dict( | ||
fileprefix=cls._fileprefix, fileprefix_catalog=cls._fileprefix_catalog | ||
) | ||
tkwargs.update(**kwargs) | ||
valid = super().validate_path(path, *args, **tkwargs) | ||
if valid == CandidateStatus.NO: | ||
return valid | ||
metadata_raw = load_metadata(path, **tkwargs) | ||
|
||
matchingattrs = True | ||
|
||
parameters = metadata_raw["/Parameters"] | ||
if "InitCondFile" in parameters: | ||
matchingattrs &= parameters["InitCondFile"] == "various" | ||
else: | ||
return CandidateStatus.NO | ||
header = metadata_raw["/Header"] | ||
matchingattrs &= header["BoxSize"] == 680000.0 | ||
matchingattrs &= header["NumPart_Total"][1] == 1944529344 | ||
matchingattrs &= header["NumPart_Total"][2] == 586952200 | ||
|
||
if matchingattrs: | ||
valid = CandidateStatus.YES | ||
else: | ||
valid = CandidateStatus.NO | ||
return valid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters