Skip to content

Commit

Permalink
Merge pull request #31 from FAST-HEP/kreczko-issue-30
Browse files Browse the repository at this point in the history
Fixing issue #3: sv_root_diff & sv_root_info: processing LZap_LZLama output
  • Loading branch information
kreczko authored Apr 1, 2020
2 parents 9385a69 + ac37202 commit ea5d550
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions skvalidate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.propagate = False

# add loggers
ch = logging.StreamHandler()
Expand Down
13 changes: 11 additions & 2 deletions skvalidate/commands/root_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from __future__ import print_function
import click
import numpy as np
import pandas as pd
from tabulate import tabulate
import uproot
Expand All @@ -19,6 +20,15 @@ def info(input_file):
for name, obj in _walk(f):
canRead = False
is_empty = False

hasStreamer = hasattr(obj, '_streamer') and obj._streamer is not None
interpretation = obj.interpretation if hasattr(obj, 'interpretation') else None
if not hasStreamer and interpretation is None:
data.append(
(name, interpretation, np.nan, np.nan, hasStreamer, canRead, is_empty)
)
continue

try:
a = obj.array()
if a is None:
Expand All @@ -28,9 +38,8 @@ def info(input_file):
canRead = True
except Exception as e:
print(e)
hasStreamer = obj._streamer is not None
data.append(
(name, obj.interpretation, obj.compressedbytes(), obj.uncompressedbytes(), hasStreamer, canRead, is_empty)
(name, interpretation, obj.compressedbytes(), obj.uncompressedbytes(), hasStreamer, canRead, is_empty)
)
return pd.DataFrame.from_records(data, columns=labels)

Expand Down
2 changes: 1 addition & 1 deletion skvalidate/compare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def load_values(name, content1, content2):
try:
value1 = np.array(value1)
value2 = np.array(value2)
except (AssertionError, TypeError) as e:
except (AssertionError, TypeError, ValueError) as e:
logger.error('Cannot convert {} to numpy array: {}'.format(name, e))
return None, None

Expand Down

0 comments on commit ea5d550

Please sign in to comment.