mirror of
https://github.com/edoverg/MPID.git
synced 2026-10-14 23:26:38 +00:00
several modification introduced: fixed dimensions to micrometers, introduced ego loop
This commit is contained in:
+24
-20
@@ -5,20 +5,23 @@ if not os.path.exists("results"):
|
||||
os.makedirs("results")
|
||||
#Space grid definition
|
||||
N = 1025
|
||||
unit_cell_pitch = 700e-9
|
||||
unit_cell_pitch = 0.700
|
||||
|
||||
n0 = 1.45
|
||||
n1 = 1.0
|
||||
n2 = 1.45
|
||||
mat_refr_index = np.array([n0, n1, n2])
|
||||
|
||||
d0 = 476e-6 #propagation distance: source - MS1 [m]
|
||||
d1 = 510e-6 #propagation distance: MS1 - MS2 [m]
|
||||
d2 = d0 #propagation distance: MS2 - target [m]
|
||||
|
||||
#d0 = 400 #propagation distance: source - MS1 [um] NO FILT
|
||||
#d1 = 280 #propagation distance: MS1 - MS2 [um] NO FILT
|
||||
d0 = 535 #propagation distance: source - MS1 [um] FILTERED
|
||||
d1 = 460 #propagation distance: MS1 - MS2 [um] FILTERED
|
||||
d2 = d0 #propagation distance: MS2 - target [um]
|
||||
d = np.array([d0, d1, d2])
|
||||
|
||||
ms_max_available_diameter = 122e-6 #[um]
|
||||
output_fiber_core_diameter = 19e-6 #[um]
|
||||
ms_max_available_diameter = 122 #[um]
|
||||
output_fiber_core_diameter = 19 #[um]
|
||||
opt_max_eval = 140
|
||||
|
||||
space_grid = pid.SpaceGrid(
|
||||
@@ -30,38 +33,39 @@ space_grid = pid.SpaceGrid(
|
||||
)
|
||||
|
||||
#define the source
|
||||
beam_waist = 5.2e-6
|
||||
beam_waist = 5.2
|
||||
gaussian_field = np.exp(-(space_grid.get_rho())**2 / (beam_waist)**2) #Gaussian input field, flattened
|
||||
gaussian_field_normalized = (gaussian_field / np.sqrt(np.sum(np.abs(gaussian_field)**2))) #normalize the input field to have power = 1
|
||||
|
||||
wavelengths_to_test_nm = [1550] #[nm]
|
||||
central_wavelength_m = 1550 * space_grid.nm
|
||||
sources = [pid.Source(input_field=gaussian_field_normalized,
|
||||
wavelengths_to_test_um = [1.530,1.550,1.570] #[um]
|
||||
source_files = ["fiber_modes/LP01_field_distribution_lda_1530_N_1025.npy",
|
||||
"fiber_modes/LP01_field_distribution_lda_1550_N_1025.npy",
|
||||
"fiber_modes/LP01_field_distribution_lda_1570_N_1025.npy"]
|
||||
sources = [pid.Source(input_field=np.load(file),
|
||||
wavelength=wvl,
|
||||
space_grid=space_grid,
|
||||
wvl_unit_measure=space_grid.nm) for wvl in wavelengths_to_test_nm]
|
||||
field_norm=True) for file, wvl in zip(source_files, wavelengths_to_test_um)]
|
||||
|
||||
sources[0].plot2D(plot_zoom_x=38,plot_zoom_y=38,choose_quantity='amplitude', save_name='results/input_field')
|
||||
#sources[0].plot2D(plot_zoom_x=38,plot_zoom_y=38,choose_quantity='amplitude', save_name='results/input_field')
|
||||
#define targets
|
||||
#import field data from files and create target objects
|
||||
target_files = ["fiber_modes/LP21_field_distribution_lda_1550_N_1025.npy",]
|
||||
target_files = ["fiber_modes/LP21_field_distribution_lda_1530_N_1025.npy",
|
||||
"fiber_modes/LP21_field_distribution_lda_1550_N_1025.npy",
|
||||
"fiber_modes/LP21_field_distribution_lda_1570_N_1025.npy"]
|
||||
|
||||
target_fields = [np.load(file) for file in target_files]
|
||||
|
||||
targets = [pid.Target(input_field=target_fields[i],
|
||||
associated_source=sources[i],
|
||||
wavelength=wvl,
|
||||
space_grid=space_grid,
|
||||
wvl_unit_measure=space_grid.nm,
|
||||
field_norm = True) for i, (file, wvl) in enumerate(zip(target_files, wavelengths_to_test_nm))]
|
||||
field_norm = True) for i, (file, wvl) in enumerate(zip(target_files, wavelengths_to_test_um))]
|
||||
|
||||
targets[0].plot2D(plot_zoom_x=38,plot_zoom_y=38,choose_quantity='amplitude', save_name='results/target_field')
|
||||
#targets[0].plot2D(plot_zoom_x=38,plot_zoom_y=38,choose_quantity='amplitude', save_name='results/target_field')
|
||||
|
||||
#setup the simulation instance
|
||||
simulation = pid.Simulation(
|
||||
sources=sources,
|
||||
targets=targets,
|
||||
central_wavelength=central_wavelength_m,
|
||||
central_wavelength=wavelengths_to_test_um[0],
|
||||
space_grid=space_grid,
|
||||
n_cpu=1
|
||||
)
|
||||
@@ -72,7 +76,7 @@ simulation.set_optimization(
|
||||
ms_max_avail_diameter=ms_max_available_diameter,
|
||||
phase_mask_init_size=output_fiber_core_diameter/3,
|
||||
opt_max_eval=opt_max_eval,
|
||||
conic_filter_radius=1.5e-6,
|
||||
conic_filter_radius=1.0,
|
||||
)
|
||||
|
||||
simulation.run()
|
||||
|
||||
Reference in New Issue
Block a user