Commit 96ee691f authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Improve code consistency

Showing with 13 additions and 2 deletions
+13 -2
from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract
import numpy as np import numpy as np
import os import os
from ohmpi.utils import enforce_specs
# hardware characteristics and limitations
SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')},
'voltage': {'default': 12., 'max': 12., 'min': 12.},
}
class Pwr(PwrAbstract): class Pwr(PwrAbstract):
def __init__(self, **kwargs): def __init__(self, **kwargs):
kwargs.update({'model': os.path.basename(__file__).rstrip('.py')}) if 'model' not in kwargs.keys():
for key in SPECS.keys():
kwargs = enforce_specs(kwargs, SPECS, key)
subclass_init = False
else:
subclass_init = True
voltage = kwargs.pop('voltage', 12.) voltage = kwargs.pop('voltage', 12.)
super().__init__(**kwargs) super().__init__(**kwargs)
self.voltage_adjustable = False self.voltage_adjustable = False
self._voltage = voltage self._voltage = voltage
self._current_adjustable = False self.current_adjustable = False
self._current = np.nan self._current = np.nan
self._state = 'on' self._state = 'on'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment