In [1]:
import os
import sys
root_folder = os.path.dirname(os.getcwd())
sys.path.append(root_folder)
from ResoFit._pulse_shape import NeutronPulse
from ResoFit._pulse_shape import ProtonPulse
from ResoFit.experiment import Experiment
import numpy as np
from ResoFit.simulation import Simulation
import scipy.signal as ss
import matplotlib.pyplot as plt
import scipy

In [2]:
%matplotlib notebook

In [3]:
overwrite_csv = False
folder = 'data/IPTS_19558/reso_data_19558'
data_file1 = 'Gd_thick.csv'
spectra_file = 'Image002_Spectra.txt'
experiment1 = Experiment(data_file=data_file1,
                         spectra_file=spectra_file,
                         folder=folder,
                         baseline=True)
# experiment1.slice(slice_start=300, reset_index=False)
# peak_df = experiment1.find_peak()
source_to_detector_m = 16.45
simulation = Simulation(energy_min=78, energy_max=82, energy_step=0.01, database='ENDF_VII')
simulation.add_layer(layer='Gd', thickness_mm=0.15)

In [4]:
simulation._convolve_beam_shapes(source_to_detector_m=source_to_detector_m, conv_proton=False,
#                                  proton_params={'sigma':500},
                                )
x_n = simulation.x_tof_us
y_n = simulation.y_att


/Users/y9z/anaconda3/envs/py36/lib/python3.6/site-packages/lmfit/models.py:30: FutureWarning:

'argmin' is deprecated, use 'idxmin' instead. The behavior of 'argmin'
will be corrected to return the positional minimum in the future.
Use 'series.values.argmin' to get the position of the minimum now.

Fitted params for raw proton pulse shape:
Name          Value      Min      Max   Stderr     Vary     Expr Brute_Step
amplitude  1.984e+04     -inf      inf    36.58     True     None     None
center         1909     -inf      inf   0.3126     True     None     None
fwhm          345.7     -inf      inf   0.7362    False 2.3548200*sigma     None
height         53.9     -inf      inf  0.09941    False 0.3989423*amplitude/max(1.e-15, sigma)     None
sigma         146.8        0      inf   0.3126     True     None     None
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Neutron_fitted_params_1eV_500eV_ikeda_carpenter.csv' exists...
Fitted parameters file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Loglog_linear_within_1eV_500eV_ikeda_carpenter.csv' exists...
Parameters linear fitted file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/TOF_shape_eV_78.0_82.0_0.01_us_0.05_183.7_0.01_for_sum_16.45m_ikeda_carpenter.csv' exists...
TOF neutron beam shape file loaded.

In [5]:
simulation._convolve_beam_shapes(source_to_detector_m=source_to_detector_m, conv_proton=True,
#                                  proton_params={'sigma':500},
                                )
x_np = simulation.x_tof_us
y_np = simulation.y_att


Fitted params for raw proton pulse shape:
Name          Value      Min      Max   Stderr     Vary     Expr Brute_Step
amplitude  1.984e+04     -inf      inf    36.58     True     None     None
center         1909     -inf      inf   0.3126     True     None     None
fwhm          345.7     -inf      inf   0.7362    False 2.3548200*sigma     None
height         53.9     -inf      inf  0.09941    False 0.3989423*amplitude/max(1.e-15, sigma)     None
sigma         146.8        0      inf   0.3126     True     None     None
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Neutron_fitted_params_1eV_500eV_ikeda_carpenter.csv' exists...
Fitted parameters file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Loglog_linear_within_1eV_500eV_ikeda_carpenter.csv' exists...
Parameters linear fitted file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/TOF_shape_eV_78.0_82.0_0.01_us_0.05_183.7_0.01_proton_for_sum_16.45m_ikeda_carpenter.csv' exists...
TOF neutron beam shape file loaded.

In [6]:
simulation._convolve_beam_shapes(source_to_detector_m=source_to_detector_m, conv_proton=True,
                                 proton_params={'sigma':300},
                                )
x_np300 = simulation.x_tof_us
y_np300 = simulation.y_att


Fitted params for raw proton pulse shape:
Name          Value      Min      Max   Stderr     Vary     Expr Brute_Step
amplitude  1.984e+04     -inf      inf    36.58     True     None     None
center         1909     -inf      inf   0.3126     True     None     None
fwhm          345.7     -inf      inf   0.7362    False 2.3548200*sigma     None
height         53.9     -inf      inf  0.09941    False 0.3989423*amplitude/max(1.e-15, sigma)     None
sigma         146.8        0      inf   0.3126     True     None     None
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Neutron_fitted_params_1eV_500eV_ikeda_carpenter.csv' exists...
Fitted parameters file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Loglog_linear_within_1eV_500eV_ikeda_carpenter.csv' exists...
Parameters linear fitted file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/TOF_shape_eV_78.0_82.0_0.01_us_0.05_183.7_0.01_proton_sigma_300_for_sum_16.45m_ikeda_carpenter.csv' exists...
TOF neutron beam shape file loaded.

In [7]:
simulation._convolve_beam_shapes(source_to_detector_m=source_to_detector_m, conv_proton=True,
                                 proton_params={'sigma':500},
                                )
x_np500 = simulation.x_tof_us
y_np500 = simulation.y_att


Fitted params for raw proton pulse shape:
Name          Value      Min      Max   Stderr     Vary     Expr Brute_Step
amplitude  1.984e+04     -inf      inf    36.58     True     None     None
center         1909     -inf      inf   0.3126     True     None     None
fwhm          345.7     -inf      inf   0.7362    False 2.3548200*sigma     None
height         53.9     -inf      inf  0.09941    False 0.3989423*amplitude/max(1.e-15, sigma)     None
sigma         146.8        0      inf   0.3126     True     None     None
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Neutron_fitted_params_1eV_500eV_ikeda_carpenter.csv' exists...
Fitted parameters file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/Loglog_linear_within_1eV_500eV_ikeda_carpenter.csv' exists...
Parameters linear fitted file loaded.
✅ '/Users/y9z/Documents/GitHub/ResoFit/ResoFit/result/neutron_pulse/ikeda_carpenter/TOF_shape_eV_78.0_82.0_0.01_us_0.05_183.7_0.01_proton_sigma_500_for_sum_16.45m_ikeda_carpenter.csv' exists...
TOF neutron beam shape file loaded.

In [31]:
import pandas as pd
from scipy.interpolate import interp1d

In [41]:
df1 = pd.DataFrame()
df1['x_n'] = x_n+1.95-d
df1['y_n'] = y_n
df1.dropna(inplace=True)
df1.reset_index(inplace=True, drop=True)
df1


Out[41]:
x_n y_n
0 128.246541 0.018150
1 128.247443 0.018150
2 128.247697 0.018150
3 128.247710 0.018150
4 128.248458 0.018150
5 128.248493 0.018150
6 128.249648 0.018150
7 128.249880 0.018150
8 128.251879 0.018150
9 128.252530 0.018150
10 128.254549 0.018147
11 128.255460 0.018139
12 128.255713 0.018136
13 128.255728 0.018136
14 128.256478 0.018129
15 128.256507 0.018128
16 128.257670 0.018116
17 128.257893 0.018114
18 128.257921 0.018114
19 128.259890 0.018097
20 128.260561 0.018092
21 128.262559 0.018077
22 128.263478 0.018069
23 128.263730 0.018066
24 128.263748 0.018066
25 128.264500 0.018059
26 128.264523 0.018059
27 128.265693 0.018047
28 128.265907 0.018045
29 128.265929 0.018045
... ... ...
36928 163.868327 0.005445
36929 163.870806 0.005445
36930 163.876921 0.005470
36931 163.878994 0.005470
36932 163.885517 0.005497
36933 163.887183 0.005497
36934 163.894115 0.005497
36935 163.895373 0.005525
36936 163.902714 0.005525
36937 163.903565 0.005525
36938 163.911314 0.005555
36939 163.911759 0.005555
36940 163.919917 0.005586
36941 163.919954 0.005586
36942 163.928150 0.005618
36943 163.928521 0.005618
36944 163.936348 0.005618
36945 163.937127 0.005652
36946 163.944548 0.005652
36947 163.945734 0.005652
36948 163.952749 0.005687
36949 163.954343 0.005687
36950 163.960951 0.005722
36951 163.962954 0.005722
36952 163.969156 0.005759
36953 163.971566 0.005759
36954 163.977361 0.005759
36955 163.980180 0.005796
36956 163.985568 0.005796
36957 163.988796 0.005796

36958 rows × 2 columns


In [42]:
df2 = pd.DataFrame()
df2['x_np'] = x_np+0.03-d
df2['y_np'] = y_np
df2.dropna(inplace=True)
df2.reset_index(inplace=True, drop=True)
df2


Out[42]:
x_np y_np
0 127.245751 0.018150
1 127.245848 0.018150
2 127.246532 0.018150
3 127.246550 0.018150
4 127.247066 0.018150
5 127.247763 0.018150
6 127.247769 0.018150
7 127.247945 0.018150
8 127.248018 0.018150
9 127.248285 0.018150
10 127.248333 0.018150
11 127.248512 0.018150
12 127.248603 0.018150
13 127.248967 0.018150
14 127.249034 0.018150
15 127.249332 0.018150
16 127.249548 0.018150
17 127.249827 0.018150
18 127.250187 0.018150
19 127.250236 0.018150
20 127.250635 0.018150
21 127.250956 0.018150
22 127.251041 0.018150
23 127.251328 0.018150
24 127.251337 0.018150
25 127.251394 0.018150
26 127.251550 0.018150
27 127.251666 0.018150
28 127.252140 0.018150
29 127.252149 0.018150
... ... ...
35030 170.076469 0.005274
35031 170.084798 0.005274
35032 170.093129 0.005281
35033 170.101462 0.005290
35034 170.109795 0.005300
35035 170.118131 0.005312
35036 170.126468 0.005312
35037 170.134807 0.005326
35038 170.143147 0.005342
35039 170.151489 0.005359
35040 170.159832 0.005359
35041 170.168177 0.005378
35042 170.176523 0.005399
35043 170.184871 0.005421
35044 170.193221 0.005445
35045 170.201572 0.005445
35046 170.209925 0.005470
35047 170.218279 0.005497
35048 170.226635 0.005525
35049 170.234993 0.005525
35050 170.243352 0.005555
35051 170.251712 0.005586
35052 170.260075 0.005618
35053 170.268438 0.005652
35054 170.276804 0.005652
35055 170.285171 0.005687
35056 170.293539 0.005722
35057 170.301909 0.005759
35058 170.310281 0.005759
35059 170.318654 0.005796

35060 rows × 2 columns


In [43]:
df3 = pd.DataFrame()
df3['x_np300'] = x_np300-d
df3['y_np300'] = y_np300
df3.dropna(inplace=True)
df3.reset_index(inplace=True, drop=True)
df3


Out[43]:
x_np300 y_np300
0 126.355830 0.018150
1 126.355993 0.018150
2 126.356000 0.018150
3 126.357020 0.018150
4 126.357988 0.018150
5 126.358783 0.018150
6 126.360107 0.018150
7 126.360648 0.018150
8 126.361481 0.018150
9 126.361620 0.018150
10 126.361863 0.018150
11 126.361899 0.018150
12 126.362647 0.018150
13 126.362660 0.018150
14 126.362799 0.018150
15 126.363861 0.017839
16 126.364010 0.017839
17 126.364023 0.017839
18 126.365033 0.017839
19 126.366010 0.017839
20 126.366825 0.017839
21 126.368123 0.017839
22 126.368668 0.017839
23 126.369489 0.017839
24 126.369649 0.017839
25 126.369890 0.017839
26 126.369930 0.017839
27 126.370673 0.017839
28 126.370691 0.017839
29 126.370810 0.017839
... ... ...
38189 170.330544 0.005270
38190 170.338927 0.005274
38191 170.347311 0.005281
38192 170.355697 0.005290
38193 170.364084 0.005290
38194 170.372473 0.005300
38195 170.380864 0.005312
38196 170.389256 0.005326
38197 170.397650 0.005342
38198 170.406045 0.005342
38199 170.414442 0.005359
38200 170.422841 0.005378
38201 170.431241 0.005399
38202 170.439643 0.005421
38203 170.448046 0.005421
38204 170.456451 0.005445
38205 170.464857 0.005470
38206 170.473265 0.005497
38207 170.481675 0.005497
38208 170.490086 0.005525
38209 170.498499 0.005555
38210 170.506913 0.005586
38211 170.515329 0.005618
38212 170.523747 0.005618
38213 170.532166 0.005652
38214 170.540587 0.005687
38215 170.549009 0.005722
38216 170.557433 0.005722
38217 170.565859 0.005759
38218 170.574286 0.005796

38219 rows × 2 columns


In [44]:
df4 = pd.DataFrame()
df4['x_np500'] = x_np500-d
df4['y_np500'] = y_np500
df4.dropna(inplace=True)
df4.reset_index(inplace=True, drop=True)
df4


Out[44]:
x_np500 y_np500
0 126.182229 0.018150
1 126.190239 0.017839
2 126.198250 0.018058
3 126.206263 0.017765
4 126.214277 0.017601
5 126.222293 0.018083
6 126.227521 0.017803
7 126.230310 0.017787
8 126.234351 0.017702
9 126.235529 0.018014
10 126.238328 0.018108
11 126.241621 0.018106
12 126.242359 0.018085
13 126.243539 0.017954
14 126.246348 0.017806
15 126.249371 0.017809
16 126.249629 0.017806
17 126.250369 0.017789
18 126.251550 0.017683
19 126.254370 0.017726
20 126.257379 0.018091
21 126.257639 0.018097
22 126.257641 0.018097
23 126.258380 0.018109
24 126.259563 0.018118
25 126.262393 0.018084
26 126.265389 0.017793
27 126.265649 0.017797
28 126.265650 0.017797
29 126.266393 0.017807
... ... ...
38352 170.431241 0.005274
38353 170.439643 0.005281
38354 170.448046 0.005281
38355 170.456451 0.005290
38356 170.464857 0.005300
38357 170.473265 0.005312
38358 170.481675 0.005312
38359 170.490086 0.005326
38360 170.498499 0.005342
38361 170.506913 0.005359
38362 170.515329 0.005378
38363 170.523747 0.005378
38364 170.532166 0.005399
38365 170.540587 0.005421
38366 170.549009 0.005445
38367 170.557433 0.005470
38368 170.565859 0.005470
38369 170.574286 0.005497
38370 170.582715 0.005525
38371 170.591145 0.005555
38372 170.599577 0.005555
38373 170.608011 0.005586
38374 170.616446 0.005618
38375 170.624883 0.005652
38376 170.633321 0.005687
38377 170.641761 0.005687
38378 170.650203 0.005722
38379 170.658646 0.005759
38380 170.667090 0.005796
38381 170.675537 0.005796

38382 rows × 2 columns


In [50]:
df = pd.DataFrame()
df['x_n'] = df1['x_n']
df['y_n'] = df1['y_n']
df['x_np'] = df2['x_np']
df['y_np'] = df2['y_np']
df['x_np300'] = df3['x_np300']
df['y_np300'] = df3['y_np300']
df['x_np500'] = df4['x_np500']
df['y_np500'] = df4['y_np500']
df.dropna(inplace=True)
df


Out[50]:
x_n y_n x_np y_np x_np300 y_np300 x_np500 y_np500
0 128.246541 0.018150 127.245751 0.018150 126.355830 0.018150 126.182229 0.018150
1 128.247443 0.018150 127.245848 0.018150 126.355993 0.018150 126.190239 0.017839
2 128.247697 0.018150 127.246532 0.018150 126.356000 0.018150 126.198250 0.018058
3 128.247710 0.018150 127.246550 0.018150 126.357020 0.018150 126.206263 0.017765
4 128.248458 0.018150 127.247066 0.018150 126.357988 0.018150 126.214277 0.017601
5 128.248493 0.018150 127.247763 0.018150 126.358783 0.018150 126.222293 0.018083
6 128.249648 0.018150 127.247769 0.018150 126.360107 0.018150 126.227521 0.017803
7 128.249880 0.018150 127.247945 0.018150 126.360648 0.018150 126.230310 0.017787
8 128.251879 0.018150 127.248018 0.018150 126.361481 0.018150 126.234351 0.017702
9 128.252530 0.018150 127.248285 0.018150 126.361620 0.018150 126.235529 0.018014
10 128.254549 0.018147 127.248333 0.018150 126.361863 0.018150 126.238328 0.018108
11 128.255460 0.018139 127.248512 0.018150 126.361899 0.018150 126.241621 0.018106
12 128.255713 0.018136 127.248603 0.018150 126.362647 0.018150 126.242359 0.018085
13 128.255728 0.018136 127.248967 0.018150 126.362660 0.018150 126.243539 0.017954
14 128.256478 0.018129 127.249034 0.018150 126.362799 0.018150 126.246348 0.017806
15 128.256507 0.018128 127.249332 0.018150 126.363861 0.017839 126.249371 0.017809
16 128.257670 0.018116 127.249548 0.018150 126.364010 0.017839 126.249629 0.017806
17 128.257893 0.018114 127.249827 0.018150 126.364023 0.017839 126.250369 0.017789
18 128.257921 0.018114 127.250187 0.018150 126.365033 0.017839 126.251550 0.017683
19 128.259890 0.018097 127.250236 0.018150 126.366010 0.017839 126.254370 0.017726
20 128.260561 0.018092 127.250635 0.018150 126.366825 0.017839 126.257379 0.018091
21 128.262559 0.018077 127.250956 0.018150 126.368123 0.017839 126.257639 0.018097
22 128.263478 0.018069 127.251041 0.018150 126.368668 0.017839 126.257641 0.018097
23 128.263730 0.018066 127.251328 0.018150 126.369489 0.017839 126.258380 0.018109
24 128.263748 0.018066 127.251337 0.018150 126.369649 0.017839 126.259563 0.018118
25 128.264500 0.018059 127.251394 0.018150 126.369890 0.017839 126.262393 0.018084
26 128.264523 0.018059 127.251550 0.018150 126.369930 0.017839 126.265389 0.017793
27 128.265693 0.018047 127.251666 0.018150 126.370673 0.017839 126.265649 0.017797
28 128.265907 0.018045 127.252140 0.018150 126.370691 0.017839 126.265650 0.017797
29 128.265929 0.018045 127.252149 0.018150 126.370810 0.017839 126.266393 0.017807
... ... ... ... ... ... ... ... ...
35030 155.062250 0.040124 170.076469 0.005274 153.457697 0.040551 152.874479 0.040751
35031 155.065032 0.040123 170.084798 0.005274 153.458126 0.040551 152.882756 0.040749
35032 155.065168 0.040123 170.093129 0.005281 153.466084 0.040549 152.882900 0.040749
35033 155.070263 0.040122 170.101462 0.005290 153.466202 0.040549 152.891036 0.040747
35034 155.073491 0.040120 170.109795 0.005300 153.474280 0.040547 152.891476 0.040747
35035 155.073652 0.040121 170.118131 0.005312 153.474473 0.040547 152.899317 0.040745
35036 155.078277 0.040119 170.126468 0.005312 153.482359 0.040545 152.900054 0.040745
35037 155.081815 0.040119 170.134807 0.005326 153.482864 0.040545 152.907599 0.040743
35038 155.082275 0.040118 170.143147 0.005342 153.490440 0.040543 152.908633 0.040743
35039 155.086293 0.040118 170.151489 0.005359 153.491256 0.040542 152.915883 0.040741
35040 155.090141 0.040117 170.159832 0.005359 153.498522 0.040541 152.917214 0.040740
35041 155.090899 0.040116 170.168177 0.005378 153.499650 0.040540 152.924169 0.040739
35042 155.094310 0.040116 170.176523 0.005399 153.506606 0.040538 152.925797 0.040738
35043 155.098469 0.040114 170.184871 0.005421 153.508045 0.040538 152.932456 0.040736
35044 155.099524 0.040114 170.193221 0.005445 153.514691 0.040536 152.934381 0.040736
35045 155.102328 0.040113 170.201572 0.005445 153.516442 0.040536 152.940745 0.040734
35046 155.106798 0.040112 170.209925 0.005470 153.522777 0.040534 152.942967 0.040734
35047 155.108151 0.040111 170.218279 0.005497 153.524841 0.040534 152.949035 0.040732
35048 155.110348 0.040111 170.226635 0.005525 153.530865 0.040532 152.951555 0.040731
35049 155.115129 0.040110 170.234993 0.005525 153.533241 0.040532 152.957327 0.040730
35050 155.116780 0.040110 170.243352 0.005555 153.538955 0.040530 152.960144 0.040729
35051 155.118370 0.040108 170.251712 0.005586 153.541643 0.040529 152.965621 0.040728
35052 155.123462 0.040108 170.260075 0.005618 153.547046 0.040528 152.968735 0.040727
35053 155.125411 0.040108 170.268438 0.005652 153.550046 0.040527 152.973916 0.040726
35054 155.126393 0.040107 170.276804 0.005652 153.555138 0.040526 152.977327 0.040725
35055 155.131795 0.040105 170.285171 0.005687 153.558451 0.040525 152.982212 0.040724
35056 155.134417 0.040104 170.293539 0.005722 153.563232 0.040524 152.985921 0.040723
35057 155.140131 0.040104 170.301909 0.005759 153.566857 0.040523 152.990510 0.040721
35058 155.142443 0.040104 170.310281 0.005759 153.571328 0.040522 152.994517 0.040720
35059 155.148468 0.040101 170.318654 0.005796 153.575265 0.040521 152.998810 0.040719

35060 rows × 8 columns


In [53]:
t_max = 131.87
t_min = 128.54
t_step = 0.01
nbr_point = int((t_max - t_min) / t_step + 1)
ls_x = ['x_n', 'x_np', 'x_np300', 'x_np500']
ls_y = ['y_n', 'y_np', 'y_np300', 'y_np500']
df_out = pd.DataFrame()
x_axis = np.linspace(t_min, t_max, nbr_point).round(5)
df_out['x_interp'] = x_axis
for i, each in enumerate(ls_y):
    y_axis_function = interp1d(x=list(df[ls_x[i]]), y=list(df[each]), kind='cubic')
    df_out[each] = y_axis_function(x_axis)

In [54]:
df_out


Out[54]:
x_interp y_n y_np y_np300 y_np500
0 128.54 0.021277 0.027801 0.034353 0.041686
1 128.55 0.021771 0.028229 0.034530 0.041947
2 128.56 0.022300 0.028665 0.034707 0.042213
3 128.57 0.022864 0.029109 0.034882 0.042485
4 128.58 0.023462 0.029561 0.035056 0.042764
5 128.59 0.024095 0.030019 0.035228 0.043050
6 128.60 0.024760 0.030483 0.035400 0.043342
7 128.61 0.025458 0.030952 0.035570 0.043642
8 128.62 0.026185 0.031425 0.035738 0.043949
9 128.63 0.026941 0.031901 0.035905 0.044263
10 128.64 0.027722 0.032379 0.036071 0.044585
11 128.65 0.028526 0.032858 0.036235 0.044915
12 128.66 0.029351 0.033336 0.036398 0.045253
13 128.67 0.030193 0.033812 0.036559 0.045599
14 128.68 0.031048 0.034286 0.036720 0.045953
15 128.69 0.031912 0.034755 0.036878 0.046317
16 128.70 0.032782 0.035218 0.037036 0.046689
17 128.71 0.033654 0.035674 0.037192 0.047070
18 128.72 0.034523 0.036122 0.037348 0.047461
19 128.73 0.035384 0.036560 0.037502 0.047861
20 128.74 0.036233 0.036986 0.037656 0.048271
21 128.75 0.037065 0.037401 0.037809 0.048691
22 128.76 0.037877 0.037801 0.037962 0.049122
23 128.77 0.038662 0.038187 0.038114 0.049562
24 128.78 0.039418 0.038556 0.038267 0.050014
25 128.79 0.040140 0.038908 0.038420 0.050476
26 128.80 0.040825 0.039241 0.038574 0.050949
27 128.81 0.041468 0.039555 0.038729 0.051434
28 128.82 0.042066 0.039849 0.038885 0.051930
29 128.83 0.042617 0.040122 0.039043 0.052438
... ... ... ... ... ...
304 131.58 0.021470 0.023056 0.026520 0.035296
305 131.59 0.021178 0.022863 0.026368 0.035014
306 131.60 0.020903 0.022682 0.026223 0.034740
307 131.61 0.020651 0.022515 0.026086 0.034473
308 131.62 0.020427 0.022361 0.025955 0.034215
309 131.63 0.020231 0.022220 0.025832 0.033964
310 131.64 0.020064 0.022093 0.025715 0.033721
311 131.65 0.019926 0.021979 0.025605 0.033485
312 131.66 0.019817 0.021878 0.025503 0.033256
313 131.67 0.019736 0.021791 0.025407 0.033035
314 131.68 0.019682 0.021718 0.025319 0.032820
315 131.69 0.019655 0.021658 0.025237 0.032613
316 131.70 0.019652 0.021612 0.025162 0.032412
317 131.71 0.019674 0.021580 0.025095 0.032218
318 131.72 0.019719 0.021561 0.025034 0.032030
319 131.73 0.019787 0.021556 0.024980 0.031849
320 131.74 0.019876 0.021565 0.024934 0.031675
321 131.75 0.019985 0.021587 0.024894 0.031506
322 131.76 0.020115 0.021623 0.024861 0.031344
323 131.77 0.020263 0.021673 0.024835 0.031188
324 131.78 0.020431 0.021736 0.024817 0.031038
325 131.79 0.020616 0.021813 0.024805 0.030893
326 131.80 0.020819 0.021904 0.024800 0.030755
327 131.81 0.021040 0.022008 0.024802 0.030622
328 131.82 0.021276 0.022125 0.024812 0.030494
329 131.83 0.021528 0.022256 0.024828 0.030373
330 131.84 0.021796 0.022400 0.024851 0.030256
331 131.85 0.022080 0.022557 0.024882 0.030146
332 131.86 0.022377 0.022727 0.024919 0.030040
333 131.87 0.022689 0.022910 0.024963 0.029940

334 rows × 5 columns


In [55]:
df_out.to_clipboard()

In [18]:


In [16]:
simulation.export(x_axis='time', y_axis='attenuation', source_to_detector_m=source_to_detector_m, offset_us=2.78)


'Time (us)' was obtained with the following:
source_to_detector_m=16.45
offset_us=2.78
Exporting to clipboard completed.

In [18]:
experiment1.export(x_type='time', y_type='attenuation', t_unit='us')


Out[18]:
x y
0 0.96 0.032947
1 1.12 0.028682
2 1.28 0.023784
3 1.44 0.020349
4 1.60 0.022276
5 1.76 0.022747
6 1.92 0.020167
7 2.08 0.018862
8 2.24 0.023378
9 2.40 0.028210
10 2.56 0.027037
11 2.72 0.024648
12 2.88 0.020323
13 3.04 0.019840
14 3.20 0.019051
15 3.36 0.014892
16 3.52 0.011814
17 3.68 0.007386
18 3.84 0.006987
19 4.00 0.013964
20 4.16 0.014205
21 4.32 0.016009
22 4.48 0.014003
23 4.64 0.015825
24 4.80 0.017421
25 4.96 0.015155
26 5.12 0.012540
27 5.28 0.012222
28 5.44 0.009548
29 5.60 0.010404
... ... ...
2776 445.12 0.005094
2777 445.28 0.003596
2778 445.44 0.004051
2779 445.60 0.009737
2780 445.76 0.007203
2781 445.92 0.013659
2782 446.08 0.010629
2783 446.24 0.011610
2784 446.40 0.007048
2785 446.56 0.009207
2786 446.72 0.008866
2787 446.88 0.003544
2788 447.04 0.010973
2789 447.20 0.007840
2790 447.36 0.009436
2791 447.52 0.003415
2792 447.68 0.008944
2793 447.84 0.009021
2794 448.00 0.013826
2795 448.16 0.007227
2796 448.32 0.012424
2797 448.48 0.011139
2798 448.64 0.009720
2799 448.80 0.005232
2800 448.96 0.011359
2801 449.12 0.010899
2802 449.28 0.008012
2803 449.44 0.010435
2804 449.60 0.009637
2805 449.76 0.024209

2806 rows × 2 columns


In [12]:
d = 5.2
ax = simulation.plot(x_type='time', y_type='attenuation', source_to_detector_m=source_to_detector_m, offset_us=2.78,
                          mixed=False, all_layers=True)
ax = experiment1.plot(x_type='time', y_type='attenuation', t_unit='us', ax_mpl=ax)
ax.plot(x_n+1.95-d, y_n, label='Conv. Neutron')
ax.plot(x_np+0.03-d, y_np, label='Conv. Neutron*Proton(\u03C3=146.8)')
ax.plot(x_np300-d, y_np300, label='Conv. Neutron*Proton(\u03C3=300)')
ax.plot(x_np500-d, y_np500, label='Conv. Neutron*Proton(\u03C3=500)')
# experiment1.plot_raw(x_type='time', y_type='transmission', time_unit='us', ax_mpl=fig.axes[0])
# plt.plot(simulation.x_tof_us-5.2, 1-simulation.y_att, label='Conv. N*P(\u03C3=146.8)')
ax.set_xlim(left=126, right=136)
ax.legend()
ax.set_title('Gd resonance dip at ~80eV')
ax.grid()


'Time (us)' was obtained with the following:
source_to_detector_m=16.45
offset_us=2.78

In [8]:
simulation.neutron_pulse.proton_pulse.plot()


Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x11cfa1080>

In [9]:
total_fig = simulation.neutron_pulse.plot_shape_total()



In [ ]: