Rev 3662 Rev 3663
Line 129... Line 129...
129 print("<define name=\""+sensor+"_Y_SENS\" value=\""+str(p[4]*2**res)+"\" integer=\"16\"/>") 129 print("<define name=\""+sensor+"_Y_SENS\" value=\""+str(p[4]*2**res)+"\" integer=\"16\"/>")
130 print("<define name=\""+sensor+"_Z_SENS\" value=\""+str(p[5]*2**res)+"\" integer=\"16\"/>") 130 print("<define name=\""+sensor+"_Z_SENS\" value=\""+str(p[5]*2**res)+"\" integer=\"16\"/>")
131   131  
132   132  
133 def plot_results(block, measurements, flt_idx, flt_meas, cp0, np0, cp1, np1, sensor_ref): 133 def plot_results(block, measurements, flt_idx, flt_meas, cp0, np0, cp1, np1, sensor_ref):
134 """Plot calibration results.""" 134 """Plot calibration results in 2D graphs."""
135 plt.subplot(3, 1, 1) 135 plt.subplot(3, 1, 1)
136 plt.plot(measurements[:, 0]) 136 plt.plot(measurements[:, 0])
137 plt.plot(measurements[:, 1]) 137 plt.plot(measurements[:, 1])
138 plt.plot(measurements[:, 2]) 138 plt.plot(measurements[:, 2])
139 plt.plot(flt_idx, flt_meas[:, 0], 'ro') 139 plt.plot(flt_idx, flt_meas[:, 0], 'ro')
140 plt.plot(flt_idx, flt_meas[:, 1], 'ro') 140 plt.plot(flt_idx, flt_meas[:, 1], 'ro')
141 plt.plot(flt_idx, flt_meas[:, 2], 'ro') 141 plt.plot(flt_idx, flt_meas[:, 2], 'ro')
142 plt.xlabel('time (s)') 142 plt.xlabel('sample number')
143 plt.ylabel('ADC') 143 plt.ylabel('miligauss')
144 plt.title('Raw sensors') 144 plt.title('Raw sensors')
145   145  
146 plt.subplot(3, 2, 3) 146 plt.subplot(3, 2, 3)
147 plt.plot(cp0[:, 0]) 147 plt.plot(cp0[:, 0])
148 plt.plot(cp0[:, 1]) 148 plt.plot(cp0[:, 1])
149 plt.plot(cp0[:, 2]) 149 plt.plot(cp0[:, 2])
150 plt.plot(-sensor_ref*np.ones(len(flt_meas))) 150 plt.plot(-sensor_ref*np.ones(len(flt_meas)))
151 plt.plot(sensor_ref*np.ones(len(flt_meas))) 151 plt.plot(sensor_ref*np.ones(len(flt_meas)))
-   152 plt.xlabel('sample number')
-   153 plt.ylabel('-')
-   154 plt.title('First approximation')
152   155  
153 plt.subplot(3, 2, 4) 156 plt.subplot(3, 2, 4)
154 plt.plot(np0) 157 plt.plot(np0)
155 plt.plot(sensor_ref*np.ones(len(flt_meas))) 158 plt.plot(sensor_ref*np.ones(len(flt_meas)))
-   159 plt.xlabel('sample number')
-   160 plt.ylabel('-')
-   161 plt.title('magnitude')
156   162  
157 plt.subplot(3, 2, 5) 163 plt.subplot(3, 2, 5)
158 plt.plot(cp1[:, 0]) 164 plt.plot(cp1[:, 0])
159 plt.plot(cp1[:, 1]) 165 plt.plot(cp1[:, 1])
160 plt.plot(cp1[:, 2]) 166 plt.plot(cp1[:, 2])
161 plt.plot(-sensor_ref*np.ones(len(flt_meas))) 167 plt.plot(-sensor_ref*np.ones(len(flt_meas)))
162 plt.plot(sensor_ref*np.ones(len(flt_meas))) 168 plt.plot(sensor_ref*np.ones(len(flt_meas)))
-   169 plt.xlabel('sample number')
-   170 plt.ylabel('-')
-   171 plt.title('separate axes')
163   172  
164 plt.subplot(3, 2, 6) 173 plt.subplot(3, 2, 6)
165 plt.plot(np1) 174 plt.plot(np1)
166 plt.plot(sensor_ref*np.ones(len(flt_meas))) 175 plt.plot(sensor_ref*np.ones(len(flt_meas)))
-   176 plt.xlabel('sample number')
-   177 plt.ylabel('-')
-   178 plt.title('magnitude')
167   179  
168 # if we want to have another plot we only draw the figure (non-blocking) 180 # if we want to have another plot we only draw the figure (non-blocking)
169 # also in matplotlib before 1.0.0 there is only one call to show possible 181 # also in matplotlib before 1.0.0 there is only one call to show possible
170 if block: 182 if block:
171 plt.show() 183 plt.show()