Example #1
0
    def callback(self, day, day_fraction, status, positions, home, work, plt,
                 **ignore_other_kwargs):
        """ This gets called after each computation cycle (see pandemic/simulation.py) """
        from pandemic.metrics import collision_count
        cc = collision_count(positions=positions,
                             status=status,
                             precision=self.params['geometry']['p'])
        self.collision_history.append(cc)
        if day_fraction == 0:
            # Daily collision TS
            self.collision_daily_history.append(
                sum(self.collision_history[-self.params['motion']['t']:]))

            # Standard plot of infections
            metrics = status_counts(status=status)
            self.metric_history.append(metrics)
            self.time_history.append(day + day_fraction)
            self.axs[0][0].clear
            plot_points(plt=self.axs[0][0],
                        positions=positions,
                        status=status,
                        title='Ornstein-Uhlenbeck')
            self.axs[0][0].figure

            # Standard plot of vulnerable only
            metrics = status_counts(status=status)
            vulnerable_positions = [
                pos for pos, s in zip(positions, status) if s == 0
            ]
            vulnerable_status = [s for s in status if s == 0]

            # Counts plot
            self.metric_history.append(metrics)
            self.time_history.append(day + day_fraction)
            self.axs[1][0].clear()
            plot_points(plt=self.axs[1][0],
                        positions=vulnerable_positions,
                        status=vulnerable_status,
                        title='Vulnerable')
            self.axs[1][0].figure

            # Growth curve
            infect = [m[1] for m in self.metric_history]
            self.axs[0][1].plot(self.time_history, infect, color=self.color)
            #self.axs[0][1].set_yscale('log')
            self.axs[0][1].set_title('Infected')
            self.axs[0][1].figure

            if day > 1:
                # Collisions curve
                self.axs[1][1].plot(self.collision_daily_history,
                                    color=self.color)
                self.axs[1][1].set_title('Collisions per day')
                self.axs[1][1].set_xlabel('Days since ' +
                                          str(self.params['geometry']['i']) +
                                          ' cases.')

            self.plt.show(block=False)
            self.plt.pause(0.1)
Example #2
0
    def plot_data_points(self):
        """Plot the location of the data points in (H, Hr) or (Hc, Hb) space.
        
        """

        self.send_latest_data.emit()
        plotting.plot_points(ax=self.p_map.axes,
                             forc=self.data_queue.get(),
                             coordinates=self.coordinates())
        self.tabWidget.setCurrentIndex(1)
        return
def one_height_slice(mesh,
                     begin_height,
                     box_size,
                     box_height,
                     vectors=None,
                     fraction=3,
                     debug=False):
    if vectors is None:
        vectors = mesh.vectors.copy()
    x_min, x_max, y_min, y_max, z_min, z_max = find_mins_maxs(mesh)
    step = box_height // fraction
    height = begin_height

    slice_plane, vectors = one_slice(vectors,
                                     height,
                                     x_min,
                                     x_max,
                                     y_min,
                                     y_max,
                                     box_size,
                                     debug=debug)
    for iter in range(fraction - 2):
        height += step
        t_slice_plane, vectors = one_slice(vectors,
                                           height,
                                           x_min,
                                           x_max,
                                           y_min,
                                           y_max,
                                           box_size,
                                           debug=debug)
        slice_plane += t_slice_plane

    t_slice_plane, vectors = one_slice(vectors,
                                       begin_height + box_height,
                                       x_min,
                                       x_max,
                                       y_min,
                                       y_max,
                                       box_size,
                                       debug=debug)
    slice_plane += t_slice_plane

    slice_plane[slice_plane != 0] = 1

    plot_points(slice_plane, debug=debug)
    return slice_plane, vectors
#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")

#plot_with_TSTR_fit(points_100, "TSTR Fit")
Example #5
0
                                405, photodiode_solid_angle,
                                photodiode_angular_width,
                                "60 degrees, relative to rotation stage")
    points_75_rot = make_points(data_75_rot[0], 0, 75, 1, 0.5, data_75_rot[1],
                                405, photodiode_solid_angle,
                                photodiode_angular_width,
                                "75 degrees, relative to rotation stage")

    all_points = points_30 + points_45 + points_60 + points_75

    all_points_rot = points_30_rot + points_45_rot + points_60_rot + points_75_rot

plot_1 = False
if plot_1:
    #plot_points(points_30_rot, "30 degrees")
    plot_points(all_points_rot, "all points rotation stage angle")
    plot_points(all_points, "all points")
    plt.show()

fit = True
if fit:
    fit_30 = TSTR_fit.fit_parameters(points_30)
    fit_45 = TSTR_fit.fit_parameters(points_45)
    fit_60 = TSTR_fit.fit_parameters(points_60)
    fit_75 = TSTR_fit.fit_parameters(points_75)

plot_1b = False
if plot_1b:
    plot_TSTR_fit_one_set_of_parameters(points_30, fit_30, "30 degrees")
    plot_TSTR_fit_one_set_of_parameters(points_45, fit_45, "45 degrees")
    plot_TSTR_fit_one_set_of_parameters(points_60, fit_60, "60 degrees")
Example #6
0
from data import load_position
from detect import find_candidate_lines
from plotting import imshow, plot_points, plot_lines
from chessboard import Chessboard
import matplotlib.pyplot as plt
import skimage

  
position_name = 'roy_lopez_marshall_attack.png'
orig = skimage.transform.rotate(load_position(position_name), 0)

lines = find_candidate_lines(orig)
chessboard = Chessboard(lines)

fig, ax = plt.subplots()
imshow(ax, orig)
plot_lines(ax, lines, orig)
plot_points(ax, chessboard.all_intersections())
plt.show()
for entry in file_data:
    filename = entry[0]
    flux_i = entry[1]
    # 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_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

plot_points(points_arr, title, log=False, show=False, draw_lines=True)
#plot_points(points_arr, "120 Grit Diffuse Reflector", log=False, show=False)
plt.show()
    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")
    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")
    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")

all_points_fine = points_fine_30 + points_fine_45 + points_fine_60 + points_fine_75

all_points_coarse = points_coarse_30 + points_coarse_45 + points_coarse_60

plot_points(all_points_fine,
            "1500 Grit Diffuse Reflector",
            log=False,
            show=False)
plot_points(all_points_coarse,
            "120 Grit Diffuse Reflector",
            log=False,
            show=False)
plt.show()
        data_2_75[0], 0, 75, 1.47399, 0.5, data_2_75[1], 405,
        photodiode_solid_angle, photodiode_angular_width,
        "75 degrees, 120 grit sample, rotated 45 degrees")

all_points_coarse = points_coarse_30 + points_coarse_45 + points_coarse_60

all_points_1 = points_1_30 + points_1_45 + points_1_60 + points_1_75

all_points_2 = points_2_30 + points_2_45 + points_2_60 + points_2_75

all_points = all_points_coarse + all_points_1 + all_points_2

make_plots = False
if make_plots:
    plot_points(points_coarse_30 + points_1_30 + points_2_30,
                "120 Grit Diffuse Reflector 30 Degrees",
                log=False,
                show=False)
    plot_points(points_coarse_45 + points_1_45 + points_2_45,
                "120 Grit Diffuse Reflector 45 Degrees",
                log=False,
                show=False)
    plot_points(points_coarse_60 + points_1_60 + points_2_60,
                "120 Grit Diffuse Reflector 60 Degrees",
                log=False,
                show=False)
    plot_points(points_1_75 + points_2_75,
                "120 Grit Diffuse Reflector 75 Degrees",
                log=False,
                show=False)
    plt.show()
"""
Example #10
0

    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)
#plot_points(points_older_with_cone + points_older_without_cone + points_new_walls + points_with_tube, "Old Cone vs New Cone", log=False, show=False)
plot_points(points_older_without_cone + points_new_walls, "Old vs New Without Cone", log=False, show=False)
plot_points(points_older_with_cone + points_with_tube, "Old vs New With Cone", log=False, show=False)
plt.show()
Example #11
0

# Parameters.
data_folder = '../data/'
dataset_name = 'cluster_harder'                      # Select either 'cluster_easy', 'cluster_harder', 'camel'.
C = 1
#kernel_func = functools.partial(rbf, gamma=1e3)  # Use this for camel data.
kernel_func = linear                                 # Use this for clusters data.
output_path = '../outputs/'                          # Where to save the plots.
class_colors = {-1: 'b', 1: 'r'}                     # Colors for plotting.

# Load data.
x_train, y_train = load_data_csv(os.path.join(data_folder, dataset_name+'_train.csv'))
x_test, y_test = load_data_csv(os.path.join(data_folder, dataset_name+'_test.csv'))

plot_points(x_train, y_train, class_colors=class_colors, title='Train - correct labels')
plot_points(x_test, y_test, class_colors=class_colors, title='Test - correct labels')

# Train the SVM classifier on the training data.
C_group = [1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4]
for i in range(len(C_group)):
    C = C_group[i]
    svm = SVM(kernel_func=kernel_func, C=C)
    print('Training...')
    svm.train(x_train, y_train)
    print('Plotting...')
    plot_svm_decision_boundary(svm, x_train, y_train,
        title='SVM decision boundary on training data', output_path=output_path,
        file_name=str(dataset_name) + '_support_vectors_train.png',
        class_colors=class_colors)
Example #12
0
def generate(npoints=50):
    '''
    generate a set of 50 points with
    parameters r and R as small as possible
    '''
    X = fibonacci_sphere(npoints)
    R, r, obs = minimize(X)
    return X, R, r, obs


if __name__ == '__main__':

    print('Experiment 1')
    X = [[0.0740328,-0.0669765,-0.995004],[-0.0424728,-0.0903481,-0.995004],[0.49942,-0.26344,-0.825336],[0.520044,0.219943,-0.825336],[0.158841,0.54184,-0.825336],[-0.318986,0.465907,-0.825336],[-0.562607,0.0478954,-0.825336],[-0.393151,-0.405282,-0.825336],[0.0649644,-0.560893,-0.825336],[0.475382,-0.304685,-0.825336],[0.866629,-0.207856,-0.453596],[0.844371,0.28511,-0.453596],[0.563236,0.690663,-0.453596],[0.109417,0.884465,-0.453596],[-0.377948,0.807097,-0.453596],[-0.749438,0.482279,-0.453596],[-0.891156,0.00959889,-0.453596],[-0.759652,-0.466025,-0.453596],[-0.395246,-0.798769,-0.453596],[0.0903402,-0.886617,-0.453596],[0.548228,-0.702635,-0.453596],[0.838034,-0.303231,-0.453596],[0.999467,0.0145951,0.0291995],[0.870013,0.492164,0.0291995],[0.527371,0.849133,0.0291995],[0.0555024,0.998031,0.0291995],[-0.429966,0.902373,0.0291995],[-0.810076,0.585597,0.0291995],[-0.991686,0.125327,0.0291995],[-0.930293,-0.365653,0.0291995],[-0.640942,-0.767034,0.0291995],[-0.194535,-0.980461,0.0291995],[0.299541,-0.953636,0.0291995],[0.720218,-0.693133,0.0291995],[0.964412,-0.262785,0.0291995],[0.833167,0.225751,0.504846],[0.57369,0.644988,0.504846],[0.127056,0.853807,0.504846],[-0.361029,0.784085,0.504846],[-0.731333,0.458566,0.504846],[-0.863051,-0.0165536,0.504846],[-0.713211,-0.486272,0.504846],[-0.330696,-0.797352,0.504846],[0.159703,-0.848307,0.504846],[0.598002,-0.622515,0.504846],[0.841211,-0.193636,0.504846],[0.448738,0.253724,0.856889],[0.0444146,0.513584,0.856889],[-0.398518,0.326994,0.856889],[-0.495025,-0.143847,0.856889],[-0.161214,-0.489644,0.856889],[0.312737,-0.409801,0.856889],[0.514831,0.0262759,0.856889],[0.030007,0.0287842,0.999135]]
    plot_points(X)
    R, r, obs = minimize(X)
    print('R = {0:.4f}\nr = {1:.4f}'.format(R, r))
    plot_circles(X, R)
    
    print('Experiment 2')
    X = sample_spherical(50, ndim=3)
    R, r, obs = minimize(X)
    print('R = {0:.4f}\nr = {1:.4f}'.format(R, r))
    plot_circles(X, R)

    print('Experiment 3')
    X, R, r, obs = generate(50)
    print('R = {0:.4f}\nr = {1:.4f}'.format(R, r))
    plot_circles(X, R)
def one_slice(vectors,
              height,
              x_min,
              x_max,
              y_min,
              y_max,
              box_size,
              decimals=6,
              frac=0.001,
              debug=False):
    """
    make boxed slice for given height
    :param vectors: array of 3d object
    :param height: heeigth for slice
    :param x_min: min x coordinate of the object
    :param x_max: max x coordinate of the object
    :param y_min: min y coordinate of the object
    :param y_max: max y coordinate of the object
    :param decimals: number of the decimals after point for rounding operations after math calculation
    :param box_size: size of the cube box
    :param frac: error in comparison
    :return: 2d binary array where 1 means that there`s a cube
    """
    lines_of_slice = []
    triangles_of_slice = []
    plot_vectors(vectors, debug=debug)

    # left only triangles which crosses horizontal plane
    new_vectors = []
    for triangle in vectors:
        upper = 0
        lower = 0
        for i in triangle:
            if i[2] > height:
                upper += 1
            else:
                lower += 1
        if upper != 0 and lower != 0:
            triangles_of_slice.append([triangle.copy(), upper])
        if upper != 0:
            new_vectors.append(triangle.copy())
    plot_vectors([i[0] for i in triangles_of_slice])

    # save only line of triangles in horizontal plane
    for triangle, upper in triangles_of_slice:
        # find points for neadble lines
        point_m = None
        point_a = None
        point_b = None
        if upper == 2:
            # two points upper than height
            min_ind = 0
            for i in range(2):
                if triangle[min_ind][2] > triangle[i + 1][2]:
                    min_ind = i + 1
            point_m = triangle[min_ind]
            point_a = triangle[(min_ind + 1) % 3]
            point_b = triangle[(min_ind + 2) % 3]

        else:
            # two points lower than height
            max_ind = 0
            for i in range(2):
                if triangle[max_ind][2] < triangle[i + 1][2]:
                    max_ind = i + 1
            point_m = triangle[max_ind]
            point_a = triangle[(max_ind + 1) % 3]
            point_b = triangle[(max_ind + 2) % 3]

        #     find intersections between lines and plane
        #     with a line
        z = height
        x_a = point_m[0] + (point_a[0] - point_m[0]) * (z - point_m[2]) / (
            point_a[2] - point_m[2])
        y_a = point_m[1] + (point_a[1] - point_m[1]) * (z - point_m[2]) / (
            point_a[2] - point_m[2])

        x_b = point_m[0] + (point_b[0] - point_m[0]) * (z - point_m[2]) / (
            point_b[2] - point_m[2])
        y_b = point_m[1] + (point_b[1] - point_m[1]) * (z - point_m[2]) / (
            point_b[2] - point_m[2])
        lines_of_slice.append([[x_a, y_a], [x_b, y_b]])
    lines_of_slice = np.array(lines_of_slice)
    lines_of_slice = np.around(lines_of_slice - 10**(-(decimals + 5)),
                               decimals=decimals)
    plot_lines(lines_of_slice, debug=debug)

    # create dotted plane from given group of borders
    length = math.ceil(abs(x_max - x_min) / box_size)
    width = math.ceil(abs(y_max - y_min) / box_size)
    slice_plane_cubes = np.zeros((length, width))
    for i in range(length):
        for j in range(width):
            for k in range(box_size**2):
                if slice_plane_cubes[i, j] != 0:
                    break
                else:
                    if (i * box_size + k % box_size < abs(x_max - x_min)) and (
                            j * box_size + k // box_size < abs(y_max - y_min)):
                        slice_plane_cubes[i, j] += is_inside([
                            int(round(x_min)) + i * box_size + k % box_size,
                            int(round(y_min)) + j * box_size + k // box_size
                        ], lines_of_slice)
                        slice_plane_cubes[i, j] = slice_plane_cubes[i, j] % 2

    plot_points(slice_plane_cubes, debug=debug)
    return slice_plane_cubes, new_vectors
Example #14
0
    def callback(self, day, day_fraction, status, positions, home, work, plt, **ignore_other_kwargs):
        """ This gets called after each computation cycle (see pandemic/simulation.py) """
        from pandemic.metrics import collision_count
        # Unique collisions with Joe
        from geohash import encode

        approx_precision = self.params['geometry']['p'] - 2

        for joe in range(self.num_joes):
            joes_hash = encode( positions[joe][0],positions[joe][1], precision = approx_precision )
            rough_positions = [ ( encode(pos[0], pos[1], precision=self.params['geometry']['p']-2),j) for j,pos in enumerate(positions) ]
            joes_collisions = [ j for (h,j) in rough_positions if h==joes_hash and not j==joe ]
            joes_new_collisions = [j for j in joes_collisions if not j in self.friends[joe] ]
            self.friends[joe].update( joes_new_collisions )
            self.collision_history.append(len(joes_collisions))
            self.unique_collions_history.append(len(joes_new_collisions))
        num_rolling = 48
        if len(self.collision_history)>num_rolling*self.num_joes:
            rolling_collisions = sum(self.collision_history[-num_rolling*self.num_joes:])
            rolling_unique_collisions = sum(self.unique_collions_history[-num_rolling*self.num_joes:])
            if day_fraction==0:
                self.attenuation_history.append((0.1 + rolling_unique_collisions) / (0.1 + rolling_collisions))
                self.herd_history.append(sum([s in [VULNERABLE] for s in status]) / len(status))

        if day_fraction==0:
            # Daily collision TS
            self.collision_daily_history.append(sum(self.collision_history[-self.params['motion']['t']:]))


            # Standard plot of infections
            metrics = status_counts(status=status)
            self.metric_history.append(metrics)
            self.time_history.append(day + day_fraction)
            self.axs[0][0].clear
            plot_points(plt=self.axs[0][0],positions=positions,status=status,title='Ornstein-Uhlenbeck')
            self.axs[0][0].figure

            if day > 1:
                # Collisions curve
                self.axs[1][0].plot(self.attenuation_history,marker='*')
                self.axs[1][0].plot(self.herd_history, marker='o')
                self.axs[1][0].set_title('Novelty versus Herd effect')


                self.axs[1][0].set_xlabel('Days since ' + str(self.params['geometry']['i']) + ' cases.')
                self.axs[1][0].set_ylabel('Attenuation')
            # Growth curve
            infect = [m[1] for m in self.metric_history]
            self.axs[0][1].plot(self.time_history, infect,color=self.color)
            #self.axs[0][1].set_yscale('log')
            self.axs[0][1].set_title('Infected')
            self.axs[0][1].figure

            if day>1:
                # Collisions curve
                self.axs[1][1].plot(self.collision_daily_history, color=self.color, marker='*')
                self.axs[1][1].set_title('Daily collisions')
                self.axs[1][1].set_xlabel('Days since '+str(self.params['geometry']['i'])+' cases.')

            self.plt.show(block=False)
            figManager = plt.get_current_fig_manager()
            figManager.full_screen_toggle()
            self.plt.pause(2)
    points_60_horizontal = make_points(data_60_horizontal[0], 0, 60, 1.47399,
                                       0.5, data_60_horizontal[1], 405,
                                       photodiode_solid_angle,
                                       photodiode_angular_width,
                                       "60 degrees horizontal polarization")
    points_75_vertical = make_points(data_75_vertical[0], 0, 75, 1.47399, 0.5,
                                     data_75_vertical[1], 405,
                                     photodiode_solid_angle,
                                     photodiode_angular_width,
                                     "75 degrees vertical polarization")
    points_75_horizontal = make_points(data_75_horizontal[0], 0, 75, 1.47399,
                                       0.5, data_75_horizontal[1], 405,
                                       photodiode_solid_angle,
                                       photodiode_angular_width,
                                       "75 degrees horizontal polarization")
all_points = points_45_vertical + points_45_horizontal + points_60_vertical + points_60_horizontal + points_75_vertical + points_75_horizontal

plot_points(points_45_horizontal + points_45_vertical,
            "45 degrees",
            log=False,
            show=False)
plot_points(points_60_horizontal + points_60_vertical,
            "60 degrees",
            log=False,
            show=False)
plot_points(points_75_horizontal + points_75_vertical,
            "75 degrees",
            log=False,
            show=False)
plt.show()
    points_air_without_75_slit = points_30_horizontal_air_slit + points_45_horizontal_air_slit + points_60_horizontal_air_slit

    points_water_slit = points_30_horizontal_water_slit + points_45_horizontal_water_slit + points_60_horizontal_water_slit + points_75_horizontal_water_slit

    points_water_without_75_slit = points_30_horizontal_water_slit + points_45_horizontal_water_slit + points_60_horizontal_water_slit

    points_mineral_oil_slit = points_30_horizontal_mineral_oil_slit + points_45_horizontal_mineral_oil_slit + points_60_horizontal_mineral_oil_slit + points_75_horizontal_mineral_oil_slit

    points_mineral_oil_without_75_slit = points_30_horizontal_mineral_oil_slit + points_45_horizontal_mineral_oil_slit + points_60_horizontal_mineral_oil_slit

    all_points_slit = points_air_slit + points_water_slit + points_mineral_oil_slit

plot_air = False
if plot_air:
    #plot_points(points_air_without_75 + points_air_without_75_slit, "Horizontal Polarization In Air With And Without Slit")
    plot_points(points_30_horizontal_air + points_30_horizontal_air_slit,
                "Horizontal Polarization In Air With And Without Slit")
    plot_points(points_45_horizontal_air + points_45_horizontal_air_slit,
                "Horizontal Polarization In Air With And Without Slit")
    plot_points(points_60_horizontal_air + points_60_horizontal_air_slit,
                "Horizontal Polarization In Air With And Without Slit")
    plot_points(points_75_horizontal_air + points_75_horizontal_air_slit,
                "Horizontal Polarization In Air With And Without Slit")

plot_water = False
if plot_water:
    #plot_with_TSTR_fit(points_water, "Horizontal Polarization in Water Without Slit")
    plot_points(points_30_horizontal_water + points_30_horizontal_water_slit,
                "Horizontal Polarization In Water With And Without Slit")
    plot_points(points_45_horizontal_water + points_45_horizontal_water_slit,
                "Horizontal Polarization In Water With And Without Slit")
    plot_points(points_60_horizontal_water + points_60_horizontal_water_slit,
Example #17
0
    theta_rot = 90 - p.theta_r_in_degrees
    theta_r = 180 - p.theta_i_in_degrees - theta_rot
    p.theta_r_in_degrees = theta_r

#plot_points(points_tape, "Tape in Mineral Oil", log=False)
"""

points_mineral_oil_30_subtracted = subtract_background(points_mineral_oil_30, points_background)
points_mineral_oil_45_subtracted = subtract_background(points_mineral_oil_45, points_background)
points_mineral_oil_52_5_subtracted = subtract_background(points_mineral_oil_52_5, points_background)
points_mineral_oil_60_subtracted = subtract_background(points_mineral_oil_60, points_background)
points_mineral_oil_75_subtracted = subtract_background(points_mineral_oil_75, points_background)
"""

#plot_points(points_background, "", log=False, show=True)
"""
plot_points(points_mineral_oil_30 + points_mineral_oil_30_subtracted,
            "Mineral Oil 30 degrees and Background", log=False, show=False)
plot_points(points_mineral_oil_45 + points_mineral_oil_45_subtracted,
            "Mineral Oil 45 degrees and Background", log=False, show=False)
plot_points(points_mineral_oil_52_5 + points_mineral_oil_52_5_subtracted,
            "Mineral Oil 52.5 degrees and Background", log=False, show=False)
plot_points(points_mineral_oil_60 + points_mineral_oil_60_subtracted,
            "Mineral Oil 60 degrees and Background", log=False, show=False)
plot_points(points_mineral_oil_75 + points_mineral_oil_75_subtracted,
            "Mineral Oil 75 degrees and Background", log=False, show=False)

plt.show()

"""