add(examples): power stat for each positions comparison 1-5 vs 6

This commit is contained in:
Wataru Otsubo 2024-12-11 10:47:04 +09:00
parent 133c437d42
commit 1dcd46e7c6

View file

@ -11,6 +11,7 @@ begin
using DataFrames
using DBInterface
using Tables
using FHist
using CairoMakie
using Statistics
end
@ -105,6 +106,72 @@ let
fig
end
# ╔═╡ de424d0d-4e4e-49df-bf4a-c73e368020a3
let
df = copy(qaqc_single_results, copycols = true)
target_runids =
filter(
[:shiftscript_ver_function, :campaign_id] => (
(v, campaign) ->
!ismissing(v) && v v"1.0.4" && !ismissing(campaign) && campaign < 6
),
qaqc_runs,
).id
filter!(:runid => in(target_runids), df)
filter!(:qspip => ==(1), df)
df = combine(groupby(df, :position)) do sdf
(; n_power_fail = count(!=(1), sdf.power))
end
rename!(df, :position => :position_id)
leftjoin!(df, qaqc_positions, on = :position_id => :id)
select!(df, Not(:rising_ns))
df
fig = Figure()
ax = Axis(
fig[1, 1],
title = "Power Fail 場所分布 (第5回まで)",
xticks = (eachindex(df.name), df.name),
xticklabelrotation = π / 4,
)
barplot!(ax, df.n_power_fail, bar_labels = df.n_power_fail .|> Int64 .|> string)
# Campaign 6
df = copy(qaqc_single_results, copycols = true)
target_runids =
filter(
[:shiftscript_ver_function, :campaign_id] => (
(v, campaign) ->
!ismissing(v) && v v"1.0.4" && !ismissing(campaign) && campaign == 6
),
qaqc_runs,
).id
filter!(:runid => in(target_runids), df)
filter!(:qspip => ==(1), df)
df = combine(groupby(df, :position)) do sdf
(; n_power_fail = count(!=(1), sdf.power))
end
rename!(df, :position => :position_id)
leftjoin!(df, qaqc_positions, on = :position_id => :id)
select!(df, Not(:rising_ns))
@info "" df
ax = Axis(
fig[2, 1],
title = "Power Fail 場所分布 (第6回 (B-0-2のケーブル交換))",
xticks = (eachindex(df.name), df.name),
xticklabelrotation = π / 4,
)
barplot!(ax, df.n_power_fail, bar_labels = df.n_power_fail .|> Int64 .|> string)
fig
end
# ╔═╡ bfc8753d-b76f-45b5-b19e-528746648117
md"""
## 場所ごとの読み取り値の分布
@ -202,7 +269,11 @@ let
)
fig[position_id, station_id] = gl = GridLayout()
Label(gl[0, 1], rich(pos_sdf.name[1], bold = true, fontsize = 20), tellwidth = false)
Label(
gl[0, 1],
rich(pos_sdf.name[1], bold = true, fontsize = 20),
tellwidth = false,
)
ax_3v3d = Axis(gl[1, 1], limits = (nothing, (3.3 - 0.3, 3.3 + 0.3)))
ax_3v3a = Axis(gl[2, 1], limits = (nothing, (3 - 0.3, 3 + 0.3)))
ax_n3va = Axis(gl[3, 1], limits = (nothing, (-3 - 0.3, -3 + 0.3)))
@ -228,7 +299,10 @@ let
!ismissing(val) && (val < v_min || v_max < val)
end
if any(!isempty, (outlier_3v3d, outlier_3v3a, outlier_n3va))
@info "outlier" sdf[unique([outlier_3v3d; outlier_3v3a; outlier_n3va]), :] |> Tables.rowtable
@info "outlier" sdf[
unique([outlier_3v3d; outlier_3v3a; outlier_n3va]),
:,
] |> Tables.rowtable
end
end
end
@ -241,6 +315,7 @@ PLUTO_PROJECT_TOML_CONTENTS = """
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FHist = "68837c9b-b678-4cd5-9925-8a54edc8f695"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@ -250,6 +325,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
CairoMakie = "~0.12.14"
DBInterface = "~2.6.1"
DataFrames = "~1.7.0"
FHist = "~0.11.7"
PlutoUI = "~0.7.60"
SQLite = "~1.6.1"
Statistics = "~1.11.1"
@ -260,9 +336,9 @@ Tables = "~1.12.0"
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.1"
julia_version = "1.11.2"
manifest_format = "2.0"
project_hash = "bea195e56ecd6bec368320394de4866dfad0414d"
project_hash = "c5435dc389e1a7d29d893a0cf31593e6e08d4150"
[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
@ -343,6 +419,11 @@ version = "0.4.7"
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.BayesHistogram]]
git-tree-sha1 = "5d5dda960067751bc1534aba765f771325044501"
uuid = "000d9b38-65fe-4c81-bdb9-69f01f102479"
version = "1.0.7"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "8873e196c2eb87962a2048b3b8e08946535864a1"
@ -382,6 +463,12 @@ git-tree-sha1 = "009060c9a6168704143100f36ab08f06c2af4642"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.18.2+1"
[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "9cb23bbb1127eefb022b022481466c0f1127d430"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.2"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "3e4b134270b372f2ed4d4d0e936aabaefc1802bc"
@ -578,6 +665,23 @@ git-tree-sha1 = "4d81ed14783ec49ce9f2e168208a12ce1815aa25"
uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a"
version = "3.3.10+1"
[[deps.FHist]]
deps = ["BayesHistogram", "LinearAlgebra", "MakieCore", "Measurements", "RecipesBase", "Requires", "Statistics", "StatsBase"]
git-tree-sha1 = "66013ca09dbaa9017a987562c19791c3e9a64a5a"
uuid = "68837c9b-b678-4cd5-9925-8a54edc8f695"
version = "0.11.7"
[deps.FHist.extensions]
FHistHDF5Ext = "HDF5"
FHistMakieExt = "Makie"
FHistPlotsExt = "Plots"
[deps.FHist.weakdeps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
[[deps.FileIO]]
deps = ["Pkg", "Requires", "UUIDs"]
git-tree-sha1 = "62ca0547a14c57e98154423419d8a342dca75ca9"
@ -847,17 +951,13 @@ version = "0.22.18"
git-tree-sha1 = "dba9ddf07f77f60450fe5d2e2beb9854d9a49bd0"
uuid = "8197267c-284f-5f27-9208-e0e47529a953"
version = "0.7.10"
weakdeps = ["Random", "RecipesBase", "Statistics"]
[deps.IntervalSets.extensions]
IntervalSetsRandomExt = "Random"
IntervalSetsRecipesBaseExt = "RecipesBase"
IntervalSetsStatisticsExt = "Statistics"
[deps.IntervalSets.weakdeps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[deps.InvertedIndices]]
git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038"
uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
@ -1087,6 +1187,26 @@ deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.6+0"
[[deps.Measurements]]
deps = ["Calculus", "LinearAlgebra", "Printf", "Requires"]
git-tree-sha1 = "bdcde8ec04ca84aef5b124a17684bf3b302de00e"
uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
version = "2.11.0"
[deps.Measurements.extensions]
MeasurementsBaseTypeExt = "BaseType"
MeasurementsJunoExt = "Juno"
MeasurementsRecipesBaseExt = "RecipesBase"
MeasurementsSpecialFunctionsExt = "SpecialFunctions"
MeasurementsUnitfulExt = "Unitful"
[deps.Measurements.weakdeps]
BaseType = "7fbed51b-1ef5-4d67-9085-a4a9b26f478c"
Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d"
@ -1350,6 +1470,12 @@ weakdeps = ["FixedPointNumbers"]
[deps.Ratios.extensions]
RatiosFixedPointNumbersExt = "FixedPointNumbers"
[[deps.RecipesBase]]
deps = ["PrecompileTools"]
git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.3.4"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
@ -1840,6 +1966,7 @@ version = "3.6.0+0"
# ╟─425f9200-ebed-4677-8011-93c45eef71fc
# ╠═f8fc02f7-827b-441d-b541-c9e26421df95
# ╠═968c5eb0-dfe1-4cbe-9093-742b7dde1d5a
# ╠═de424d0d-4e4e-49df-bf4a-c73e368020a3
# ╟─bfc8753d-b76f-45b5-b19e-528746648117
# ╠═205ce73d-6e02-4276-93b5-69b36b635398
# ╠═aa8bb253-33b7-47be-b6f2-3f230117d876