From f282351049cf1b9ff303e99181921c0c7b081ce5 Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Thu, 14 Nov 2024 21:28:45 +0900 Subject: [PATCH] new(notebook): add ppconfig_error analysis --- docs/src/assets/ppconfig_error_analysis.html | 17 +++ examples/ppconfig_error_analysis.jl | 104 +++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 docs/src/assets/ppconfig_error_analysis.html create mode 100644 examples/ppconfig_error_analysis.jl diff --git a/docs/src/assets/ppconfig_error_analysis.html b/docs/src/assets/ppconfig_error_analysis.html new file mode 100644 index 0000000..f2dbc73 --- /dev/null +++ b/docs/src/assets/ppconfig_error_analysis.html @@ -0,0 +1,17 @@ + + + + + + + +
\ No newline at end of file diff --git a/examples/ppconfig_error_analysis.jl b/examples/ppconfig_error_analysis.jl new file mode 100644 index 0000000..f160515 --- /dev/null +++ b/examples/ppconfig_error_analysis.jl @@ -0,0 +1,104 @@ +### A Pluto.jl notebook ### +# v0.20.3 + +using Markdown +using InteractiveUtils + +# ╔═╡ 255850f9-3984-4422-8710-6ab497904d4f +begin + using Pkg + Pkg.activate("..") + Pkg.status() + true || include("../src/PSBoardDataBase.jl") +end + +# ╔═╡ 6861385c-d9a1-4115-9354-3b0bbbbf433c +begin + using PSBoardDataBase + using DataFrames + using SQLite + using DBInterface + using CairoMakie + using PlutoUI +end + +# ╔═╡ c639141c-48a1-424f-be33-026ab04a7d33 +TableOfContents() + +# ╔═╡ ad5e90ba-fa29-4ae1-b365-2e3dbb9dbe72 +const SLAVELOGS_DIR = "../test/input/slavelogs/main/" + +# ╔═╡ 2f5c2984-ae32-467a-ba94-cbff9b954857 +db = SQLite.DB("../psboard_qaqc.db") + +# ╔═╡ d3ee0e2e-ff6c-4cb3-8985-53516a9d2b8f +qaqc_single_run_results = + DBInterface.execute(db, sql"select * from qaqc_single_run_results") |> DataFrame + +# ╔═╡ 7b6caa7a-d565-4b1d-baed-9f0fa18712ec +let + PSBoardDataBase.SlaveLogParser.parse_slavelog_file( + joinpath(SLAVELOGS_DIR, "164_89.txt"), + ) +end + +# ╔═╡ f4fc10fa-03ca-4468-b3d3-918f39ad9e35 +qaqc_single_run_results_with_ppconfig_error = transform( + qaqc_single_run_results, + [:psboard_id, :runid] => + ByRow( + (psbid, runid) -> begin + if psbid == 999999 + return missing + end + logfilepath = joinpath(SLAVELOGS_DIR, "$(psbid)_$(runid).txt") + if !ispath(logfilepath) + return missing + end + slavelog = + PSBoardDataBase.SlaveLogParser.parse_slavelog_file(logfilepath) + result_asdtp = slavelog.asdtp + if isempty(result_asdtp) + return missing + end + result_asdtp[1].ppconfig_error |> UInt32 + end, + ) => :ppconfig_error, +) + +# ╔═╡ e8933a41-7500-409a-8650-ec52be37e483 +md""" +### 1回試験でQSPIpをパスしてPPConfig_errorが0ではなかったもの +""" + +# ╔═╡ 81a242ac-ac64-4794-8c8b-4ec439db4e90 +let + df = filter( + :ppconfig_error => (x -> !ismissing(x) && x != 0), + qaqc_single_run_results_with_ppconfig_error, + ) + filter!(:qspip => ==(1), df) + df +end + +# ╔═╡ cc16f82d-8c45-4e75-8b5b-5abe362a3526 +slave_logs = let + entries = readdir(SLAVELOGS_DIR, join = true) + Iterators.filter(entries) do entry_name + contains(r"^\d+_\d+\.txt")(basename(entry_name)) || + contains(r"^\d+_\d+_longrun\.txt")(basename(entry_name)) + end |> collect +end + +# ╔═╡ Cell order: +# ╠═255850f9-3984-4422-8710-6ab497904d4f +# ╠═6861385c-d9a1-4115-9354-3b0bbbbf433c +# ╠═c639141c-48a1-424f-be33-026ab04a7d33 +# ╠═ad5e90ba-fa29-4ae1-b365-2e3dbb9dbe72 +# ╠═2f5c2984-ae32-467a-ba94-cbff9b954857 +# ╠═d3ee0e2e-ff6c-4cb3-8985-53516a9d2b8f +# ╠═7b6caa7a-d565-4b1d-baed-9f0fa18712ec +# ╠═f4fc10fa-03ca-4468-b3d3-918f39ad9e35 +# ╠═e8933a41-7500-409a-8650-ec52be37e483 +# ╠═81a242ac-ac64-4794-8c8b-4ec439db4e90 +# ╠═cc16f82d-8c45-4e75-8b5b-5abe362a3526