Organize in submodules
This commit is contained in:
+13
-3
@@ -10,11 +10,11 @@ from functools import partial
|
||||
import numpy as np
|
||||
|
||||
import tables
|
||||
from tables import HDF5ExtError
|
||||
from tables import HDF5ExtError, NoSuchNodeError
|
||||
from tables.registry import class_name_dict
|
||||
|
||||
from params import default_params, load_params
|
||||
from units import U
|
||||
from utils.params import default_params, load_params
|
||||
from utils.units import U
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
@@ -44,6 +44,7 @@ class Rule:
|
||||
return self.process_fn(arg, **kwargs)
|
||||
else:
|
||||
return self.process_fn(**kwargs)
|
||||
|
||||
class BaseProcessor:
|
||||
"""
|
||||
Base class for processors, should not be instanciated
|
||||
@@ -292,8 +293,17 @@ class HDF5Container(BaseProcessor):
|
||||
)
|
||||
else:
|
||||
value = node.read()
|
||||
if isinstance(unit, dict):
|
||||
name = os.path.basename(node_name)
|
||||
if name in unit:
|
||||
unit = unit[name]
|
||||
else:
|
||||
unit = None
|
||||
if not (unit is None or unit_old is None or unit_old == U.none):
|
||||
value = value * unit_old.express(unit)
|
||||
except NoSuchNodeError:
|
||||
self.logger.error(f"The value {node_name} is node available", stack_info=True)
|
||||
raise
|
||||
finally:
|
||||
if not open_before:
|
||||
self.close()
|
||||
|
||||
Reference in New Issue
Block a user