mirror of
https://github.com/vale981/fpraktikum
synced 2025-03-04 17:11:41 -05:00
cs
This commit is contained in:
parent
bf1e546232
commit
4d61eff090
26 changed files with 22683 additions and 2 deletions
2
CS/auswertung/.touch
Normal file
2
CS/auswertung/.touch
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
xx
|
1071
CS/auswertung/Untitled.ipynb
Normal file
1071
CS/auswertung/Untitled.ipynb
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/auswertung/messung/cal/cs137.dat
Normal file
1025
CS/auswertung/messung/cal/cs137.dat
Normal file
File diff suppressed because it is too large
Load diff
4
CS/auswertung/messung/prot.org
Normal file
4
CS/auswertung/messung/prot.org
Normal file
|
@ -0,0 +1,4 @@
|
|||
* Calibration
|
||||
** CS
|
||||
- 32.194 3.64
|
||||
- 31.817 1.99
|
79
CS/auswertung/utility.py
Normal file
79
CS/auswertung/utility.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from SecondaryValue import SecondaryValue
|
||||
import scipy.constants as const
|
||||
from scipy.optimize import curve_fit
|
||||
from scipy.signal import find_peaks
|
||||
import scipy.sparse as sparse
|
||||
mu = SecondaryValue('cos(theta)')
|
||||
kappa = SecondaryValue('E_in/er', defaults=dict(er=510.99895000))
|
||||
E = SecondaryValue('E_in/(1+kappa*(1-mu))',
|
||||
dependencies=dict(mu=mu, kappa=kappa))
|
||||
|
||||
t_opt = SecondaryValue('(N_g + N_0)/(prec^2*(N_g-N_0)^2)')
|
||||
d_t_opt = SecondaryValue('sqrt((N_g+3*N_0)^2*N_g/t+(3*N_g+N_0)^2*N_0/t)/(prec^2*(N_g-N_0)^2)')
|
||||
|
||||
def load_spectrum(path, absolute=False):
|
||||
"""Parses the characteristic curve data from the data logs.
|
||||
|
||||
:param path: path to the log
|
||||
:returns: channel, events
|
||||
"""
|
||||
data = np.loadtxt(path, skiprows=1, encoding='latin1')[:,1]
|
||||
|
||||
return data if absolute else data/data.max()
|
||||
|
||||
def channels(spec):
|
||||
return np.arange(1, len(spec) + 1)
|
||||
|
||||
def plot_spec(spec):
|
||||
plt.clf()
|
||||
plt.plot(channels(spec), spec)
|
||||
plt.xlabel('Channel')
|
||||
plt.ylabel('Relative Counts')
|
||||
|
||||
|
||||
def gauss(x, mu, sigma):
|
||||
return np.exp(-(x-mu)**2/(2*sigma**2))
|
||||
|
||||
def calibrate_peak(spec, start, end):
|
||||
slc = spec[start:end]
|
||||
slc = slc-slc.min()
|
||||
slc = slc/slc.max()
|
||||
chan = channels(spec)[start:end]
|
||||
opt, d_opt = curve_fit(gauss, chan,
|
||||
slc, p0=((start+end)/2, (end-start)/2),
|
||||
sigma=1/2*np.ones_like(chan), absolute_sigma=True)
|
||||
d_opt = np.sqrt(np.diag(d_opt))
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
|
||||
ax.plot(chan, slc)
|
||||
ax.plot(chan, gauss(chan, *opt))
|
||||
ax.set_xlabel('Kanalnummer')
|
||||
ax.set_ylabel('Relative Ereignisszahl')
|
||||
fig.show()
|
||||
return opt[0], d_opt[0]
|
||||
|
||||
def find_peak(spec, under, interval, width, height=.5, distance=100):
|
||||
corrected = (spec - under)[interval[0]:interval[1]]
|
||||
corrected = corrected/corrected.max()
|
||||
peak = find_peaks(corrected, height=height, distance=distance)[0]
|
||||
|
||||
return calibrate_peak(spec-under, int(interval[0]+peak-width), int(interval[0]+peak+width))
|
||||
|
||||
import numpy as np
|
||||
from scipy import sparse
|
||||
from scipy.sparse.linalg import spsolve
|
||||
|
||||
def baseline_als(y, lam, p, niter=10):
|
||||
L = len(y)
|
||||
D = sparse.diags([1,-2,1],[0,-1,-2], shape=(L,L-2))
|
||||
w = np.ones(L)
|
||||
for i in range(niter):
|
||||
W = sparse.spdiags(w, 0, L, L)
|
||||
Z = W + lam * D.dot(D.transpose())
|
||||
z = spsolve(Z, w*y)
|
||||
w = p * (y > z) + (1-p) * (y < z)
|
||||
return z
|
1025
CS/messung/2/2_90.dat
Normal file
1025
CS/messung/2/2_90.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/2/3_90_0.dat
Normal file
1025
CS/messung/2/3_90_0.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_105.SPC.dat
Normal file
1025
CS/messung/angles/4_105.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_105_null.SPC.dat
Normal file
1025
CS/messung/angles/4_105_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_120.SPC.dat
Normal file
1025
CS/messung/angles/4_120.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_120_null.SPC.dat
Normal file
1025
CS/messung/angles/4_120_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_30.SPC.dat
Normal file
1025
CS/messung/angles/4_30.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_30_null.SPC.dat
Normal file
1025
CS/messung/angles/4_30_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_45.SPC.dat
Normal file
1025
CS/messung/angles/4_45.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_45_null.SPC.dat
Normal file
1025
CS/messung/angles/4_45_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_60.SPC.dat
Normal file
1025
CS/messung/angles/4_60.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_60_null.SPC.dat
Normal file
1025
CS/messung/angles/4_60_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_75.SPC.dat
Normal file
1025
CS/messung/angles/4_75.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_75_null.SPC.dat
Normal file
1025
CS/messung/angles/4_75_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_90.SPC.dat
Normal file
1025
CS/messung/angles/4_90.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/angles/4_90_null.SPC.dat
Normal file
1025
CS/messung/angles/4_90_null.SPC.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/cal/am241.dat
Normal file
1025
CS/messung/cal/am241.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/cal/ba133.dat
Normal file
1025
CS/messung/cal/ba133.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/cal/cs137.dat
Normal file
1025
CS/messung/cal/cs137.dat
Normal file
File diff suppressed because it is too large
Load diff
1025
CS/messung/cal/eu152.dat
Normal file
1025
CS/messung/cal/eu152.dat
Normal file
File diff suppressed because it is too large
Load diff
|
@ -776,7 +776,7 @@ Moden erkennbar. Der Abstand der einzelnen Messpunkte betr\"agt rund
|
|||
Damit ergibt sich f\"ur die Frequenzaufl\"osung um \(\lambda_0\):
|
||||
|
||||
\begin{equation}
|
||||
\Delta\nu=c\cdot\frac{\Delta\lambda}{\lambda_0^2}=\SI{3.30e8}{\hertz}
|
||||
\Delta\nu=c\cdot\frac{\Delta\lambda}{\lambda_0^2}=\SI{3.30e11}{\hertz}
|
||||
\end{equation}
|
||||
|
||||
Der Modenabstand betr\"agt nach \ref{eq:longmodes} (Ungenauigkeiten
|
||||
|
@ -784,7 +784,7 @@ aus \(L=\SI{80+-.5}{\centi\meter}\) erst in vierter Nachkommastelle):
|
|||
|
||||
\begin{equation}
|
||||
\label{eq:moda}
|
||||
\delta\nu = \SI{1.87e11}{\hertz} < \Delta\nu
|
||||
\delta\nu = \SI{1.87e8}{\hertz} < \Delta\nu
|
||||
\end{equation}
|
||||
|
||||
Somit k\"onnen keine individuellen Moden aufgel\"ost werden.
|
||||
|
|
Loading…
Add table
Reference in a new issue