scripts: Fixed potential undefined var error in graph_accelerometer.py

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
This commit is contained in:
Dmitry Butyugin 2023-02-22 19:55:32 +01:00 committed by KevinOConnor
parent 14bf9f8ba8
commit 0a9a0eac3d
1 changed files with 4 additions and 2 deletions

View File

@ -17,9 +17,11 @@ MAX_TITLE_LENGTH=65
def parse_log(logname, opts): def parse_log(logname, opts):
with open(logname) as f: with open(logname) as f:
for header in f: for header in f:
if not header.startswith('#'): if header.startswith('#'):
continue
if header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'):
# Processed power spectral density file
break break
if not header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'):
# Raw accelerometer data # Raw accelerometer data
return np.loadtxt(logname, comments='#', delimiter=',') return np.loadtxt(logname, comments='#', delimiter=',')
# Parse power spectral density data # Parse power spectral density data