Skip to content

Commit 13750bf

Browse files
committed
format files
1 parent f64f1d6 commit 13750bf

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

ext/QuantumToolboxMakieExt.jl

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ Initialize the `Scene` object for Bloch sphere visualization.
367367
Sets up the `3D` coordinate system with appropriate limits and view angles.
368368
"""
369369
function _setup_bloch_plot!(b::Bloch; kwargs...)
370-
_limits = haskey(kwargs, :limits) ? kwargs[:limits] : (-b.frame_limit, b.frame_limit, -b.frame_limit, b.frame_limit, -b.frame_limit, b.frame_limit)
370+
_limits =
371+
haskey(kwargs, :limits) ? kwargs[:limits] :
372+
(-b.frame_limit, b.frame_limit, -b.frame_limit, b.frame_limit, -b.frame_limit, b.frame_limit)
371373
_protrusions = haskey(kwargs, :protrusions) ? kwargs[:protrusions] : (0, 0, 0, 0)
372374
_viewmode = haskey(kwargs, :viewmode) ? kwargs[:viewmode] : :fit
373375
if haskey(kwargs, :backgroundcolor)
@@ -376,12 +378,8 @@ function _setup_bloch_plot!(b::Bloch; kwargs...)
376378
bg_color = parse(RGBf, b.frame_color)
377379
_backgroundcolor = RGBAf(bg_color, b.frame_alpha)
378380
end
379-
scene = Scene(
380-
limits = _limits,
381-
protrusions = _protrusions,
382-
viewmode = _viewmode,
383-
backgroundcolor = _backgroundcolor,
384-
)
381+
scene =
382+
Scene(limits = _limits, protrusions = _protrusions, viewmode = _viewmode, backgroundcolor = _backgroundcolor)
385383

386384
# Camera radius and angles
387385
length(b.view) == 2 || throw(ArgumentError("The length of `Bloch.view` must be 2."))
@@ -419,15 +417,31 @@ function _draw_bloch_sphere!(b::Bloch, scene)
419417
x_line = [radius * sin(ϕ) * cos(θi) for ϕ in φ_curve]
420418
y_line = [radius * sin(ϕ) * sin(θi) for ϕ in φ_curve]
421419
z_line = [radius * cos(ϕ) for ϕ in φ_curve]
422-
lines!(scene, x_line, y_line, z_line; color = RGBAf(0.5, 0.5, 0.5, line_alpha), linewidth = 1, transparency = true)
420+
lines!(
421+
scene,
422+
x_line,
423+
y_line,
424+
z_line;
425+
color = RGBAf(0.5, 0.5, 0.5, line_alpha),
426+
linewidth = 1,
427+
transparency = true,
428+
)
423429
end
424430
φ_vals = range(0.0f0, π, length = n_lat + 2)
425431
θ_curve = range(0.0f0, 2π, length = 600)
426432
for ϕ in φ_vals
427433
x_ring = [radius * sin(ϕ) * cos(θi) for θi in θ_curve]
428434
y_ring = [radius * sin(ϕ) * sin(θi) for θi in θ_curve]
429435
z_ring = fill(radius * cos(ϕ), length(θ_curve))
430-
lines!(scene, x_ring, y_ring, z_ring; color = RGBAf(0.5, 0.5, 0.5, line_alpha), linewidth = 1, transparency = true)
436+
lines!(
437+
scene,
438+
x_ring,
439+
y_ring,
440+
z_ring;
441+
color = RGBAf(0.5, 0.5, 0.5, line_alpha),
442+
linewidth = 1,
443+
transparency = true,
444+
)
431445
end
432446
end
433447

0 commit comments

Comments
 (0)