wo.plot_multicolumn([target[:,:,z_layer], azimuth[:,:,z_layer]%(2*np.pi), inclination[:,:,z_layer]], origin='lower', size=5, num_col=3, titles=[f'target, z={z_layer}', 'azimuth', 'inclination'], set_title = True) #### XZ sections wo.plot_multicolumn([np.transpose(target[y_layer,:,:]), np.transpose(azimuth[y_layer,:,:])%(2*np.pi), np.transpose(inclination[y_layer,:,:])], origin='lower', size=5, num_col=3, titles=['retardance', 'azimuth', 'inclination'], set_title = True) plt.show() #### Principal retardance and 3D orientation in color orientation_3D_image = np.transpose(np.array([azimuth%(2*np.pi)/2/np.pi, inclination, np.clip((ne_map-no_map)*psz*2*np.pi/lambda_illu/np.pi/2*lambda_illu*1e3,0, 1.5)/1.5]),(3,1,2,0)) orientation_3D_image_RGB = wo.orientation_3D_to_rgb(orientation_3D_image, interp_belt = 20/180*np.pi, sat_factor = 1) plt.figure(figsize=(10,10)) plt.imshow(orientation_3D_image_RGB[z_layer], origin='lower') plt.figure(figsize=(10,10)) plt.imshow(orientation_3D_image_RGB[:,y_layer], origin='lower') plt.figure(figsize=(3,3)) wo.orientation_3D_colorwheel(wheelsize=128, circ_size=50, interp_belt=20/180*np.pi, sat_factor=1, discretize=True) plt.show() #### Angular histogram of 3D orientation wo.orientation_3D_hist(azimuth.flatten(), \ inclination.flatten(), \ np.abs(target).flatten(),\ bins=36, num_col=1, size=10, contour_level = 100, hist_cmap='gnuplot2', top_hemi=True) plt.show() ## Compute permittivity and scattering potential tensors ### assign the permittivity tensor according to the sample properties epsilon_mean = (ne_map**2 + no_map**2)/2 epsilon_del = (ne_map**2 - no_map**2)/2
]), (3, 1, 2, 0)) orientation_3D_image_RGB = wo.orientation_3D_to_rgb(orientation_3D_image, interp_belt=20 / 180 * np.pi, sat_factor=1) plt.figure(figsize=(15, 15)) plt.imshow(orientation_3D_image_RGB[z_layer], origin='lower') plt.figure(figsize=(15, 15)) plt.imshow(orientation_3D_image_RGB[:, y_layer], origin='lower', aspect=z_step / ps) # plot the top view of 3D orientation colorsphere plt.figure(figsize=(3, 3)) wo.orientation_3D_colorwheel(wheelsize=256, circ_size=50, interp_belt=20 / 180 * np.pi, sat_factor=1) plt.show() # ### Render 3D orientation with 2 channels (in-plane orientation and out-of-plane tilt) # in-plane orientation from matplotlib.colors import hsv_to_rgb I_hsv = np.transpose( np.array([ (azimuth[0]) % np.pi / np.pi, np.ones_like(retardance_pr_PT[0]), (np.clip(np.abs(retardance_pr_PT[0]), ret_min_color, ret_max_color) - ret_min_color) / (ret_max_color - ret_min_color) ]), (3, 1, 2, 0)) in_plane_orientation = hsv_to_rgb(I_hsv.copy())