-
How can i plot sim.electric_field in 3D, and is it possible to set values above and below certain range transparent ? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Not with the current plot recipes, but you can have a lot at either Plots.jl or Makie.jl, to see if they allow to plot this. You would then need to access the (probably unevenly spaced) grid points and the data using If you have an example plot that you want to reproduce, I also can look into this myself and see if I can provide something |
Beta Was this translation helpful? Give feedback.
-
something like the attached files (oblique multiple cross-section ) or in 3d plot where min max value can be threshold simplest recipe , will be much appreciated |
Beta Was this translation helpful? Give feedback.
-
I just had a quick look at this, and can provide you something. using SolidStateDetectors
using Plots; pyplot()
using LinearAlgebra
using Unitful
T = Float32
sim = Simulation{T}(SSD_examples[:CGD])
simulate!(sim)
clims = (0,1000)
# Cross-section in xz-plane at y = 0
y = 0
yidx = SolidStateDetectors.searchsortednearest(sim.electric_field.grid[2], T(y))
y = sim.electric_field.grid[2][yidx]
xs = sim.electric_field.grid[1].ticks
ys = sim.electric_field.grid[2].ticks
zidx = findall(z -> z >= -0.00275, sim.electric_field.grid[3].ticks)
zs = sim.electric_field.grid[3].ticks[zidx]
xx, yy, zz = xs' .* ones(length(zs)) * u"m", (xs' .* zeros(length(zs)) .+ y) * u"m", zs .* ones(length(xs))' * u"m"
surface(xx, yy, zz, fill_z = clamp.(norm.(sim.electric_field.data[:,yidx,zidx])' ./ 1000, clims...), clims = clims)
# Cross-section in xy-plane at z = -0.00275
z = -0.00275
zidx = SolidStateDetectors.searchsortednearest(sim.electric_field.grid[3], T(z))
z = sim.electric_field.grid[3][zidx]
xs = sim.electric_field.grid[1].ticks
yidx = findall(y -> y <= 0, sim.electric_field.grid[2].ticks)
ys = sim.electric_field.grid[2].ticks[yidx]
zs = sim.electric_field.grid[3].ticks
xx, yy, zz = xs' .* ones(length(ys)) * u"m", (ones(length(xs))' .* ys) * u"m", (xs' .* zeros(length(ys)) .+ z) * u"m"
surface!(xx, yy, zz, fill_z = clamp.(norm.(sim.electric_field.data[:,yidx,zidx])' ./ 1000, clims...), clims = clims) The |
Beta Was this translation helpful? Give feedback.
-
If this turns out to be useful, we can think about including a plot recipe for plotting cross-sections of the potentials and fields in the SolidStateDetectors package. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the right direction , this looks good. |
Beta Was this translation helpful? Give feedback.
-
No worries! |
Beta Was this translation helpful? Give feedback.
I just had a quick look at this, and can provide you something.
Feel free to modify it accordingly: