本文整理汇总了Python中Analysis.kb方法的典型用法代码示例。如果您正苦于以下问题:Python Analysis.kb方法的具体用法?Python Analysis.kb怎么用?Python Analysis.kb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analysis
的用法示例。
在下文中一共展示了Analysis.kb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tesana
# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import kb [as 别名]
def tesana(t, p, n, lpfc=None, hpfc=None, binsize=1, max_shift=10,
thre=0.4, filt=None, nulldc=False, offset=False, center=False, sigma=3,
gain=None, dsr=None, shift=False, ocmethod="ols", flip=False, atom="Mn",
kbfit=False, ignorekb=False, method="mle",
rshunt=None, tbias=None, ites=None, ka_min=80, kb_min=40,
tex=False, plotting=True, savedat=False, session="Unnamed"):
"""
Perform TES Analysis
Parameters (and their default values):
t: time data (array-like)
p: pulse data (array-like)
n: noise data (array-like)
lpfc: low-pass filter cut-off frequency in bins (Default: None)
hpfc: high-pass filter cut-off frequency in bins (Default: None)
binsize: energy bin size for histograms and fittings (only for ls ans cs) in eV (Default: 1)
max_shift: maximum allowed shifts to calculate maximum cross correlation (Default: 10)
thre: correlation threshold for offset correction (Default: 0.4)
filt: window function (hanning/hamming/blackman/tukey) (Default: None)
nulldc: nullify the DC bin when template generation (Default: False)
offset: subtract DC offset (Default: False)
center: centering pulse rise (Default: False)
sigma: sigmas for median filter (Default: 3)
gain: feedback gain for current-space conversion (Default: None)
dsr: down-sampling rate (Default: None)
shift: treat dE as energy shift instead of scaling (Default: False)
ocmethod: offset correction fitting method (ols/odr) (Default: ols)
flip: flip x and y when offset correction fitting (Default: False)
atom: atom to fit (Default: Mn)
kbfit: fit Kb line (Default: False)
ignorekb: ignore Kb line when linearity correction (Default: False)
method: fitting method (mle/ls/cs) (Default: mle)
rshunt: shunt resistance value for r-space conversion (Default: None)
tbias: TES bias current for r-space conversion (Default: None)
ites: TES current for r-space conversion (Default: None)
ka_min: minimum counts to group bins for Ka line (valid only for ls/cs fittings) (Default: 80)
ka_min: minimum counts to group bins for Kb line (valid only for ls/cs fittings) (Default: 20)
tex: use TeX for plots (Default: False)
plotting: generate and save plots (Default: True)
savedat: save data to files (Default: False)
session: session name for plots and data files (Default: Unnamed)
Note:
- Use offset option when using filt option
- Consider using center option when using filt option
"""
if plotting:
# Import matplotlib
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['text.usetex'] = str(tex)
from pylab import figure, plot, errorbar, hist, axvline, xlim, ylim, loglog, xlabel, ylabel, legend, tight_layout, savefig
print "Session: %s" % session
# Preparation
p = np.asarray(p)
n = np.asarray(n)
t = np.asarray(t)
dt = np.diff(t)[0]
df = (dt * t.shape[-1])**-1
# Subtract offset
if offset:
ofs = np.median(n)
p -= ofs
n -= ofs
# Convert to current-space if needed
if gain:
print "Converting to current-space"
p /= gain
n /= gain
# Convert to resistance-space
Rspace = False
if gain and rshunt and tbias and ites:
print "Converting to resistance-space"
ofs = np.median(n)
p += (ites - ofs)
n += (ites - ofs)
# Convert to resistance
p = (tbias - p) * rshunt / p
n = (tbias - n) * rshunt / n
Rspace = True
# Down-sample
if dsr > 1:
p = p[:,:p.shape[-1]/dsr*dsr].reshape(p.shape[0], -1, dsr).mean(axis=-1)
n = n[:,:n.shape[-1]/dsr*dsr].reshape(n.shape[0], -1, dsr).mean(axis=-1)
dt *= dsr
t = t[::dsr]
# Pulse centering (for filtering)
if center:
# Roll pulse to the center
r = p.shape[-1] / 2 - np.median(abs(p - Filter.offset(p)[:, np.newaxis]).argmax(axis=-1))
#.........这里部分代码省略.........