-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_mask_design_fresnel.py
47 lines (31 loc) · 1.52 KB
/
example_mask_design_fresnel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from beamshapy.BeamShaper import BeamShaper
from beamshapy.helpers import load_yaml_config, save_input_beam
from LightPipes import mm, um,Power, Intensity
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
simulation_config = load_yaml_config("./config/simulation.yml")
input_beam_config = load_yaml_config("./config/input_beam.yml")
optical_system_config = load_yaml_config("./config/optical_system.yml")
results_directory = "experiment_results"
beam_shaper = BeamShaper(simulation_config,input_beam_config, optical_system_config)
# Generate System Input Beam Field
input_field = beam_shaper.generate_input_beam(input_beam_config)
# Fresnel Lens parameters
radius = 1*mm
parabola_coef = 10**6.62
hyper_gauss_order = 12
# Generate Target Intensity Profile
target_intensity = beam_shaper.intensity_generator.generate_target_intensity_profile(profile_type="Fresnel Lens",
radius= radius,
parabola_coef = parabola_coef,
hyper_gauss_order = hyper_gauss_order)
plt.imshow(target_intensity)
plt.show()
plt.plot(target_intensity[target_intensity.shape[0]//2,:])
plt.show()
img = Image.fromarray(target_intensity*255)
# Convert to a supported mode (e.g., 'RGB')
converted_image = img.convert('L')
# Save the converted ima
converted_image.save('fresenl_lens_3aillettes.png')