def get_xtalk(filename, int_limits, thrs_1=None): if thrs_1 is not None: dark, peak, sub = get_spectra(filename, int_limits, thrs_1) else: peak = peaks(filename, int_limits) temp_hist = histogram(peak, bins=2048) cutoff = 2027 - getFitData(temp_hist[0][::-1], 3)[4] thrs = temp_hist[1][cutoff] / 180 dark = darks(filename, thrs) mx = max(max(dark), max(peak)) mn = min(min(dark), min(peak)) dark_hist = histogram(dark, bins=2048, range=(mn, mx)) peak_hist = histogram(peak, bins=2048, range=(mn, mx)) sub = peak_hist[0] - dark_hist[0] guess = get_guess(sub) cutoff = get_cutoff(sub, get_cutoff(sub, guess)) nm = get_n_mean(sub, cutoff) pg0 = 1 - exp(-nm) pg1_p = 1 - exp(-nm) - nm * exp(-nm) cutoff_2 = get_cutoff(sub, get_cutoff(sub, get_guess(sub, n=3, m=33))) print cutoff_2 pg1 = sum(sub[:cutoff_2]) / float(sum(sub)) xtalk = (pg1 - pg1_p) / pg0 print xtalk return xtalk, sub
def get_xtalk(filename, int_limits, thrs_1=None): if thrs_1 is not None: dark, peak, sub = get_spectra(filename, int_limits, thrs_1) else: peak = peaks(filename, int_limits) temp_hist = histogram(peak, bins=2048) cutoff = 2027 - getFitData(temp_hist[0][::-1], 3)[4] thrs = temp_hist[1][cutoff] / 180 dark = darks(filename, thrs) mx = max(max(dark), max(peak)) mn = min(min(dark), min(peak)) dark_hist = histogram(dark, bins=2048, range=(mn, mx)) peak_hist = histogram(peak, bins=2048, range=(mn, mx)) sub = peak_hist[0] - dark_hist[0] guess = get_guess(sub) cutoff = get_cutoff(sub, get_cutoff(sub, guess)) nm = get_n_mean(sub, cutoff) pg0 = 1 - exp(- nm) pg1_p = 1 - exp(- nm) - nm * exp(- nm) cutoff_2 = get_cutoff(sub, get_cutoff(sub, get_guess(sub, n=3, m=33))) print cutoff_2 pg1 = sum(sub[:cutoff_2]) / float(sum(sub)) xtalk = (pg1 - pg1_p) / pg0 print xtalk return xtalk, sub
def xtalk_single_spec(hist): nm = get_n_mean(hist, get_cutoff(hist, get_guess(hist))) pg1_p = 1 - exp(-nm) - nm * exp(-nm) pg0 = 1 - exp(-nm) cutoff = get_cutoff(hist, get_cutoff(hist, get_guess(hist, n=3, m=33))) pg1 = sum(hist[:cutoff]) / float(sum(hist)) xtalk = (pg1 - pg1_p) / pg0 print xtalk return xtalk
def xtalk_single_spec(hist): nm = get_n_mean(hist, get_cutoff(hist, get_guess(hist))) pg1_p = 1 - exp(- nm) - nm * exp(- nm) pg0 = 1 - exp(- nm) cutoff = get_cutoff(hist, get_cutoff(hist, get_guess(hist, n=3, m=33))) pg1 = sum(hist[:cutoff]) / float(sum(hist)) xtalk = (pg1 - pg1_p) / pg0 print xtalk return xtalk
def get_line(intd, mind, n=None, **kwargs): int_hist = histogram(intd, bins=2048) if n is None: int_mn = get_n_mean(int_hist[0], get_cutoff(int_hist[0], get_guess(int_hist[0]))) n = decide_n(int_mn) temp = odr_gauss(n, int_hist[0][::-1]) x1, x2 = coord_from_fit(int_hist, temp, **kwargs) min_hist = histogram(mind, bins=2048) temp = odr_gauss(n, min_hist[0][::-1]) y1, y2 = coord_from_fit(min_hist, temp, **kwargs) a = (y1 - y2) / (x1 - x2) b = y1 - a*x1 print 'b = ' + str(b) print 'a = ' + str(a) return a, b
def get_line(intd, mind, n=None, **kwargs): int_hist = histogram(intd, bins=2048) if n is None: int_mn = get_n_mean(int_hist[0], get_cutoff(int_hist[0], get_guess(int_hist[0]))) n = decide_n(int_mn) temp = odr_gauss(n, int_hist[0][::-1]) x1, x2 = coord_from_fit(int_hist, temp, **kwargs) min_hist = histogram(mind, bins=2048) temp = odr_gauss(n, min_hist[0][::-1]) y1, y2 = coord_from_fit(min_hist, temp, **kwargs) a = (y1 - y2) / (x1 - x2) b = y1 - a * x1 print 'b = ' + str(b) print 'a = ' + str(a) return a, b