Esempio n. 1
0
 def _calc_snr(self, sig, var_sig):
     '''A helper function used by calc_snr().'''
     # pylint: disable-msg=R0201
     if not Float.isNaN(sig) and not Float.isNaN(var_sig):
         return sig / math.sqrt(var_sig)
     else:
         return Float.NaN
Esempio n. 2
0
 def _calc_var_sig(self, sig, h, lnA, r):
     '''A helper function used by calc_snr().'''
     self._update_progress()
     if not Float.isNaN(r) and not Float.isNaN(lnA):
         Es = self.eloss_post
         return sig + h * calc_pow(Es, lnA, r)
     else:
         return Float.NaN
Esempio n. 3
0
 def _calc_var(self, lnA, r):
     '''A helper function used by calc_vars().'''
     self._update_progress()
     if not Float.isNaN(lnA) and not Float.isNaN(r):
         E1 = self.eloss_pre1
         E2 = self.eloss_pre2
         Es = self.eloss_post
         q = (Es - 0.5 * (E1 + E2)) / (E2 - E1)
         a01 = math.pow(Es / E1, -1 * r) * (q - 0.5)**2
         a02 = math.pow(Es / E2, -1 * r) * (q + 0.5)**2
         a11 = math.pow(Es / E1, -2 * r) * (q - 0.5)**2 *(q + 0.5)
         a12 = math.pow(Es / E2, -2 * r) * (q - 0.5) *(q + 0.5)**2
         return calc_pow(Es, lnA, r) * (a01 + a02 + (a11 + a12) / calc_pow(Es, lnA, r))
     else:
         return Float.NaN
Esempio n. 4
0
 def calc_sig(self, sig, lnA, r):
     '''A helper function used by calc_map().'''
     if not Float.isNaN(lnA) and not Float.isNaN(r) and sig > 0:
         return float(sig) - calc_pow(self.eloss_post, lnA, r)
     else:
         return Float.NaN
Esempio n. 5
0
 def _calc_h(self, r, lnA, var):
     '''A helper function used by calc_hs().'''
     self._update_progress()
     Es = self.eloss_post
     if not Float.isNaN(lnA) and not Float.isNaN(r):
         return 1 + (var / calc_pow(Es, lnA, r))
Esempio n. 6
0
def format_for_nan(value):
    if Float.isNaN(value):
        return "NaN"
    else:
        return "%f" % value
def format_for_nan(value):
    if Float.isNaN(value):
        return "NaN"
    else:
        return "%f"%value
Esempio n. 8
0
def format_for_nan(value):
    if Float.isNaN(value) or value == -999.99:
        return "NaN"
    else:
        return "%0.2f" % value
Esempio n. 9
0
def format_for_nan(value):
    if Float.isNaN(value) or value==-999.99:
        return "NaN"
    else:
        return "%0.2f"%value