update: skew_stats (add counts search)

This commit is contained in:
Wataru Otsubo 2024-10-07 10:34:30 +09:00
parent 218349a126
commit 4f0dad1c03
2 changed files with 88 additions and 36 deletions

File diff suppressed because one or more lines are too long

View file

@ -123,8 +123,15 @@ df_rawskews =
(
file -> begin
skew_width = PSBoardDataBase.ClockParser.get_skew_and_riseup(file)
riseup = PSBoardDataBase.ClockParser.count_riseup(file)
psbid, runid = parse_filename(file)
(psbid = psbid, runid = runid, skew = skew_width[1], width = skew_width[2])
(
psbid = psbid,
runid = runid,
skew = skew_width[1],
width = skew_width[2],
riseup = riseup,
)
end
) |>
filter(
@ -183,9 +190,10 @@ md"""
# ╔═╡ 420dce0e-4757-48d9-84ec-7ddfac2fdff6
let
skew_widths = df_skews.width |> skipmissing |> collect
bins = range(0, maximum(skew_widths), step = 1 / 57)# .- 0.01
hist(
skew_widths,
bins = range(minimum(skew_widths), maximum(skew_widths), step = 1 / 57),
bins = bins,
bar_labels = :y,
label_size = 14,
label_formatter = x -> "$(round(Int, x))",
@ -194,6 +202,8 @@ let
xlabel = "rise up span / ns",
ylabel = "counts",
limits = ((0, 0.18), (0, nothing)),
# xticks = (bins, string.(round.(bins, digits = 3))),
# xticklabelrotation = π / 3,
),
)
end
@ -206,6 +216,9 @@ md"""
この結果を元に、クロック試験のしきい値は$(round(9 * 1 / 57; digits = 2))ns以上に設定
"""
# ╔═╡ 875bec26-e576-4f48-ba14-464bce503d75
filter(:width => (x -> ismissing(x) || x < 0.06), df_skews)
# ╔═╡ ec774495-c0be-47a4-9d2c-b48159c07013
md"""
## 各PSBoardごとの統計
@ -273,12 +286,9 @@ end
# ╔═╡ eae649db-6b2b-4530-83a8-3438f29423cc
let
df = filter(
:psboard_id => in(df_skew_stats_abnormals.psbid),
qaqc_single_results,
)
select!(df, [:runid, :psboard_id, :lvds_tx_skew, :note])
df
df = filter(:psboard_id => in(df_skew_stats_abnormals.psbid), qaqc_single_results)
select!(df, [:runid, :psboard_id, :lvds_tx_skew, :note])
df
end
# ╔═╡ d607e10e-854f-4652-9a34-9e22a188e315
@ -358,25 +368,41 @@ df_skews_selected = combine(
all(ismissing, sdf.skew) && @info "" sdf
if nrow(sdf) == 1
@assert sdf.skew |> first |> !ismissing
(skew = sdf.skew |> first, width = sdf.width |> first)
(
skew = sdf.skew |> first,
width = sdf.width |> first,
riseup = sdf.riseup |> first,
)
else
if sdf.psbid[1] == 291
df = filter(:runid => ==(94), sdf)
@assert nrow(df) == 1
(skew = df.skew |> first, width = sdf.width |> first)
(
skew = df.skew |> first,
width = sdf.width |> first,
riseup = sdf.riseup |> first,
)
elseif sdf.psbid[1] == 460
df = filter(:runid => ==(132), sdf)
@assert nrow(df) == 1
(skew = df.skew |> first, width = sdf.width |> first)
(
skew = df.skew |> first,
width = sdf.width |> first,
riseup = sdf.riseup |> first,
)
elseif sdf.psbid[1] == 545
@error "temp"
df = filter(:runid => ==(132), sdf)
@assert nrow(df) == 1
(skew = df.skew |> first, width = sdf.width |> first)
(
skew = df.skew |> first,
width = sdf.width |> first,
riseup = sdf.riseup |> first,
)
else
# assume that runid is chronological
i = argmax(sdf.runid .|> (id -> ismissing(id) ? -1 : id))
(skew = sdf.skew[i], width = sdf.width[i])
(skew = sdf.skew[i], width = sdf.width[i], riseup = sdf.riseup[i])
end
end
end,
@ -391,9 +417,20 @@ let
fig
end
# ╔═╡ d92e0f9f-ed53-4ad6-a390-5a395e8ab8bc
md"""
#### 異常に小さい値 (psbid: 444)
- 出荷済み
"""
# ╔═╡ e9964184-1a2a-4ab9-bc22-2705a25393ec
filter(:skew => (x -> !ismissing(x) && x < -3), df_skews_selected)
# ╔═╡ bedf8dff-e109-4757-82e5-3232fcad752d
md"""
#### 欠損値(psbid: 255)
"""
# ╔═╡ f2d0ea9b-ede7-496a-8d1f-9f748f9d1666
transform(
filter(:skew => ismissing, df_skews_selected),
@ -408,6 +445,21 @@ md"""
- Si not locked
"""
# ╔═╡ 106b8abe-0040-48f1-b663-c00ca7673520
filter(:riseup => !=(1), df_skews_selected)
# ╔═╡ a06d16ee-a4be-40de-8dac-fd818754373c
md"""
#### 立ち上がりが複数回(psbid: 255, 435, 444, 460)
skew結果として使った測定について、立ち上がり回数が1ではないもののリスト
##### psbid: 435
- 立ち上がり後途中で何故か0が入ってる
- 出荷済み
"""
# ╔═╡ 4d809d8c-35d5-44b9-89b9-a43dbc8e6206
PSBoardDataBase.ClockParser.count_riseup("../test/input/slavelogs/main/436_103_clk.txt")
# ╔═╡ 9f3f780d-da6e-44b4-a002-c2f088681e9c
df_skews_selected_sorted = let
df = sort(df_skews_selected, :skew)
@ -433,17 +485,13 @@ let
id_rand_typical = rand(rng, 1:nrow(df_typical))
first(df_normal).psbid, last(df_normal).psbid, df_typical[id_rand_typical, :psbid]
end
psbid_with_lines = [
psbid_width_max,
psbid_width_min,
psbid_width_typical,
]
psbid_with_lines = [psbid_width_max, psbid_width_min, psbid_width_typical]
fig = Figure()
ax = Axis(
fig[1, 1],
title = "clock turn on curves",
subtitle = "aligned on the last count = 0 points",
subtitle = "aligned on the last count = 0 points",
xlabel = "ns",
ylabel = "counts",
limits = ((-0.05, 0.15), (0, 1000)),
@ -473,33 +521,31 @@ let
# df = filter(:psbid => ==(psbid), df_skews_selected_sorted)
# @assert nrow(df) == 1 "nrow: $(nrow(df)), psbid: $(psbid)"
# df.skew[1] +
qaqc_positions.rising_ns[single_runs.position[1]]
qaqc_positions.rising_ns[single_runs.position[1]]
end
if psbid in psbid_with_lines
points =
eachline(file) .|>
PSBoardDataBase.ClockParser._parse_line .|>
(x -> (x[1] - offset_pos, x[2]))
id_first_over0 = findfirst(points) do ((time, count))
count > 0
end
@info "" points[id_first_over0] points[id_first_over0 - 1]
points = map(points) do ((time, count))
time - points[id_first_over0][1], count
end
stds = map(points) do ((time, count))
sqrt(count * (1000 - count) / 1000)
end
id_first_over0 = findfirst(points) do ((time, count))
count > 0
end
points = map(points) do ((time, count))
time - points[id_first_over0][1], count
end
stds = map(points) do ((time, count))
sqrt(count * (1000 - count) / 1000)
end
label, color = if psbid == psbid_width_max
"lomgest ($psbid)", (:red, 0.8)
elseif psbid == psbid_width_min
"shortest ($psbid)", (:blue, 0.8)
elseif psbid == psbid_width_typical
"typical ($psbid)", (:green, 0.8)
elseif psbid == psbid_width_typical
"typical ($psbid)", (:green, 0.8)
end
scatterlines!(ax, points, label = label, color = color)
@info "" first.(points) stds
errorbars!(ax, points, stds, whiskerwidth = 10, color = color)
errorbars!(ax, points, stds, whiskerwidth = 10, color = color)
end
end
axislegend(ax, position = :rb)
@ -537,6 +583,7 @@ end
# ╠═420dce0e-4757-48d9-84ec-7ddfac2fdff6
# ╠═99902640-fee3-4502-9c7e-cb08834bad0b
# ╠═c79c6684-1b03-41b5-aa90-ef8c7a8eb69c
# ╠═875bec26-e576-4f48-ba14-464bce503d75
# ╟─ec774495-c0be-47a4-9d2c-b48159c07013
# ╠═d082e07c-3b42-4362-bebf-63356979a49b
# ╠═25688d24-5aee-43d3-aff9-b9efa0556070
@ -553,9 +600,14 @@ end
# ╟─26976b6c-3954-4a41-a99b-c1aaebdc645d
# ╠═38d472ca-6347-4096-828d-fd1256130a59
# ╠═310710da-ebb2-4f54-b238-38d493a6a533
# ╟─d92e0f9f-ed53-4ad6-a390-5a395e8ab8bc
# ╠═e9964184-1a2a-4ab9-bc22-2705a25393ec
# ╟─bedf8dff-e109-4757-82e5-3232fcad752d
# ╠═f2d0ea9b-ede7-496a-8d1f-9f748f9d1666
# ╠═f5bc8b1a-3fee-48ed-9910-367a1cda632e
# ╠═106b8abe-0040-48f1-b663-c00ca7673520
# ╠═a06d16ee-a4be-40de-8dac-fd818754373c
# ╠═4d809d8c-35d5-44b9-89b9-a43dbc8e6206
# ╠═9f3f780d-da6e-44b4-a002-c2f088681e9c
# ╠═6c3c7669-d594-425d-bf05-9aa217c7656e
# ╠═e9b3f541-d87d-4424-8b82-be1b7b3273d8