Example #1
0
                   Air,
                   Si,
                   'test',
                   options,
                   1,
                   'front',
                   len(layers),
                   save=True)

full = results_front[0].todense()[n_wl - 1]

theta_all = np.unique(angle_vector[:, 1])
theta_r = theta_all[:options['n_theta_bins']]
theta_t = theta_all[options['n_theta_bins']:]

summat = theta_summary(full, angle_vector, options['n_theta_bins'])

Rth = summat[0:options['n_theta_bins'], :]
Tth = summat[options['n_theta_bins']:, :]
#
# theta_r = np.unique(angle_vector[:,1])[:options['n_theta_bins']]
# theta_t = np.unique(angle_vector[:,1])[options['n_theta_bins']:]
# Rth = xr.DataArray(Rth, dims=[r'$\sin(\theta_{out})$', r'$\sin(\theta_{in})$'])#, coords={r'$\sin(\theta_{out})$': np.linspace(0,1,options['n_theta_bins']),
#                                                                            # r'$\sin(\theta_{in})$': np.linspace(0,1,options['n_theta_bins'])})
# Tth = xr.DataArray(Tth, dims=[r'$\sin(\theta_{out})$', r'$\sin(\theta_{in})$'])#, coords={r'$\sin(\theta_{out})$': np.linspace(1,0,options['n_theta_bins']),
#                                                                             #r'$\sin(\theta_{in})$': np.linspace(0,1,options['n_theta_bins'])})
#
# Rth = xr.DataArray(Rth, dims=[r'$\theta_{out}$', r'$\theta_{in}$'])#, coords={r'$\theta_{out}$': theta_r,
#                                                                            # r'$\theta_{in}$': theta_r})
# Tth = xr.DataArray(Tth, dims=[r'$\theta_{out}$', r'$\theta_{in}$'])#, coords={r'$\theta_{out}$': theta_t,
#                                                                            # r'$\theta_{in}$': theta_r})
from config import results_path
from sparse import load_npz


_, _, angle_vector = make_angle_vector(options['n_theta_bins'], options['phi_symmetry'],
                                       options['c_azimuth'])

wl_to_plot = 1100e-9

wl_index = np.argmin(np.abs(wavelengths-wl_to_plot))

sprs = load_npz(os.path.join(results_path, options['project_name'], SC[0].name + 'rearRT.npz'))

full = sprs[wl_index].todense()

summat = theta_summary(full, angle_vector, options['n_theta_bins'], 'rear')

summat_r = summat[options['n_theta_bins']:, :]

summat_r= summat_r.rename({r'$\theta_{in}$': 'a', r'$\theta_{out}$': 'b'})

summat_r= summat_r.assign_coords(a=np.sin(summat_r.coords['a']).data,
                                                  b=np.sin(summat_r.coords['b']).data)


summat_r= summat_r.rename({'a': r'$\sin(\theta_{in})$', 'b': r'$\sin(\theta_{out})$'})

#ax = plt.subplot(212)

#ax = Tth.plot.imshow(ax=ax)
Example #3
0
                                       options['c_azimuth'])


sprs_front = load_npz(os.path.join(results_path, options['project_name'], SC[0].name + 'frontRT.npz'))
sprs_rear = load_npz(os.path.join(results_path, options['project_name'], SC[0].name + 'rearRT.npz'))

wl_to_plot = 1100e-9

wl_index = np.argmin(np.abs(wavelengths-wl_to_plot))

full_f = sprs_front[wl_index].todense()
full_r = sprs_rear[wl_index].todense()

#summat= theta_summary(full_f, angle_vector, options['n_theta_bins'], "front")

summat = theta_summary(full_r, angle_vector, options['n_theta_bins'], "rear")

## reflection

#whole_mat = xr.concat((summat, summat_back), dim=r'$\theta_{in}$')
summat_back = summat[options['n_theta_bins']:]

whole_mat_imshow = summat_back.rename({r'$\theta_{in}$': 'a', r'$\theta_{out}$': 'b'})

whole_mat_imshow = whole_mat_imshow.assign_coords(a=np.sin(whole_mat_imshow.coords['a']).data,
                                                  b=np.sin(whole_mat_imshow.coords['b']).data)


whole_mat_imshow = whole_mat_imshow.rename({'a': r'$\sin(\theta_{in})$', 'b': r'$\sin(\theta_{out})$'})

#whole_mat_imshow = whole_mat_imshow.interp(theta_in = np.linspace(0, np.pi, 100), theta_out =  np.linspace(0, np.pi, 100))