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]:
| Decay Times in Microseconds | |
|---|---|
| count | 1257.000000 |
| mean | 3.421448 |
| std | 3.931721 |
| min | 0.319997 |
| 25% | 0.960001 |
| 50% | 1.880002 |
| 75% | 4.120004 |
| max | 20.319996 |
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]:
| Decay Times in Microseconds | |
|---|---|
| count | 1255.000000 |
| mean | 3.394741 |
| std | 3.877424 |
| min | 0.319997 |
| 25% | 0.960000 |
| 50% | 1.879998 |
| 75% | 4.120002 |
| max | 19.880012 |
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')
valuesOut [6]:
array([242, 195, 167, 101, 81, 68, 53, 52, 41, 33, 25, 19, 18,
14, 17, 6, 5, 5, 9, 9, 8, 9, 3, 6, 3, 5,
9, 9, 2, 2, 4, 6, 4, 5, 2, 1, 5, 8, 2,
2, 0])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[31m---------------------------------------------------------------------------[39m [31mNameError[39m Traceback (most recent call last) [36mCell[39m[36m [39m[32mIn[5][39m[32m, line 3[39m [32m 1[39m line, cov = np.polyfit(bins, times, deg=[32m1[39m, cov=[38;5;28;01mTrue[39;00m) [32m----> [39m[32m3[39m coeff = [43munumpy[49m.uarray(line, np.sqrt(np.diag(cov))) [32m 4[39m coeff [31mNameError[39m: name 'unumpy' is not defined
In [ ]:
gamma = coeff[0]
tau = -1 / gamma
tau2.1137124579584188+/-0.10976894836916962
In [ ]:
cropped_data_2.describe()| Decay Times in Microseconds | |
|---|---|
| count | 1102.000000 |
| mean | 2.161488 |
| std | 1.617221 |
| min | 0.319997 |
| 25% | 0.879998 |
| 50% | 1.640000 |
| 75% | 3.040010 |
| max | 6.960006 |