Skip to content

libs/utils/energy: Fix df indexing

Darryl Green requested to merge github/fork/valschneider/hikey960_em into master

Created by: valschneider

numpy.arange() was being used to index the energy-measurements df. This method has some issues where the 'stop' value may or may not be included in the returned set, i.e: arange(0.8, 1.0, 0.1) could return [0.8, 0.9, 1.0] BUT arange(0.7, 1.0, 0.1) could return [0.7, 0.8, 0.9] (not tested for these values but it is the problem being encountered)

This could thus create n indexes for n-1 values, which would cause an exception.

numpy.linspace() is more predictible than arange(), as the 'stop' value can explicitly be included or excluded (excluded by default). This commit introduces linspace().

Merge request reports