示例#1
0
#spec35 = Run(specpath + "2018_10_02__16_55_53.txt")
#spec45 = Run(specpath + "2018_09_04__11_39_44.txt")
#spec50 = Run(specpath + "2018_10_02__17_01_27.txt")
#spec60 = Run(specpath + "2018_09_04__11_45_54.txt")

runs = [skived30, skived45, skived60,
        skived75]  #[m18pol30, m18pol45, m18pol60, m18pol75]#[m1875]#
labels = [
    "30 degrees", "45 degrees", "60 degrees", "75 degrees"
]  #["30 degrees", "45 degrees", "60 degrees", "75 degrees"]#["75 degrees"]#

# Plot BRIDF data
sample_name = "Skived LZ"
plot_runs(runs,
          title=sample_name + ", 175 nm",
          log=True,
          labels=labels,
          errorbars=True,
          legend_loc=0)
t0 = time.time()

# Fit data
#fit_params = fit_parameters(get_independent_variables_and_relative_intensities(runs),p0=[0.8,1.55,0.09],average_angle=4., precision=0.25,use_errs=True,use_spike=False)
#fit_params_ang = fit_parameters_and_angle(get_independent_variables_and_relative_intensities(runs),average_angle=4.)
#fit_ang = fit_params_ang[0]
#fit_params = fit_params_ang[1:]
#print("Fit parameters (rho_L, n, gamma): "+str(fit_params))
#print("Fit angle: "+str(fit_ang))
t1 = time.time()
print("Fitting time: {0}".format(t1 - t0))

# Plot BRIDF model from fits
示例#2
0
    n_num=21,
    gamma_start=0.05,
    gamma_end=0.3,
    gamma_num=21,
    plot=True,
    show=False)  # coarse

chi_squared_new = chi_squared(v1_45.independent_variables_array,
                              v1_45.relative_intensities,
                              v1_45.relative_std,
                              fit_params_new,
                              average_angle=0,
                              precision=-1)

plot_runs(v1_45,
          title="Sample 1 (LUX), 178nm, Vacuum, 45 degrees",
          label="data",
          log=True)
plot_TSTR_fit(45.,
              1.,
              fit_params_old,
              label="fitted with old fitter",
              color="b",
              average_angle=0,
              precision=-1,
              fit_text="Old Fit, chi^2=" + str(round(chi_squared_old, 4)) +
              ": ",
              fit_text_offset=0.05)
plot_TSTR_fit(45.,
              1.,
              fit_params_new,
              label="fitted with new fitter",
]  #[s9_165nm_30, s9_165nm_28, s9_165nm_32] #[s9_400nm_30,s9_400nm_45,s9_400nm_52,s9_400nm_60,s9_400nm_67,s9_400nm_75]#[s2_r3_hip_30,s2_r3_hip_45,s2_r3_hip_52,s2_r3_hip_60,s2_r3_hip_67,s2_r3_hip_75]#
angles = [30, 45, 52, 60, 67,
          75]  #[45,43,47]#[52,51,53]#[60,59,62]#[67,66,69]#[75,74,77]#
fit_params_simple = [[0.787, 1.691, 0.044,
                      0.882], [0.757, 1.725, 0.157, 0.944],
                     [0.693, 1.792, 0.198, 0.901], [0.58, 1.914, 0.147, 0.865],
                     [0.283, 2.21, 0.083, 0.928], [0.051, 2.47, 0.076, 1]]

#labels=["30 degrees","45 degrees","52 degrees","60 degrees", "67 degrees", "75 degrees"]#
colors = ["r", "g", "b", "m", "c", "y"]

# Plot BRIDF data
sample_name = "LZ skived"
plot_runs(runs,
          title=sample_name + " in 0.2 barg LXe, 178 nm",
          log=True,
          include_legend=False,
          errorbars=True,
          legend_loc=0)
y_diffuse = []
y_specular = []
y_total = []
for ii in range(len(runs)):
    #plt.figure()
    run_data = get_independent_variables_and_relative_intensities(runs[ii])
    # plot_runs(runs[ii], title=sample_name+" in 0.2 barg LXe, {0:g} deg, 178 nm".format(angles[ii]), log=True, include_legend=True, errorbars=True, legend_loc=0)
    if angles[ii] < 40:
        shift_max = 1.04
        spec_max = 1.691
    else:
        shift_max = 1.09
        spec_max = 2.6
import matplotlib.pyplot as plt
import numpy as np
from file_reader import Run, get_independent_variables_and_relative_intensities
from plotting import plot_runs, plot_TSTR_fit
from TSTR_fit_new import fit_parameters, BRIDF_plotter, reflectance_diffuse, reflectance_specular

m18path = "vuv_height_comparison_and_first_data/M18 turn/center of sample/"
m1830 = Run(m18path + "2018_08_30__15_16_18.txt")
m1845 = Run(m18path + "2018_08_30__15_22_02.txt")
m1860 = Run(m18path + "2018_08_30__15_29_09.txt")
m1875 = Run(m18path + "2018_08_30__15_35_27.txt")

runs = [m1830, m1845, m1860, m1875]

plot_runs(runs,
          title="M18 turn, 175nm",
          log=True,
          labels=["30 degrees", "45 degrees", "60 degrees", "75 degrees"])

fit_params = fit_parameters(
    get_independent_variables_and_relative_intensities(runs))
plot_TSTR_fit(30., 1., fit_params, label="fitted", color="k")
plot_TSTR_fit(45., 1., fit_params, color="k")
plot_TSTR_fit(60., 1., fit_params, color="k")
plot_TSTR_fit(75., 1., fit_params, color="k")

plt.figure()

x = [30, 45, 60, 75]

y_diffuse = [reflectance_diffuse(theta, 1., 0.5, fit_params) for theta in x]
y_specular = [reflectance_specular(theta, 1., 0.5, fit_params) for theta in x]
示例#5
0
# dark_bkg_filename = "Vacuum measurements after 3rd xenon run\\Jan 9-12\\Background\\No beam\\2019_01_11__17_18_44.txt"
# bkg = self.dark_bkg_intensities
# self.beam_bkg_angles=self.dark_bkg_angles
# Used sigma_theta_i=2 for fitting and wavelength_F = False in TSTR_fit_new.py
# Angle range in file_reader is not cut off, stops at 85 in plot_TSTR_fit
#runs = [skived30, skived45, skived52, skived60, skived67, skived75]
#angle_shifts=angle_shifts_s9_vac
# Make sure n=1.0 for plotting below

for run, angle in zip(runs, angle_shifts): run.change_theta_i(angle)
labels=[r"$\theta_i=30^{\circ}$","45$^{\circ}$","52$^{\circ}$","60$^{\circ}$", "67$^{\circ}$", "75$^{\circ}$"]

# Plot BRIDF data
sample_name="M17 Skived"
fig, ax = plt.subplots()
plot_runs(runs, title="", log=True, labels=False, label=False, include_legend=False, errorbars=True, legend_loc=0, figure=False, colormap=True)


# Fit data
average_angle=4
precision=0.25
sigma_theta_i=2

# Fit parameters using power correction, TR dist, 2.00 solid angle factor, Gaussian distribution in n
fit_params_s9_lowp_gauss_n= [0.7617591236933063, 1.581667834504223, 0.10965539347694214, 1.2535811658618297]
fit_params_s9_vac= [0.73367974544643089, 1.7043657376479024, 0.11826240150179418, 7.9564857778025644]
fit_params_s8_lowp_gauss_n= [0.9144536241966592, 1.5793399801859325, 0.08088290783956979, 1.2565135586082907, 4.857675748475832]

fit_params = fit_params_s9_lowp_gauss_n

示例#6
0
]  #["0.2 barg","0.38 barg","0.60 barg","0.78 barg","0.98 barg","1.24 barg","1.34 barg"]#["0.31 barg","0.53 barg","0.71 barg","0.92 barg","1.07 barg","1.26 barg"]#["0.2 barg","0.22 barg","0.29 barg","0.38 barg","0.45 barg","0.53 barg","0.60 barg","0.70 barg","0.78 barg","0.92 barg","0.98 barg","1.24 barg","1.34 barg"]#["1.26 barg","1.07 barg","0.99 barg","0.92 barg","0.79 barg","0.71 barg","0.61 barg","0.53 barg","0.46 barg","0.39 barg","0.31 barg"]#["1.0 barg, 30 deg","1.0 barg, 45 deg","1.0 barg, 52 deg","1.0 barg, 60 deg","1.0 barg, 67 deg","1.0 barg, 75 deg","1.5 barg, 30 deg","1.5 barg, 45 deg","1.5 barg, 52 deg","1.5 barg, 60 deg","1.5 barg, 67 deg","1.5 barg, 75 deg"]#["0.2 barg, 30 deg","0.2 barg, 45 deg","0.2 barg, 52 deg","0.2 barg, 60 deg","0.2 barg, 67 deg","0.2 barg, 75 deg","1.0 barg, 30 deg","1.0 barg, 45 deg","1.0 barg, 52 deg","1.0 barg, 60 deg","1.0 barg, 67 deg","1.0 barg, 75 deg","1.5 barg, 30 deg","1.5 barg, 45 deg","1.5 barg, 52 deg","1.5 barg, 60 deg","1.5 barg, 67 deg","1.5 barg, 75 deg"]#["center, 30 deg","center, 45 deg","center, 52 deg","center, 60 deg","center, 67 deg","center, 75 deg","1/8\" above, 30 deg","1/8\" above, 45 deg","1/8\" above, 52 deg","1/8\" above, 60 deg","1/8\" above, 67 deg","1/8\" above, 75 deg"]#["0.2 barg","1.0 barg","1.5 barg"]#["1.0 barg, 30 deg","1.0 barg, 45 deg","1.0 barg, 52 deg","1.0 barg, 60 deg","1.0 barg, 67 deg","1.0 barg, 75 deg","1.5 barg, 30 deg","1.5 barg, 45 deg","1.5 barg, 52 deg","1.5 barg, 60 deg","1.5 barg, 67 deg","1.5 barg, 75 deg"]#["0.2 barg, 30 deg","0.2 barg, 45 deg","0.2 barg, 52 deg","0.2 barg, 60 deg","0.2 barg, 67 deg","0.2 barg, 75 deg","1.0 barg, 30 deg","1.0 barg, 45 deg","1.0 barg, 52 deg","1.0 barg, 60 deg","1.0 barg, 67 deg","1.0 barg, 75 deg","1.5 barg, 30 deg","1.5 barg, 45 deg","1.5 barg, 52 deg","1.5 barg, 60 deg","1.5 barg, 67 deg","1.5 barg, 75 deg"]#["30 deg","45 deg","52 deg","60 deg","67 deg","75 deg"]#["before getter, 30 deg", "before getter, 45 deg", "before getter, 52 deg", "before getter, 60 deg", "before getter, 67 deg", "before getter, 75 deg", "after getter, 30 deg", "after getter, 45 deg", "after getter, 52 deg", "after getter, 60 deg", "after getter, 67 deg", "after getter, 75 deg"]#["75 degrees"]#["run 1, 30 deg", "run 1, 45 deg", "run 1, 52 deg", "run 1, 60 deg", "run 1, 67 deg", "run 1, 75 deg", "run 2, 30 deg", "run 2, 45 deg", "run 2, 52 deg", "run 2, 60 deg", "run 2, 67 deg", "run 2, 75 deg"]#

# Params to change in file_reader.py: const_err=0, frac_err=0, intensity_correction=0.753
# Used scaled bkg from 1st LXe run, no dark bkg file loaded in:
# In file_reader.py, used self.dark_bkg_intensities=60, bkg_scaling=2.5
# beam_bkg_filename = "First Xe Run Measurements\\first measurements with no bubbles in cell 11-01-2\\Initial power and background at 178 nm\\2018_11_01__14_56_35.txt"
# bkg = (self.beam_bkg_intensities-self.dark_bkg_intensities)*(self.incidentpower/self.beam_bkg_incidentpower)*bkg_scaling +self.dark_bkg_intensities
# Angle range in file_reader is unrestricted (up to 85 degrees), same for plot_TSTR_fit

# Plot BRIDF data
sample_name = "M17 Skived, 60 deg"
fig, ax = plt.subplots()
plot_runs(runs,
          title="",
          log=False,
          figure=False,
          labels=labels,
          errorbars=True,
          legend_loc=0,
          colormap=True)

plt.ylim(0, 1.5)

# Set x-axis tick marks to every 10 deg
loc = ticker.MultipleLocator(
    base=10.0)  # this locator puts ticks at regular intervals
ax.xaxis.set_major_locator(loc)

# Add grid lines
plt.grid(b=True, which='major', color="lightgray", linestyle='--')

# fit_params = fit_parameters(get_independent_variables_and_relative_intensities([runs[0]]),p0=[.93, 1.57, .08, 0.8, 4.0],average_angle=4, precision=.25, sigma_theta_i=-1, use_errs=True,use_spike=True, use_nu=False,bounds=([0.1,1.1,0.03,0.01,1.0],[1.6,2.6,0.6,10.,50.]))
    _NXT85_turn_45, _807NX_turn_45, _old_sample_45
]
all_runs_60 = [
    _M18_turn_60, _M18_skived_60, _M18_polished_60, _M17_turn_60,
    _NXT85_turn_60, _807NX_turn_60, _old_sample_60
]

all_runs = all_runs_45 + all_runs_60

plot_runs(all_runs,
          title="mineral oil at different sample heights",
          labels=[
              "M18 turn, 45 degrees", "M18 skived, 45 degrees",
              "M18 polished, 45 degrees", "M17 turn, 45 degrees",
              "NXT85 turn, 45 degrees", "807NX turn, 45 degrees",
              "old sample, 45 degrees", "M18 turn, 60 degrees",
              "M18 skived, 60 degrees", "M18 polished, 60 degrees",
              "M17 turn, 60 degrees", "NXT85 turn, 60 degrees",
              "807NX turn, 60 degrees", "old sample, 60 degrees"
          ],
          smooth=True,
          show=False,
          legend_loc=2)

plot_runs(all_runs_45,
          title="45 degrees in mineral oil at different sample heights",
          labels=[
              "M18 turn", "M18 skived", "M18 polished", "M17 turn",
              "NXT85 turn", "807NX turn", "old sample"
          ],
          smooth=True,
          show=False,
示例#8
0
s9_67_high.change_theta_i(67 + 2)
s9_75_high = Run(s9_path + "2018_11_02__20_11_44.txt")
s9_75_high.change_theta_i(75 + 2)
"""
runs = [s9_30, s9_45, s9_52, s9_60, s9_67, s9_75]
labels = [
    "30 degrees", "45 degrees", "52 degrees", "60 degrees", "67 degrees",
    "75 degrees"
]

# Plot BRIDF data
sample_name = "LZ Skived, delta n = 0, no mirror correction"
plot_runs(runs,
          title=sample_name + " in LXe, Run 1, 178 nm",
          log=True,
          labels=labels,
          include_legend=False,
          errorbars=True,
          legend_loc=0)

t0 = time.time()

# Fit data

n_LXe_178 = 1.69
sigma_theta_i = 2
precision = 0.25
average_angle = 4

chi_30_list = []
chi_45_list = []
示例#9
0
all_1_runs = sample_1_runs + vacuum_1_runs
all_3_runs = sample_3_runs + vacuum_3_runs
all_9_runs = sample_9_runs + vacuum_9_runs

# vacuum individual fits

fit_params = fit_parameters(
    get_independent_variables_and_relative_intensities(v1_30),
    p0=[0.24, 1.2, .1, 5.0],
    average_angle=4.,
    precision=0.25,
    use_errs=True,
    use_spike=True)
plot_runs(v1_30,
          title="Sample 1 (LUX), 178nm, Vacuum, 30 degrees",
          label="data",
          log=True)
plot_TSTR_fit(30.,
              1.,
              fit_params,
              label="fitted",
              color="k",
              average_angle=4.,
              precision=0.25)
print("done with 30")

fit_params = fit_parameters(
    get_independent_variables_and_relative_intensities(v1_45),
    p0=[0.24, 1.2, .1, 5.0],
    average_angle=4.,
    precision=0.25,
[67., mirror_path + "2019_01_10__15_56_24.txt"],
[75., mirror_path + "2019_01_10__15_53_05.txt"]
]

path = "Vacuum measurements after 3rd xenon run/Jan 9-12/LUX/178nm/"

v_75 = Run(path + "2019_01_11__11_31_13.txt")
v_67 = Run(path + "2019_01_11__11_36_08.txt")
v_60 = Run(path + "2019_01_11__11_40_55.txt")
v_52 = Run(path + "2019_01_11__11_45_38.txt")
v_45 = Run(path + "2019_01_11__11_50_42.txt")
v_30 = Run(path + "2019_01_11__11_55_48.txt")

v_75c = Run(path + "2019_01_11__11_31_13.txt", mirror_filenames_and_angles)
v_67c = Run(path + "2019_01_11__11_36_08.txt", mirror_filenames_and_angles)
v_60c = Run(path + "2019_01_11__11_40_55.txt", mirror_filenames_and_angles)
v_52c = Run(path + "2019_01_11__11_45_38.txt", mirror_filenames_and_angles)
v_45c = Run(path + "2019_01_11__11_50_42.txt", mirror_filenames_and_angles)
v_30c = Run(path + "2019_01_11__11_55_48.txt", mirror_filenames_and_angles)

all_runs = [v_30, v_45, v_52, v_60, v_67, v_75]
all_runsc = [v_30c, v_45c, v_52c, v_60c, v_67c, v_75c]

labels=["30 degrees", "45 degrees", "52 degrees", "60 degrees", "67 degrees", "75 degrees"]

plot_runs(all_runs, title="not corrected", include_legend=False)
plot_runs(all_runsc, title="corrected using mirror data", include_legend=False)

plt.show()

示例#11
0
                params[ii] = float(param)
                break
            except ValueError:
                if param == '': break
                print("Error: input a number")

    n_LXe_178 = 1.69
    n = n_LXe_178
    sigma_theta_i = 2.0
    precision = 0.25
    average_angle = 4.  # 6 for 60, 6.9 for 67, 8 for 75

    #plt.figure(fig_num)
    plot_runs(runs,
              title=sample_name + ", 178 nm",
              log=True,
              labels=labels,
              errorbars=True)
    # Trying setting incident angles by hand, for better fits to specular spike
    plot_double_TSTR_fit(
        30.,
        n,
        params,
        labels=["fitted total", "fitted 1 (LXe-PTFE)", "fitted 2 (LXe-gas)"],
        colors=["k", "r", "b"],
        average_angle=average_angle,
        precision=precision,
        sigma_theta_i=sigma_theta_i)
    #print("done with 30...")
    plot_double_TSTR_fit(45.,
                         n,
# changing the relative intensities to the normalized ones
# (normally done automatically, but not input into LabVIEW for these tests)
# by default, intensities are plotted, not relative intensities

_45_405.relative_intensities = [x / max_405 for x in _45_405.intensities]
_60_405.relative_intensities = [x / max_405 for x in _60_405.intensities]
_45_175.relative_intensities = [x / max_175 for x in _45_175.intensities]
_60_175.relative_intensities = [x / max_175 for x in _60_175.intensities]

# doing the plotting

plot_runs(power_405,
          title="Power Measurement, 405 nm",
          smooth=True,
          show=False,
          voltage=True,
          ylabel="rate (Hz)",
          rot=True)
plot_runs(power_175,
          title="Power Measurement, 175 nm",
          smooth=True,
          show=False,
          voltage=True,
          ylabel="rate (Hz)",
          rot=True)

plot_runs([_45_405, _60_405],
          title="M18 turn, 405 nm",
          labels=["45 degrees", "60 degrees"],
          smooth=True,
nxt75 = Run(nxtpath + "2018_08_30__14_30_46.txt")
"""
plt.figure()
plot_runs([nx30, nx45, nx60], title="height comparison, 807NX turn, 175nm", smooth=True, figure=False, show=False, voltage=voltage, log=log,
	labels=["30 degrees centered", "45 degrees centered", "60 degrees centered"])
plot_runs([nx30_off, nx45_off, nx60_off], title="height comparison, 807NX turn, 175nm", smooth=True, figure=False, show=False, voltage=voltage, linestyle="--", log=log,
	labels=["30 degrees 1/8\" above center", "45 degrees 1/8\" above center", "60 degrees 1/8\" above center"])
"""

plt.figure()
plot_runs([m1830, m1845, m1860, m1875],
          title="height comparison, M18 turn, 175nm",
          smooth=True,
          figure=False,
          show=False,
          voltage=voltage,
          log=log,
          labels=[
              "30 degrees centered", "45 degrees centered",
              "60 degrees centered", "75 degrees centered"
          ])
plot_runs([m1830_off, m1845_off, m1860_off, m1875_off],
          title="height comparison, M18 turn, 175nm",
          smooth=True,
          figure=False,
          show=False,
          voltage=voltage,
          linestyle="--",
          log=log,
          labels=[
              "30 degrees 1/8\" above center", "45 degrees 1/8\" above center",
示例#14
0
import numpy as np
import matplotlib.pyplot as plt
from file_reader import Run
from plotting import plot_runs, plot_fit, plot_fit_by_params, get_total_reflection

path = "sample_height_tests/"

run = Run(path + "2018_05_31__13_04_27.txt")  # random M18_turn test

plot_runs(run, title="NXT85 in air, adjusting sample height", labels=["data"])

#plot_fit_by_params(0., 85., [100., 100., 10., 50.])

plot_fit(run, mu=49.)

print(get_total_reflection(run))

plt.legend(loc=3)
plt.show()