# 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,
                       "Different Polarizations in Air With Slit")
points = points_100 + points_50 + points_0

#plot_points(points_0_30 + points_50_30 + points_100_30, "30 degrees")
#plot_points(points_0_45 + points_50_45 + points_100_45, "45 degrees")
#plot_points(points_0_60 + points_50_60 + points_100_60, "60 degrees")
#plot_points(points_0_75 + points_50_75 + points_100_75, "75 degrees")

#plot_with_TSTR_fit(points_0_30 + points_50_30 + points_100_30, "30 degrees, Fitted")
#plot_with_TSTR_fit(points_0_45 + points_50_45 + points_100_45, "45 degrees, Fitted")
#plot_with_TSTR_fit(points_0_60 + points_50_60 + points_100_60, "60 degrees, Fitted")
#plot_with_TSTR_fit(points_0_75 + points_50_75 + points_100_75, "75 degrees, Fitted")

fit_plot_100 = False
if fit_plot_100:
    #plot_points(points_100, "TSTR Fit")
    plot_with_TSTR_fit(points_100_60, "TSTR Fit")

fit_plot_0 = False
if fit_plot_0:
    plot_points(points_0, "TSTR Fit")
    #plot_with_TSTR_fit(points_100_60, "TSTR Fit")
"""
plot_points(points_mineral_oil_30 + points_100_30, "")
plot_points(points_mineral_oil_45 + points_100_45, "")
plot_points(points_mineral_oil_52_5 + points_100_52_5, "")
plot_points(points_mineral_oil_60 + points_100_60, "")
plot_points(points_mineral_oil_75 + points_100_75, "")
"""

#plot_points(points, "TSTR Fit")
        cutoff_points_75 = []
        cutoff_data_75_x = []
        cutoff_data_75_y = []
        for point in points_75:
            if -50 < point.theta_r_in_degrees < 85:
                cutoff_points_75.append(point)
                cutoff_data_75_x.append(point.theta_r_in_degrees)
                cutoff_data_75_y.append(point.intensity)

        all_cutoff_points_mineral_oil = cutoff_points_30 + cutoff_points_45 + cutoff_points_60 + cutoff_points_75

    all_cutoff_points = all_cutoff_points_air + all_cutoff_points_water + all_cutoff_points_mineral_oil

fit_plot_air = False
if fit_plot_air:
    plot_with_TSTR_fit(all_cutoff_points_air, "TSTR Fit in Air")

fit_plot_water = False
if fit_plot_water:
    plot_with_TSTR_fit(all_cutoff_points_water, "TSTR Fit in Water")

fit_plot_mineral_oil = True
if fit_plot_mineral_oil:
    plot_with_TSTR_fit(all_cutoff_points_mineral_oil,
                       "TSTR Fit in Mineral Oil")

fit_plot_all_points = False
if fit_plot_all_points:
    plot_with_TSTR_fit(all_cutoff_points,
                       "TSTR Fit in Air, Water, and Mineral Oil")
        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")