Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
paulxshen committed Dec 2, 2024
1 parent 46df20a commit 394a9fd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
10 changes: 7 additions & 3 deletions lumi/src/bend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import luminescent as lumi
import gdsfactory as gf

N = 2
N = 3

# radius = 2
# wavelengths = 1.1
Expand All @@ -10,9 +10,13 @@
radius = 2
wavelengths = lumi.wavelength_range(center=1.35, bandwidth=.4, length=3)
name = f"bend_R{radius}_multi"
radius = 5
wavelengths = 1.55
name = f"bend_R{radius}"

c = gf.components.bend_circular(radius=radius, allow_min_radius_violation=True)
c.plot()
lumi.write_sparams(c, name=name, wavelengths=wavelengths, keys=["2,1"], # same as keys=["o2@0,o1@0"]
dx=0.05, N=N)
sol = lumi.load_solution(name=name)
dx=0.05, N=N,
run=False)
# sol = lumi.load_solution(name=name)
10 changes: 4 additions & 6 deletions lumi/src/luminescent/gplugins/luminescent/sparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ def sparams_problem(c: gf.Component,
N=3, layer_stack=LAYER_STACK,
study="sparams",
**kwargs):

d = 2 if N else 3
prob = dict()
ports = [p.name for p in c.get_ports_list(prefix="o")]

if not entries:
Expand All @@ -32,11 +29,11 @@ def sparams_problem(c: gf.Component,
for o in ports:
keys.append(f"o,i")

if type(wavelengths) not in [list, tuple]:
if type(wavelengths) not in [list, tuple, np.ndarray]:
wavelengths = [wavelengths]
else:
wavelengths = wavelengths
wavelengths = adjust_wavelengths(wavelengths)
wavelengths, T = adjust_wavelengths(wavelengths)
for w in wavelengths:
for k in keys:
entries.append([w, *unpack_sparam_key(k)])
Expand Down Expand Up @@ -93,7 +90,8 @@ def sparams_problem(c: gf.Component,
runs=runs, margin=margin,
layer_stack=layer_stack, N=N, **kwargs)
prob["wavelengths"] = wavelengths

prob["Ttrans"] = None
prob["Tss"] = T if len(wavelengths) > 1 else None
return prob

# l = [k for k in imow if port_number(k) == pi]
Expand Down
4 changes: 2 additions & 2 deletions lumi/src/luminescent/gplugins/luminescent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def wavelength_range(center, bandwidth, length=3):

def adjust_wavelengths(wavelengths):
if len(wavelengths) == 1:
return wavelengths
return wavelengths, 1
wavelengths = sorted(set(wavelengths), reverse=True)
wl = wavelengths[round((len(wavelengths)-1)/2)]
freqs = [wl/w for w in wavelengths]
Expand All @@ -202,4 +202,4 @@ def adjust_wavelengths(wavelengths):
wavelengths = [wl/f for f in reversed(freqs)]
print(
f"wavelengths has been adjusted to facilitate simulation:\n{wavelengths}")
return wavelengths
return wavelengths, nresfreq
7 changes: 4 additions & 3 deletions lumi/src/straight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from luminescent import MATERIALS
from gdsfactory.generic_tech import LAYER, LAYER_STACK
import gdsfactory as gf
import pprint as pp
import numpy as np

c = gf.components.straight(length=1, width=0.5, layer=LAYER.WG)
wavelengths = [1.1, 1.3, 1.5]
# wavelengths = [1.1, 1.3, 1.5]
wavelengths = np.linspace(1.45, 1.65, 5)
lumi.write_sparams(c, wavelengths=wavelengths, keys=["o2@0,o1@0"], # same as keys=["o2@0,o1@0"]
name="straight",
# core_layer=LAYER.WG, bbox_layer=LAYER.WAFER, # defaults
# layer_stack=LAYER_STACK, materials=MATERIALS, # defaults
dx=0.05, N=3, run=False) # , gpu="CUDA",) # or gpu=None
sol = lumi.lumi_solution()
# sol = lumi.lumi_solution()
5 changes: 3 additions & 2 deletions src/pictest.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ENV["JULIA_PKG_PRECOMPILE_AUTO"] = 0
include("main.jl")

picrun(lastrun())#; gpu_backend="CUDA")
# picrun(lastrun())#; gpu_backend="CUDA")

# picrun(lastrun("bend_R5"))
picrun(lastrun("straight"); N=2)
# picrun(lastrun("bend_R2__1.1"); N=2)
# picrun(lastrun("bend_R2_multi"); N=2)
# picrun(lastrun("straight"); N=2)
# picrun(lastrun("tiny"))

# picrun(lastrun("mode_converter");)# eta=0.4)
Expand Down

0 comments on commit 394a9fd

Please sign in to comment.