diff --git a/luminescent/luminescent/sol.py b/luminescent/luminescent/sol.py index 08f2486..010b3c9 100644 --- a/luminescent/luminescent/sol.py +++ b/luminescent/luminescent/sol.py @@ -1,5 +1,4 @@ # import dill -import GPUtil from pprint import pprint import os import subprocess diff --git a/luminescent/luminescent/utils.py b/luminescent/luminescent/utils.py index 997cd56..24e0c21 100644 --- a/luminescent/luminescent/utils.py +++ b/luminescent/luminescent/utils.py @@ -145,7 +145,7 @@ def material_voxelate(c, dl, zmin, zmax, layers, layer_stack, path): os.makedirs(dir, exist_ok=True) with contextlib.redirect_stdout(None): stltovoxel.convert_file( - os.path.join(path, f'{k}_{l1}_{l2}.stl'), os.path.join(dir, 'output.png'), voxel_size=dl, pad=0) + os.path.join(path, f'{k}_{l1}_{l2}.stl'), os.path.join(dir, 'output.png'), voxel_size=dl/2, pad=0) layer_stack_info[k] = { "layer": (l1, l2), "zmin": d.zmin, diff --git a/luminescent/setup.py b/luminescent/setup.py index 13f554a..ca11ba7 100644 --- a/luminescent/setup.py +++ b/luminescent/setup.py @@ -2,7 +2,7 @@ setup( name='luminescent', # Your package name - version='0.4.1', # Your package version + version='0.4.3', # Your package version description='A description of your package', author='Paul Shen', author_email='pxshen@alumni.stanford.edu', diff --git a/src/pic/run.jl b/src/pic/run.jl index bf9a24e..43d58f4 100644 --- a/src/pic/run.jl +++ b/src/pic/run.jl @@ -55,6 +55,7 @@ function picrun(path; array=Array, kw...) for (k, v) = pairs(layer_stack) a = stack(map(sort(collect(readdir(joinpath(temp, string(k)), join=true)))) do file a = Nf.(Gray.(FileIO.load(file))) + a = downsample(a, 2) reverse(a', dims=2) end) # a = a[Base.OneTo.(min.(size(a), sz))...] diff --git a/src/sim/solve.jl b/src/sim/solve.jl index 64def75..34b17bd 100644 --- a/src/sim/solve.jl +++ b/src/sim/solve.jl @@ -20,14 +20,18 @@ function f2(((u, mf), p, (dt, field_diffdeltas, field_diffpadvals, source_instan bell(t, dt) # @time u = update(u, p, t, dt, field_diffdeltas, field_diffpadvals, source_instances;) u = update(u, p, t, dt, field_diffdeltas, field_diffpadvals, source_instances;) - mf += [[ + ks = @ignore_derivatives [keys(u.E)..., keys(u.H)...] + mf += [ begin - c = dt / T * cispi(-2(t - t0) / λ) - ks = @ignore_derivatives [keys(u.E)..., keys(u.H)...] - @nogradvars c, ks - namedtuple([k => (field(u, k, m) * c) for k = ks]) - end for λ = wavelengths(m) - ] for m = monitor_instances] + um = namedtuple(ks .=> field.((u,), ks, (m,))) + [ + begin + c = dt / T * cispi(-2(t - t0) / λ) + @nogradvars c + c * um + end for λ = wavelengths(m) + ] + end for m = monitor_instances] ((u, mf), p, (dt, field_diffdeltas, field_diffpadvals, source_instances), (t0, T, monitor_instances)) end