Beispiel #1
0
 def _update_line_data_fit(self):
     if not np.isnan(self.fit_parameters[0]):
         self.line_data.set_data(
             'fit',
             fitting.NLorentzians(*self.fit_parameters)(self.frequency))
         p = self.fit_parameters
         f = p[1::3]
         w = p[2::3]
         N = len(p) / 3
         contrast = np.empty(N)
         c = p[0]
         pp = p[1:].reshape((N, 3))
         for i, pi in enumerate(pp):
             a = pi[2]
             g = pi[1]
             A = np.abs(a / (np.pi * g))
             if a > 0:
                 contrast[i] = 100 * A / (A + c)
             else:
                 contrast[i] = 100 * A / c
         s = ''
         for i, fi in enumerate(f):
             s += 'f %i: %.6e Hz, HWHM %.3e Hz, contrast %.1f%%\n' % (
                 i + 1, fi, w[i], contrast[i])
         self.line_label.text = s
Beispiel #2
0
 def _update_line_data_fit(self):
     if not np.isnan(self.fit_parameters[0]):
         self.line_data.set_data(
             'fit',
             fitting.NLorentzians(*self.fit_parameters)(self.frequency))
         p = self.fit_parameters
         f = p[1::3]
         w = p[2::3]
         c = 100 * p[3::3] / (np.pi * w * p[0])
         s = ''
         for i, fi in enumerate(f):
             s += 'f %i: %.6e Hz, HWHM %.3e Hz, contrast %.1f%%\n' % (
                 i + 1, fi, w[i], c[i])
         self.line_label.text = s