mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
energy_model: fix np.vectorize on ImportError
np.vectorize was being unconditionally invoked at top level. On an ImportError, np as set to None, so this was resuling in an AttributeError when loading the module if one of the dependent libraries was not present on the host system. This moves the invocation into the try block with the imports to avoid an error when energy_model module is loaded by the extension is not used.
This commit is contained in:
parent
b30d702f22
commit
98b259be33
@ -15,6 +15,7 @@ try:
|
||||
matplotlib.use('AGG')
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
low_filter = np.vectorize(lambda x: x > 0 and x or 0) # pylint: disable=no-member
|
||||
import_error = None
|
||||
except ImportError as e:
|
||||
import_error = e
|
||||
@ -22,6 +23,7 @@ except ImportError as e:
|
||||
pd = None
|
||||
plt = None
|
||||
np = None
|
||||
low_filter = None
|
||||
|
||||
from wlauto import Instrument, Parameter, File
|
||||
from wlauto.exceptions import ConfigError, InstrumentError, DeviceError
|
||||
@ -100,9 +102,6 @@ class PowerPerformanceAnalysis(object):
|
||||
self.summary['max_power'] = data[data.cpus == 1].power.max()
|
||||
|
||||
|
||||
low_filter = np.vectorize(lambda x: x > 0 and x or 0) # pylint: disable=no-member
|
||||
|
||||
|
||||
def build_energy_model(freq_power_table, cpus_power, idle_power, first_cluster_idle_state):
|
||||
# pylint: disable=too-many-locals
|
||||
em = EnergyModel()
|
||||
|
Loading…
x
Reference in New Issue
Block a user