| 15 | MAX_TITLE_LENGTH=65 |
| 16 | |
| 17 | def 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 |