Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gviejo committed Feb 5, 2025
1 parent 13fce81 commit 07b83fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pynapple/core/ts_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,13 +1419,21 @@ def _from_npz_reader(cls, file):

tsgroup = cls(group, time_support=time_support, bypass_check=True)

# do we need to enforce that these keys are not in metadata?
# not_info_keys = {"start", "end", "t", "index", "d", "rate", "keys"}

if "_metadata" in file: # load metadata if it exists
if file["_metadata"]: # check that metadata is not empty
metainfo = pd.DataFrame.from_dict(file["_metadata"].item())
tsgroup.set_info(metainfo)

metainfo = {}
not_info_keys = {"start", "end", "t", "index", "d", "rate", "keys", "_metadata"}

for k in set(file.keys()) - not_info_keys:
tmp = file[k]
if len(tmp) == len(tsgroup):
metainfo[k] = tmp

tsgroup.set_info(**metainfo)

return tsgroup

@add_meta_docstring("set_info")
Expand Down

0 comments on commit 07b83fc

Please sign in to comment.