|
2 | 2 | from CLAnalysis import chirp_time_to_freq, freq_points, interpolate, FS_to_unit, fftconv, max_in_intervals |
3 | 3 | from CLGui import CLParamNum, CLParamDropdown, FreqPointsParams |
4 | 4 | import numpy as np |
5 | | -from CLMeasurements import CLMeasurement |
| 5 | +from CLMeasurements import CLMeasurement, FrequencyResponse |
6 | 6 | import pandas as pd |
7 | 7 | from scipy.fftpack import fft, ifft |
8 | 8 | from scipy.signal.windows import hann |
@@ -163,8 +163,13 @@ def convert_output_units(fs_points, ref_points=None): |
163 | 163 | # if necessary, calculate moving RMS of raw response signal |
164 | 164 | if self.params['mode'] != 'crestfactor': |
165 | 165 | if self.params['output']['unit'] in ['dB', '%', '% (IEC method)']: # if peak or rms modes and output is a relative unit |
166 | | - ref_points = np.sqrt(pd.DataFrame(clp.signals['response']*clp.signals['response']).rolling(rms_samples, center=True, min_periods=1).mean()) |
167 | | - ref_points = interpolate(response_freqs, np.array(ref_points)[:,0], self.out_freqs) |
| 166 | + ref_fr = FrequencyResponse('fr') |
| 167 | + ref_fr.params['output'] = self.params['output'].copy() |
| 168 | + ref_fr.params['output']['unit'] = 'FS' |
| 169 | + ref_fr.params['output']['min_auto'] = False # shouldn't actually have any impact, but set in case of future updates |
| 170 | + ref_fr.params['output']['max_auto'] = False |
| 171 | + ref_fr.measure() |
| 172 | + ref_points = ref_fr.out_points |
168 | 173 | else: |
169 | 174 | ref_points = None |
170 | 175 |
|
|
0 commit comments