Ks = np.arange(200, 410, 20) # %% Load data and process it into correct format # File directory loc = ('..\\Simulation\\All parameters correct 2018-12-28\\Mech defect\\' + 'Results') # Import data without and with photoelasticity (with taper) files_pe = [ loc + '\\mech_a_40_d_le_centered_K1_' + str(a) + '_phon_1.csv' for a in Ks ] files_nope = [ loc + '\\mech_a_40_d_le_centered_K1_' + str(a) + '_phon_0.csv' for a in Ks ] Ez, Hx, Hy, Sx, Sy, x, y = read.readEHS_PE(files_pe, files_nope) # Calculate angle from x and y values (angle is counterclockwise from x-axis) theta = np.mod(np.arctan2(y, x), 2 * np.pi) # Sort by angle (since COMSOL does not) for i in range(0, len(Ks)): ind = np.argsort(theta[:, i]) theta[:, i] = theta[ind, i] x[:, i] = x[ind, i] y[:, i] = y[ind, i] Sx[:, i] = Sx[ind, i] Sy[:, i] = Sy[ind, i] # %% Plot using Poynting vector magnitude
alpha = (180 * (pm + 1) / 2 - pm * angles).astype('int') # %% Load data and process it into correct format # File directory loc = (r'C:\Users\tfy13nwi\Documents\Exjobb\Simulation' r'\Angle sweep verification\Results') # Import data without and with photoelasticity (with taper) files_pe = [ (loc + '\\a=' + str(a) + '_opt=' + str(opta) + ' (' + pmchar + ')_pe.csv') for a in angles ] files_nope = [(loc + '\\a=' + str(a) + '_opt=' + str(opta) + ' (' + pmchar + ')_nope.csv') for a in angles] Ez, Hx, Hy, Sx, Sy, x, y = read.readEHS_PE(files_pe, files_nope) # Import data without and with photoelasticity (no taper) files_pe_n = [(loc + '\\a=' + str(a) + '_opt=' + str(opta) + ' notaper (' + pmchar + ')_pe.csv') for a in angles] files_nope_n = [(loc + '\\a=' + str(a) + '_opt=' + str(opta) + ' notaper (' + pmchar + ')_nope.csv') for a in angles] Ez_n, Hx_n, Hy_n, Sx_n, Sy_n, x_n, y_n = read.readEHS_PE( files_pe_n, files_nope_n) # Import data without and with photoelasticity (wider apertures) # Uses another read-function since the datasets do not have the same number # of points in them initially (this is fixed by the function) files_pe_w = [(loc + '\\a=' + str(a) + '_opt=' + str(opta) + ' notaperwide (' + pmchar + ')_pe.csv') for a in angles] files_nope_w = [(loc + '\\a=' + str(a) + '_opt=' + str(opta) +