MCPcopy Create free account
hub / github.com/Klipper3d/klipper / parse_log

Function parse_log

scripts/graph_accelerometer.py:17–33  ·  view source on GitHub ↗
(logname, opts)

Source from the content-addressed store, hash-verified

15MAX_TITLE_LENGTH=65
16
17def parse_log(logname, opts):
18 with open(logname) as f:
19 for header in f:
20 if header.startswith('#'):
21 continue
22 if header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'):
23 # Processed power spectral density file
24 break
25 # Raw accelerometer data
26 return np.loadtxt(logname, comments='#', delimiter=',')
27 # Parse power spectral density data
28 data = np.loadtxt(logname, skiprows=1, comments='#', delimiter=',')
29 calibration_data = shaper_calibrate.CalibrationData(
30 freq_bins=data[:,0], psd_sum=data[:,4],
31 psd_x=data[:,1], psd_y=data[:,2], psd_z=data[:,3])
32 calibration_data.set_numpy(np)
33 return calibration_data
34
35######################################################################
36# Raw accelerometer graphing

Callers 1

mainFunction · 0.70

Calls 1

set_numpyMethod · 0.95

Tested by

no test coverage detected