-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Combining complex line shape and fake data generator" #67
Changes from all commits
0b00553
9bf9ca2
bb0bc61
fab92a7
c173168
fa62da5
96f1259
a27dc40
021156b
6727ea2
5a8fae7
69617b9
6ac5ac1
d5d090a
a582ef7
e04a4f3
be09e5a
5825a96
352c672
d5ddea3
1494fd0
186ee0f
10c08f3
7c013dc
cc4f411
bd27aaa
acf830a
5fd5dde
3231065
0d6cd30
33dece6
5474e89
a9b1ac7
ab5ecc1
d3496c9
673bd51
c03617e
e0693de
726b88d
fd5eead
684ca43
ab86d1d
2871962
7801316
3fc6772
f884b91
d0bf786
6d99c11
dc418e7
aed8ddc
6cf5179
2cd91fa
350f496
8227397
d70e4c0
a94dfc5
2229336
5fbb06f
2323155
6325498
bb46e17
86dee6e
033937d
514305d
fbb7b49
4bc4e14
bf8f2a1
b376b79
cac1723
50089b1
b32b50b
a160e85
1249f6a
26b7b1d
3d94d86
b830e9c
2fc7e17
7d29504
c7ff7a3
236a737
97386cf
ff744ef
0283d97
7719ce2
fc3a164
bf49a03
4f37578
f16a5e6
6a2dd07
a0f279e
fbacdb7
021ddca
5be7d8a
9d6ca2c
a482415
41bbe00
297eb80
250d3e7
2f6f6ed
7900b6d
aa3a1c3
79909fd
0c3398c
69bcf34
5ba3280
76c1d9d
c7c89da
00a65f7
273522e
347fb49
29eb20b
703e8bc
36d1d81
42d3926
83d6106
5f32964
e5d160e
ed96284
92750ea
5cb8e15
58400bd
63efaf0
c56ea19
481ec91
0c25da8
f0959e2
0d2809b
0d3350f
28ec76c
62b242c
54a0516
c606dae
ba8410b
10f24d5
9caafcd
e373596
10a124a
f090948
1009485
c23ce65
01dbb34
869bc03
f43e4b6
57f45e9
8011208
c6ebe4f
209372e
7fa0461
23bd22a
1109f4f
11b6075
55663e5
7915c22
701b949
36934ab
0611b4e
09c8ad1
a91751e
de870bd
0c19a4b
c6e7ca5
4e20f71
08f4bc4
d3bd951
5c47dac
7b7003b
58ce628
058d59f
79a326d
17fccc1
9ed5f9b
37d4d06
c03c9e5
7e4e727
20d1675
a3d2c04
2e54e59
f6e9fda
e9e8bd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,12 @@ def read_oscillator_str_file(filename): | |
|
||
for line in lines: | ||
if line != "" and line[0]!="#": | ||
raw_data = [float(i) for i in line.split("\t")] | ||
energyOsc[0].append(raw_data[0]) | ||
energyOsc[1].append(raw_data[1]) | ||
try: | ||
raw_data = [float(i) for i in line.split("\t")] | ||
energyOsc[0].append(raw_data[0]) | ||
energyOsc[1].append(raw_data[1]) | ||
except: | ||
continue | ||
|
||
energyOsc = np.array(energyOsc) | ||
### take data and sort by energy | ||
|
@@ -62,14 +65,21 @@ def aseev_func_tail(energy_loss_array, gas_type): | |
A2, omeg2, eps2 = 0.1187, 33.40, 10.43 | ||
elif gas_type=="Ar": | ||
A2, omeg2, eps2 = 0.3344, 21.91, 21.14 | ||
elif gas_type=="N2": | ||
A2, omeg2, eps2 = 0.21754816, 44.99897054, 20.43916114 | ||
elif gas_type=="CO": | ||
A2, omeg2, eps2 = 0.19583454, 55.21888452, 16.44972596 | ||
elif gas_type=="C2H4": | ||
A2, omeg2, eps2 = 0.57492182, 23.77501391, 14.33107345 | ||
return A2*omeg2**2./(omeg2**2.+4*(energy_loss_array-eps2)**2.) | ||
|
||
#convert oscillator strength into energy loss spectrum | ||
def get_eloss_spec(e_loss, oscillator_strength, kr_17keV_line): #energies in eV | ||
kinetic_en = kr_17keV_line * 1000 | ||
kinetic_en = kr_17keV_line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are the units correct here? it seems to me like kinetic_en is in keV but the rest of the function is in eV. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks that way to me, too. @casesyh , this is your code – are we missing something? |
||
e_rydberg = 13.605693009 #rydberg energy (eV) | ||
a0 = 5.291772e-11 #bohr radius | ||
return np.where(e_loss>0 , 4.*np.pi*a0**2 * e_rydberg / (kinetic_en * e_loss) * oscillator_strength * np.log(4. * kinetic_en * e_loss / (e_rydberg**3.) ), 0) | ||
argument_of_log = np.where(e_loss > 0, 4. * kinetic_en * e_rydberg / (e_loss**2.) , 1e-5) | ||
return np.where(e_loss>0 , 1./(e_loss) * oscillator_strength* np.log(argument_of_log), 0) | ||
|
||
# Takes only the nonzero bins of a histogram | ||
def get_only_nonzero_bins(bins,hist): | ||
|
@@ -108,12 +118,11 @@ def energy_guess_to_frequency(energy_guess, energy_guess_err, B_field_guess): | |
frequency_err = const/(1+energy_guess/mass_energy_electron)**2*energy_guess_err/mass_energy_electron | ||
return frequency , frequency_err | ||
|
||
# Given a frequency and error, converts those to B field values assuming the line is the 17.8 keV line | ||
def central_frequency_to_B_field(central_freq,central_freq_err): | ||
# Given a frequency, converts it to a B field value assuming the line is the 17.8 keV line | ||
def central_frequency_to_B_field(central_freq): | ||
const = (2.*np.pi*m_e)*(1+kr_17keV_line/mass_energy_electron)/e_charge | ||
B_field = const*central_freq | ||
B_field_err = const*central_freq_err | ||
return B_field , B_field_err | ||
return B_field | ||
|
||
# given a FWHM for the lorentian component and the FWHM for the gaussian component, | ||
# this function estimates the FWHM of the resulting voigt distribution | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not good practice. something should happen during the exception that tells about the error. why is this exception necessary?