DeMarcoLab / juno

juno is a simulation package for optical system design using full wave propagation.
https://demarcolab.github.io/juno
MIT License
59 stars 2 forks source link

Define lens using coeffecient #38

Open patrickcleeve2 opened 2 years ago

patrickcleeve2 commented 2 years ago

exclusive definition with height

DavidDierickx commented 2 years ago

Snippet:

def create_lens(pixel_size, diameter, coefficient, escape_path, exponent): n_pixels = utils._calculate_num_of_pixels(diameter, pixel_size) radius = diameter / 2 n_pixels_in_radius = n_pixels // 2 + 1 radius_px = np.linspace(0, radius, n_pixels_in_radius)

----- actual changes here -----
profile = -coefficient * radius_px ** exponent
profile -= np.min(profile)
-------------------------------

profile = np.append(profile, np.zeros(int(escape_path * len(profile))))
profile = np.append(np.flip(profile[1:]), profile)
profile = np.expand_dims(profile, 0).astype(np.float32)