Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled removing leading comments from json DB #83

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hippynn/databases/SNAPJson.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(
transpose_cell=True,
allow_unfound=False,
quiet=False,
comments=1,
**kwargs,
):

Expand All @@ -34,6 +35,7 @@ def __init__(
self.targets = targets
self.transpose_cell = transpose_cell
self.depth = depth
self.comments = comments
arr_dict = self.load_arrays(quiet=quiet, allow_unfound=allow_unfound)

super().__init__(arr_dict, inputs, targets, *args, **kwargs, allow_unfound=allow_unfound, quiet=quiet)
Expand Down Expand Up @@ -96,7 +98,8 @@ def filter_arrays(self, arr_dict, allow_unfound=False, quiet=False):

def extract_snap_file(self, file):
with open(file, "rt") as jf:
comment = jf.readline()
for i in range(self.comments):
comment = jf.readline()
content = jf.read()
parsed = json.loads(content)
dataset = parsed["Dataset"]
Expand Down
Loading