sensitivity = 100 * 1e-9

    # product of this and measured voltage is (flux/str)/flux_i, flux in units of amps
    # intensity_factor * V = (V * sensitivity / photodiode_solid_angle) / flux_i
    intensity_factor_air_vertical = sensitivity / (photodiode_solid_angle *
                                                   flux_i_air_vertical)
    intensity_factor_air_horizontal = sensitivity / (photodiode_solid_angle *
                                                     flux_i_air_horizontal)

    data_45_horizontal_air = make_data_by_run(
        "HP and VP for 45 deg in air.txt", 0, 80,
        intensity_factor_air_horizontal)[1]

    points_45_horizontal_air = make_points(data_45_horizontal_air[0], 0, 47, 1,
                                           1, data_45_horizontal_air[1], 405,
                                           photodiode_solid_angle,
                                           photodiode_angular_width,
                                           "45 degrees horizontal water")

    data_45_vertical_air = make_data_by_run("HP and VP for 45 deg in air.txt",
                                            0, 80,
                                            intensity_factor_air_vertical)[0]
    points_45_vertical_air = make_points(data_45_vertical_air[0], 0, 47, 1, 0,
                                         data_45_vertical_air[1], 405,
                                         photodiode_solid_angle,
                                         photodiode_angular_width,
                                         "45 degrees vertical air")

plot = True
if plot:
    plot_with_TSTR_fit(points_45_vertical_air + points_45_horizontal_air,
    if horizontal:
        data_30_horizontal_air = make_data_by_run(
            "without_slit_7_18_horizontal/75, 60, 45, and 30 deg in air.txt",
            0, 85, intensity_factor_horizontal_air)[0]
        data_45_horizontal_air = make_data_by_run(
            "without_slit_7_18_horizontal/75, 60, 45, and 30 deg in air.txt",
            0, 85, intensity_factor_horizontal_air)[1]
        data_60_horizontal_air = make_data_by_run(
            "without_slit_7_18_horizontal/75, 60, 45, and 30 deg in air.txt",
            0, 85, intensity_factor_horizontal_air)[2]
        data_75_horizontal_air = make_data_by_run(
            "without_slit_7_18_horizontal/75, 60, 45, and 30 deg in air.txt",
            0, 85, intensity_factor_horizontal_air)[3]

        points_30_horizontal_air = make_points(
            data_30_horizontal_air[0], 0, 30, 1, 1, data_30_horizontal_air[1],
            405, photodiode_solid_angle, photodiode_angular_width,
            "30 degrees horizontal air without slit")
        points_45_horizontal_air = make_points(
            data_45_horizontal_air[0], 0, 45, 1, 1, data_45_horizontal_air[1],
            405, photodiode_solid_angle, photodiode_angular_width,
            "45 degrees horizontal air without slit")
        points_60_horizontal_air = make_points(
            data_60_horizontal_air[0], 0, 60, 1, 1, data_60_horizontal_air[1],
            405, photodiode_solid_angle, photodiode_angular_width,
            "60 degrees horizontal air without slit")
        points_75_horizontal_air = make_points(
            data_75_horizontal_air[0], 0, 79, 1, 1, data_75_horizontal_air[1],
            405, photodiode_solid_angle, photodiode_angular_width,
            "75 degrees horizontal air without slit")

        data_30_horizontal_water = make_data_by_run(
Ejemplo n.º 3
0
            intensity_factor)[4]
        data_45 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[3]
        data_60 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[2]
        data_52_5 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[1]
        data_75 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[0]

        points_100_30 = make_points(data_30[0], 0, 30, 1.47399, 0.5,
                                    data_30[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "30 degrees 100% glycerol")
        points_100_45 = make_points(data_45[0], 0, 45, 1.47399, 0.5,
                                    data_45[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "45 degrees 100% glycerol")
        points_100_52_5 = make_points(data_52_5[0], 0, 52.5, 1.47399, 0.5,
                                      data_52_5[1], 405,
                                      photodiode_solid_angle,
                                      photodiode_angular_width,
                                      "52.5 degrees 100% glycerol")
        points_100_60 = make_points(data_60[0], 0, 60, 1.47399, 0.5,
                                    data_60[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "60 degrees 100% glycerol")
        points_100_75 = make_points(data_75[0], 0, 75, 1.47399, 0.5,
	data_arr_i = make_data_by_run(filename, -35, 90, intensity_factor)
	for data in data_arr_i:
		if not get_entry_or_default(use_arr, ii, default=False):
			ii += 1
			continue
		if sub_avg:
			y_avg = TSTR_fit.average_by_angle(data[0], data[1], avg_angle)
			y_sub = [data_i-avg_i for data_i, avg_i in zip(data[1],y_avg)]
			data_add = [data[0],y_avg]
		else:
			data_add = data
		leg_i = get_entry_or_default(leg_arr, ii, default="")
		theta_i = get_entry_or_default(theta_i_arr, ii, default=0.)
		n_i = get_entry_or_default(n_arr, ii, default=1.)
		pol_i = get_entry_or_default(pol_arr, ii, default=0.5)
		points_arr += make_points(data_add[0], 0, theta_i, n_i, pol_i, data_add[1], wavelength,
							 photodiode_solid_angle, photodiode_angular_width, leg_i)
		ii += 1

points_x = [point.theta_r_in_degrees for point in points_arr]
points_y = [point.intensity for point in points_arr]

#print(points_x, points_y)
avg_angle = 3.7
fit_params_angle_float = TSTR_fit.fit_parameters_and_angle(points_arr)
fit_params = TSTR_fit.fit_parameters(points_arr, p0=[0.6, 1.3, 0.5], average_angle=avg_angle)
print("Fit parameters: ", fit_params)
#print(fit_params_angle_float)
fit_model = TSTR_fit.BRIDF_plotter(points_x, 0, 60., n_gly50, 0.5, fit_params, average_angle=0.)
fit_model_avg = TSTR_fit.BRIDF_plotter(points_x, 0, 60., n_gly50, 0.5, fit_params, average_angle=avg_angle)
#fit_angle_float = TSTR_fit.BRIDF_plotter(points_x, 0, fit_params_angle_float[0], n_gly50, 0.5, fit_params_angle_float[1:], average_angle=3.7)
model_by_eye = TSTR_fit.BRIDF_plotter(points_x, 0, 60., n_gly50, 0.5, [0.6, 1.27, 0.5], average_angle=avg_angle)
        data_30_horizontal_air = make_data_by_run(
            "horizontal_7_18/75, 60, 45, and 30 in air.txt", -90, 90,
            intensity_factor_air_horizontal)[0]
        data_45_horizontal_air = make_data_by_run(
            "horizontal_7_18/75, 60, 45, and 30 in air.txt", 0, 80,
            intensity_factor_air_horizontal)[1]
        data_60_horizontal_air = make_data_by_run(
            "horizontal_7_18/75, 60, 45, and 30 in air.txt", -90, 90,
            intensity_factor_air_horizontal)[2]
        data_75_horizontal_air = make_data_by_run(
            "horizontal_7_18/75, 60, 45, and 30 in air.txt", -90, 90,
            intensity_factor_air_horizontal)[3]

        points_30_horizontal_air = make_points(data_30_horizontal_air[0], 0,
                                               30, 1, 1,
                                               data_30_horizontal_air[1], 405,
                                               photodiode_solid_angle,
                                               photodiode_angular_width,
                                               "30 degrees horizontal air")
        points_45_horizontal_air = make_points(data_45_horizontal_air[0], 0,
                                               45, 1, 1,
                                               data_45_horizontal_air[1], 405,
                                               photodiode_solid_angle,
                                               photodiode_angular_width,
                                               "45 degrees horizontal air")
        points_60_horizontal_air = make_points(data_60_horizontal_air[0], 0,
                                               60, 1, 1,
                                               data_60_horizontal_air[1], 405,
                                               photodiode_solid_angle,
                                               photodiode_angular_width,
                                               "60 degrees horizontal air")
        points_75_horizontal_air = make_points(data_75_horizontal_air[0], 0,
Ejemplo n.º 6
0
    data_75 = make_data_by_run(
        "tube bumps analysis data/relative to normal angles.txt", -90, 90,
        intensity_factor)[0]
    data_45 = make_data_by_run(
        "tube bumps analysis data/relative to normal angles.txt", -90, 90,
        intensity_factor)[1]
    data_60 = make_data_by_run(
        "tube bumps analysis data/relative to normal angles.txt", -90, 90,
        intensity_factor)[2]
    data_30 = make_data_by_run(
        "tube bumps analysis data/relative to normal angles.txt", -90, 90,
        intensity_factor)[3]

    points_30 = make_points(data_30[0], 0, 30, 1, 0.5, data_30[1], 405,
                            photodiode_solid_angle, photodiode_angular_width,
                            "30 degrees")
    points_45 = make_points(data_45[0], 0, 45, 1, 0.5, data_45[1], 405,
                            photodiode_solid_angle, photodiode_angular_width,
                            "45 degrees")
    points_60 = make_points(data_60[0], 0, 60, 1, 0.5, data_60[1], 405,
                            photodiode_solid_angle, photodiode_angular_width,
                            "60 degrees")
    points_75 = make_points(data_75[0], 0, 75, 1, 0.5, data_75[1], 405,
                            photodiode_solid_angle, photodiode_angular_width,
                            "75 degrees")

    data_75_rot = make_data_by_run_angles_count_down(
        "tube bumps analysis data/rotation stage angles.txt", 0, 180,
        intensity_factor)[0]
    data_45_rot = make_data_by_run_angles_count_down(
    data_60_horizontal = make_data_by_run(
        "10_12_polarization_data/60 degree horizontal and vertical mineral oil.txt",
        -90, 90, intensity_factor_horizontal)[1]
    data_60_vertical = make_data_by_run(
        "10_12_polarization_data/60 degree horizontal and vertical mineral oil.txt",
        -90, 90, intensity_factor_vertical)[0]
    data_75_vertical = make_data_by_run(
        "10_12_polarization_data/75 degree vertical and horizontal mineral oil.txt",
        -90, 90, intensity_factor_vertical)[1]
    data_75_horizontal = make_data_by_run(
        "10_12_polarization_data/75 degree vertical and horizontal mineral oil.txt",
        -90, 90, intensity_factor_horizontal)[0]

    points_45_vertical = make_points(data_45_vertical[0], 0, 45, 1.47399, 0.5,
                                     data_45_vertical[1], 405,
                                     photodiode_solid_angle,
                                     photodiode_angular_width,
                                     "45 degrees vertical polarization")
    points_45_horizontal = make_points(data_45_horizontal[0], 0, 45, 1.47399,
                                       0.5, data_45_horizontal[1], 405,
                                       photodiode_solid_angle,
                                       photodiode_angular_width,
                                       "45 degrees horizontal polarization")
    points_60_vertical = make_points(data_60_vertical[0], 0, 60, 1.47399, 0.5,
                                     data_60_vertical[1], 405,
                                     photodiode_solid_angle,
                                     photodiode_angular_width,
                                     "60 degrees vertical polarization")
    points_60_horizontal = make_points(data_60_horizontal[0], 0, 60, 1.47399,
                                       0.5, data_60_horizontal[1], 405,
                                       photodiode_solid_angle,
    data_fine_75 = make_data_by_run(
        "10_18_diffuse_reflectors/diffuse reflector 1500 grit in mineral oil 75 full range.txt",
        -90, 90, intensity_factor)[0]

    data_coarse_30 = make_data_by_run(
        "10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt",
        -90, 90, intensity_factor)[2]
    data_coarse_45 = make_data_by_run(
        "10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt",
        -90, 90, intensity_factor)[1]
    data_coarse_60 = make_data_by_run(
        "10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt",
        -90, 90, intensity_factor)[0]

    points_fine_30 = make_points(data_fine_30[0], 0, 30, 1.47399, 0.5,
                                 data_fine_30[1], 405, photodiode_solid_angle,
                                 photodiode_angular_width,
                                 "30 degrees, 1500 grit sample")
    points_fine_45 = make_points(data_fine_45[0], 0, 45, 1.47399, 0.5,
                                 data_fine_45[1], 405, photodiode_solid_angle,
                                 photodiode_angular_width,
                                 "45 degrees, 1500 grit sample")
    points_fine_60 = make_points(data_fine_60[0], 0, 60, 1.47399, 0.5,
                                 data_fine_60[1], 405, photodiode_solid_angle,
                                 photodiode_angular_width,
                                 "60 degrees, 1500 grit sample")
    points_fine_75 = make_points(data_fine_75[0], 0, 75, 1.47399, 0.5,
                                 data_fine_75[1], 405, photodiode_solid_angle,
                                 photodiode_angular_width,
                                 "75 degrees, 1500 grit sample")

    points_coarse_30 = make_points(data_coarse_30[0], 0, 30, 1.47399, 0.5,
    # intensity_factor * V = (V * sensitivity / photodiode_solid_angle) / flux_i
    intensity_factor = sensitivity / (photodiode_solid_angle * flux_i)

    data_coarse_30 = \
    make_data_by_run("10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt", -90, 90,
                     intensity_factor)[2]
    data_coarse_45 = \
    make_data_by_run("10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt", -90, 90,
                     intensity_factor)[1]
    data_coarse_60 = \
    make_data_by_run("10_18_diffuse_reflectors/diffuse reflector 120 grit in mineral oil 30 45 60.txt", -90, 90,
                     intensity_factor)[0]

    points_coarse_30 = make_points(data_coarse_30[0], 0, 30, 1.47399, 0.5,
                                   data_coarse_30[1], 405,
                                   photodiode_solid_angle,
                                   photodiode_angular_width,
                                   "30 degrees, 120 grit sample, older data")
    points_coarse_45 = make_points(data_coarse_45[0], 0, 45, 1.47399, 0.5,
                                   data_coarse_45[1], 405,
                                   photodiode_solid_angle,
                                   photodiode_angular_width,
                                   "45 degrees, 120 grit sample, older data")
    points_coarse_60 = make_points(data_coarse_60[0], 0, 60, 1.47399, 0.5,
                                   data_coarse_60[1], 405,
                                   photodiode_solid_angle,
                                   photodiode_angular_width,
                                   "60 degrees, 120 grit sample, older data")

    # volts * amps/volt
    flux_i = 0.00594 * 100e-6
Ejemplo n.º 10
0
        # product of this and measured voltage is (flux/str)/flux_i, flux in units of amps
        # intensity_factor * V = (V * sensitivity / photodiode_solid_angle) / flux_i
        intensity_factor = sensitivity / (photodiode_solid_angle * flux_i)

        data_30 = make_data_by_run("7_18_plots/30 deg in air with slit.txt",
                                   10, 85, intensity_factor)[0]
        data_45 = make_data_by_run("7_18_plots/45 deg in air with slit.txt",
                                   20, 80, intensity_factor)[0]
        data_60 = make_data_by_run("7_18_plots/60 in air with slit.txt", 0, 80,
                                   intensity_factor)[0]
        data_75 = make_data_by_run("7_18_plots/75 in air with slit.txt", 0, 80,
                                   intensity_factor)[0]

        points_30 = make_points(data_30[0], 0, 30, 1, 0.5, data_30[1], 405,
                                photodiode_solid_angle,
                                "30 degrees air with slit")
        points_45 = make_points(data_45[0], 0, 45, 1, 0.5, data_45[1], 405,
                                photodiode_solid_angle,
                                "45 degrees air with slit")
        points_60 = make_points(data_60[0], 0, 60, 1, 0.5, data_60[1], 405,
                                photodiode_solid_angle,
                                "60 degrees air with slit")
        points_75 = make_points(data_75[0], 0, 75, 1, 0.5, data_75[1], 405,
                                photodiode_solid_angle, "75 degrees air slit")

        points = points_30 + points_45 + points_60 + points_75
        points_no_75 = points_30 + points_45 + points_60

fit_plot_air = True
if fit_plot_air:
Ejemplo n.º 11
0
    # product of this and measured voltage is (flux/str)/flux_i, flux in units of amps
    # intensity_factor * V = (V * sensitivity / photodiode_solid_angle) / flux_i
    intensity_factor_no_tube = sensitivity / (photodiode_solid_angle * flux_i_no_tube)
    intensity_factor_with_tube = sensitivity / (photodiode_solid_angle * flux_i_with_tube)
    intensity_factor_older = sensitivity / (photodiode_solid_angle * flux_i_older)


    data_old_walls = make_data_by_run("background in mineral oil no sample old walls new walls lens tubes.txt", -90, 90, intensity_factor_no_tube)[2]
    data_new_walls = make_data_by_run("background in mineral oil no sample old walls new walls lens tubes.txt", -90, 90, intensity_factor_no_tube)[1]
    data_with_tube = make_data_by_run("background in mineral oil no sample old walls new walls lens tubes.txt", -90, 90, intensity_factor_with_tube)[0]

    data_older_without_cone = make_data_by_run("mineral oil background with and without cone.txt", -90, 90, intensity_factor_older)[0]
    data_older_with_cone = make_data_by_run("mineral oil background with and without cone.txt", -90, 90, intensity_factor_older)[1]

    points_old_walls = make_points(data_old_walls[0], 0, 90, 1.47399, 0.5, data_old_walls[1], 405,
                                   photodiode_solid_angle, photodiode_angular_width, "cardboard walls")
    points_new_walls = make_points(data_new_walls[0], 0, 90, 1.47399, 0.5, data_new_walls[1], 405,
                                   photodiode_solid_angle, photodiode_angular_width, "new walls")
    points_with_tube = make_points(data_with_tube[0], 0, 90, 1.47399, 0.5, data_with_tube[1], 405,
                                   photodiode_solid_angle, photodiode_angular_width, "new walls with cone of darkness")
    points_older_without_cone = make_points(data_older_without_cone[0], 0, 90, 1.47399, 0.5, data_older_without_cone[1],
                                            405, photodiode_solid_angle, photodiode_angular_width, "older without cone")
    points_older_with_cone = make_points(data_older_with_cone[0], 0, 90, 1.47399, 0.5, data_older_with_cone[1],
                                            405, photodiode_solid_angle, photodiode_angular_width, "older with cone")


all_points = points_old_walls + points_new_walls + points_with_tube


#plot_points(points_old_walls + points_new_walls + points_with_tube, "Newer Background Tests", log=False, show=False)
#plot_points(points_older_with_cone + points_older_without_cone, "Older Background Tests", log=False, show=False)
        photodiode_solid_angle * flux_i)

    # volts * amps/volt
    flux_i = 0.00238 * 100e-6
    # amps per volt during measurements
    sensitivity = 100 * 1e-9
    # product of this and measured voltage is (flux/str)/flux_i, flux in units of amps
    # intensity_factor * V = (V * sensitivity / photodiode_solid_angle) / flux_i
    intensity_factor_mineral_oil_vertical = polarizer_transmission_vertical * sensitivity / (
        photodiode_solid_angle * flux_i)
    intensity_factor_mineral_oil_horizontal = polarizer_transmission_vertical * sensitivity / (
        photodiode_solid_angle * flux_i)

    data_horizontal = make_data_by_run("45_deg_polarization_test.txt", 0, 80,
                                       intensity_factor_air_horizontal)[0]
    data_vertical = make_data_by_run("45_deg_polarization_test.txt", 0, 80,
                                     intensity_factor_air_vertical)[1]

    points_horizontal = make_points(data_horizontal[0], 0, 45, 1, 1,
                                    data_horizontal[1], 405,
                                    photodiode_solid_angle, "horizontal")
    points_vertical = make_points(data_vertical[0], 0, 45, 1, 0,
                                  data_vertical[1], 405,
                                  photodiode_solid_angle, "vertical")

plot = True
if plot:
    plot_with_TSTR_fit(
        points_vertical + points_horizontal,
        "Different Polarizations in Air, 45 degrees Without Slit")
Ejemplo n.º 13
0
            intensity_factor)[4]
        data_45 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[3]
        data_60 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[2]
        data_52_5 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[1]
        data_75 = make_data_by_run(
            "glycerol_tests/glycerol 30,45,60,52.5,75.txt", -90, 90,
            intensity_factor)[0]

        points_100_30 = make_points(data_30[0], 0, 30, 1.47399, 0.5,
                                    data_30[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "30 degrees 100% glycerol")
        points_100_45 = make_points(data_45[0], 0, 45, 1.47399, 0.5,
                                    data_45[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "45 degrees 100% glycerol")
        points_100_52_5 = make_points(data_52_5[0], 0, 52.5, 1.47399, 0.5,
                                      data_52_5[1], 405,
                                      photodiode_solid_angle,
                                      photodiode_angular_width,
                                      "52.5 degrees 100% glycerol")
        points_100_60 = make_points(data_60[0], 0, 60, 1.47399, 0.5,
                                    data_60[1], 405, photodiode_solid_angle,
                                    photodiode_angular_width,
                                    "60 degrees 100% glycerol")
        points_100_75 = make_points(data_75[0], 0, 75, 1.47399, 0.5,