48 KiB
48 KiB
In [1]:
import matplotlib.pyplot as plt
import numpy as np
import pandas
data = pandas.read_csv('20250212_EC_decays.txt')
data.describe()
Out[1]:
In [2]:
cropped_data = data[data['Decay Times in Microseconds'] >= 0.3]
cropped_data = cropped_data[cropped_data['Decay Times in Microseconds'] <= 20]
cropped_data.describe()
Out[2]:
In [6]:
data_range = (0.3, max(data['Decay Times in Microseconds']))
bins = np.arange(0.3, max(data['Decay Times in Microseconds']) + 0.5, 0.5)
hist = cropped_data.hist(range=data_range, bins=bins)
values = np.histogram(cropped_data["Decay Times in Microseconds"], range=data_range, bins=bins)[0]
bincenters = 0.5*(bins[1:]+bins[:-1])
hist[0][0].errorbar(bincenters, values, yerr=np.sqrt(values), fmt='none', color='red')
hist[0][0].set_xlabel('Time (μs)')
hist[0][0].set_ylabel('Counts')
#hist[0][0].set_yscale('log')
values
Out[6]:
In [4]:
cropped_data_2 = cropped_data[cropped_data['Decay Times in Microseconds'] <= 7]
data_range = (0.3, max(cropped_data_2['Decay Times in Microseconds']))
bins = np.arange(0.3, max(cropped_data_2['Decay Times in Microseconds']) + 0.5, 0.5)
hist = cropped_data_2.hist(range=data_range, bins=bins)
hist[0][0].set_yscale('log')
times, bins = np.histogram(cropped_data_2, bins=bins, range=data_range)
times = np.log(times)
bins = bins[:-1]
In [5]:
line, cov = np.polyfit(bins, times, deg=1, cov=True)
coeff = unumpy.uarray(line, np.sqrt(np.diag(cov)))
coeff
In [ ]:
gamma = coeff[0]
tau = -1 / gamma
tau
Out[ ]:
In [ ]:
cropped_data_2.describe()
Out[ ]: