update(skew_stats): analysis on 404

This commit is contained in:
Wataru Otsubo 2024-12-17 20:58:26 +09:00
parent 1421cfbcfa
commit b89f0e595b
2 changed files with 932 additions and 916 deletions

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 278 KiB

View file

@ -340,7 +340,7 @@ fig_skew_stats = let
marker = :x,
color = (Makie.wong_colors()[1], 0.8),
axis = (
title = "mean vs std of multiple skew measurements for same PS-Boards",
title = "mean vs std of multiple skew measurements for same PS Boards",
xlabel = "mean / ns",
ylabel = "std / ns",
),
@ -366,7 +366,7 @@ let
marker = :x,
color = (Makie.wong_colors()[1], 0.8),
axis = (
title = "mean vs std of multiple skew measurements for same PS-Boards",
title = "mean vs std of multiple skew measurements for same PS Boards",
xlabel = "mean / ns",
ylabel = "std / ns",
limits = ((-0.6, 1.2), (-0.01, 0.09)),
@ -411,7 +411,7 @@ let
marker = :x,
color = (Makie.wong_colors()[1], 0.8),
axis = (
title = "mean vs std of multiple skew measurements for same PS-Boards",
title = "mean vs std of multiple skew measurements for same PS Boards",
xlabel = "mean / ns",
ylabel = "std / ns",
),
@ -641,7 +641,7 @@ md"""
- 382: ファームウェア最新
"""
# ╔═╡ 446a1b05-b24a-46d8-94a1-bd449245075d
# ╔═╡ 0dd4c5fe-71d0-45d0-897e-51d1aa06bd3b
df_extra_measurements = let
df_configs = DataFrame(
position_name = ["B-$(i)-$(j)" for j in 1:9 for i in 0:1],
@ -667,22 +667,41 @@ df_extra_measurements = let
],
position = [1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 17, 9, 18],
)
transform!(
df_configs,
[:psbid, :position] =>
ByRow(
(psbid, position) -> begin
runid = 382
clkfile = "../test/input/slavelogs/main/$(psbid)_$(runid)_clk.txt"
skew, width =
PSBoardDataBase.ClockParser.get_skew_and_riseup(clkfile)
offset = qaqc_positions.rising_ns[findfirst(
==(position),
qaqc_positions.id,
)]
[skew - offset, width]
end,
) => [:skew, :width],
@info "" df_configs
combine(
groupby(df_configs, :psbid),
AsTable(:) =>
(
sdf -> begin
@assert nrow(sdf) == 1
map([382, 404]) do runid
clkfile = "../test/input/slavelogs/main/$(sdf.psbid[1])_$(runid)_clk.txt"
skew, width =
PSBoardDataBase.ClockParser.get_skew_and_riseup(clkfile)
offset = qaqc_positions.rising_ns[findfirst(
==(sdf.position[1]),
qaqc_positions.id,
)]
return (;
position_name = sdf.position_name |> first,
psbid = sdf.psbid |> first,
position = sdf.position |> first,
skew = skew - offset,
width,
runid,
campaign_id = 6,
)
end
end
) => [
:position_name,
:psbid,
:position,
:skew,
:width,
:runid,
:campaign_id,
],
)
end
@ -690,45 +709,27 @@ end
df_compare = let
df_old_measurements =
filter(:psbid => in(df_extra_measurements.psbid), df_skews_selected)
df_combined = leftjoin!(
df_old_measurements,
df_extra_measurements,
on = :psbid,
makeunique = true,
left_cols = [:psbid, :skew, :width, :runid, :campaign_id]
df = vcat(
select!(df_old_measurements, left_cols),
select(df_extra_measurements, left_cols),
)
rename!(
df_combined,
:skew => :skew_old,
:width => :width_old,
:runid => :runid_old,
:campaign_id => :campaign_id_old,
:skew_1 => :skew_new,
:width_1 => :width_new,
)
select!(
df_combined,
[
:psbid,
:runid_old,
:campaign_id_old,
:skew_old,
:width_old,
:skew_new,
:width_new,
],
)
dropmissing!(df_combined)
sort!(df, :runid)
end
# ╔═╡ 3266d1fd-b8f0-4eb0-9a8e-2050bc9a626f
let
fig = Figure(size = (600, 500))
grd1 = fig[1, 1] = GridLayout()
Label(grd1[0, 1:2], "skew firmware dependency", tellwidth = false)
Label(
grd1[0, 1:2],
"comparison of multiple measurements of clock skew for 18 PS Boards",
tellwidth = false,
)
ax1 = Axis(
grd1[1, 1],
limits = ((-0.15, 1.15), nothing),
xticks = (0:1, ["old", "new(382)"]),
limits = ((-0.15, 2.35), nothing),
xticks = (0:2, ["old", "new(382)", "new(404)"]),
ylabel = "skew / ns",
)
ax2 = Axis(
@ -741,39 +742,50 @@ let
yminorgridvisible = true,
)
colsize!(grd1, 2, Relative(0.4))
for row in eachrow(df_compare)
for (key, sdf) in pairs(groupby(df_compare, :psbid))
@assert sdf.runid[2] == 382 && sdf.runid[3] == 404
scatterlines!(
ax1,
0:1,
[row.skew_old, row.skew_new],
color = Makie.wong_colors()[row.campaign_id_old],
0:1:2,
sdf.skew,
color = Makie.wong_colors()[sdf.campaign_id[1]],
alpha = 0.7,
)
scatter!(
ax2,
row.campaign_id_old,
row.skew_new - row.skew_old,
sdf.campaign_id[1],
mean(@view(sdf.skew[2:3])) - sdf.skew[1],
marker = :x,
color = Makie.wong_colors()[row.campaign_id_old],
color = Makie.wong_colors()[sdf.campaign_id[1]],
alpha = 0.7,
)
errorbars!(
ax2,
[sdf.campaign_id[1]],
[mean(@view(sdf.skew[2:3])) - sdf.skew[1]],
[std(@view(sdf.skew[2:3]))],
color = Makie.wong_colors()[sdf.campaign_id[1]],
alpha = 0.4,
whiskerwidth = 5,
)
text!(
ax1,
2,
sdf.skew |> last,
text = string(sdf.psbid[1]),
color = (:black, 0.5),
align = (:left, :center),
)
text!(
ax2,
sdf.campaign_id[1],
mean(@view(sdf.skew[2:3])) - sdf.skew[1],
text = string(sdf.psbid[1]),
color = (:black, 0.5),
align = (:left, :center),
)
end
text!(
ax1,
fill(1, nrow(df_compare)),
df_compare.skew_new,
text = string.(df_compare.psbid),
color = (:black, 0.5),
align = (:left, :center),
)
text!(
ax2,
df_compare.campaign_id_old,
df_compare.skew_new .- df_compare.skew_old,
text = string.(df_compare.psbid),
color = (:black, 0.5),
align = (:left, :center),
)
campaigns = df_compare.campaign_id_old |> unique |> sort!
campaigns = df_compare.campaign_id |> unique |> sort!
Legend(
grd1[2, 1],
[
@ -1073,10 +1085,7 @@ let
fig[1, 1],
title = "distribution of rise up spans",
xlabel = "time / ns",
xticks = (
bins,
string.(round.(bins, digits = 3)),
),
xticks = (bins, string.(round.(bins, digits = 3))),
xticklabelrotation = π / 3,
)
h1 = hist!(
@ -1257,7 +1266,7 @@ end
# ╠═939aba6b-b03c-42b6-83b3-9cea5f4eb858
# ╠═aa9b78bc-8d66-4df2-bd06-1cbf21190488
# ╠═76f44129-34c6-451d-af3f-4593dd1dda5c
# ╠═446a1b05-b24a-46d8-94a1-bd449245075d
# ╠═0dd4c5fe-71d0-45d0-897e-51d1aa06bd3b
# ╠═148e42fc-d168-4e07-b4f8-f9c3f8c18efc
# ╠═3266d1fd-b8f0-4eb0-9a8e-2050bc9a626f
# ╠═660f2bd1-d4bc-45a8-9cf6-4e875aa9f7a2