wo.plot_multicolumn([del_f_component[0,:,:,z_layer], del_f_component[1,:,:,z_layer], del_f_component[2,:,:,z_layer], del_f_component[3,:,:,z_layer],\
                     del_f_component[4,:,:,z_layer], del_f_component[5,:,:,z_layer], del_f_component[6,:,:,z_layer]], origin='lower', num_col=4, titles=[r'$f_{0r}$', r'$f_{0i}$', r'$f_{1c}$',r'$f_{1s}$',\
                                                                                                                                                         r'$f_{2c}$', r'$f_{2s}$', r'$f_{3}$'],\
                                                                                                                                                         size=5, set_title = True)
plt.show()

#####################################################################
# Forward model of uPTI (polarization-diverse, illumination-diverse,#
# depth-diverse acquisition)                                        #
#####################################################################


# DPC + BF illumination + PolState (sector illumination)

xx, yy, fxx, fyy = wo.gen_coordinate((N, M), ps)
Pupil_obj = wo.gen_Pupil(fxx, fyy, NA_obj / n_media, lambda_illu / n_media)
Source_support = wo.gen_Pupil(fxx, fyy, NA_illu / n_media, lambda_illu / n_media)

NAx_coord = lambda_illu / n_media * fxx
NAy_coord = lambda_illu / n_media * fyy

rotation_angle = [0, 45, 90, 135, 180, 225, 270, 315]

Source = np.zeros((len(rotation_angle) + 1, N, M))
Source_cont = np.zeros_like(Source)

Source_BF = wo.gen_Pupil(fxx, fyy, NA_illu / n_media / 2, lambda_illu / n_media)

Source_cont[-1] = Source_BF.copy()
Source[-1] = wo.Source_subsample(Source_BF, NAx_coord, NAy_coord, subsampled_NA=0.1 / n_media)
N_full = 1024
M_full = 1224
overlapping_range = [20, 100]
max_image_size = [300, 300]
N_edge, N_space, M_space = wo.generate_FOV_splitting_parameters(
    (N_full, M_full), overlapping_range, max_image_size)

# Create sub-FOV list
Ns = N_space + N_edge
Ms = M_space + N_edge
ns, ms = wo.generate_sub_FOV_coordinates((N_full, M_full), (N_space, M_space),
                                         (N_edge, N_edge))
os.system('mkdir ' + output_path)

# ### Initialize the processing (Source, OTF, ...)
xx, yy, fxx, fyy = wo.gen_coordinate((Ns, Ms), ps)
rotation_angle = [
    180 - 22.5, 225 - 22.5, 270 - 22.5, 315 - 22.5, 0 - 22.5, 45 - 22.5,
    90 - 22.5, 135 - 22.5
]
sector_angle = 45
Source_BF = wo.gen_Pupil(fxx, fyy, NA_obj / n_media / 2, lambda_illu / n_media)
Source = wo.gen_sector_Pupil(fxx, fyy, NA_obj / n_media, lambda_illu / n_media,
                             sector_angle, rotation_angle)
Source.append(Source_BF)
Source = np.array(Source)
Source_PolState = np.zeros((len(Source), 2), complex)
for i in range(len(Source)):
    Source_PolState[i, 0] = E_in[0]
    Source_PolState[i, 1] = E_in[1]