diff --git a/docs/src/assets/pllld_count.html b/docs/src/assets/pllld_count.html index fc3c53a..f77d51b 100644 --- a/docs/src/assets/pllld_count.html +++ b/docs/src/assets/pllld_count.html @@ -1,17 +1,17 @@ - - + -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/src/assets/power_stats.html b/docs/src/assets/power_stats.html index 5c17132..7f58a6d 100644 --- a/docs/src/assets/power_stats.html +++ b/docs/src/assets/power_stats.html @@ -1,17 +1,17 @@ - - + -
\ No newline at end of file +
\ No newline at end of file diff --git a/examples/clock_skew_stats.svg b/examples/clock_skew_stats.svg index f9152ab..13c9a74 100644 --- a/examples/clock_skew_stats.svg +++ b/examples/clock_skew_stats.svg @@ -2,581 +2,593 @@ - + - + - + - + - + - + - + - - - - + - + + + + - - - - - - - + - + + + + + + + - + - + - + - + - - - - + - + - + - + - + - + - + + + + - + - + - + - + - - - - - - - - - - - - - + - - + + - - + + - + - + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + - + - - - - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + - - + + - - - - + - + + + + + + + + + + + + + - - - - - - - - - - - - - + - - - - + - + - - - - - - - + - - - - + - - - - + - - - - - - - - - - - - - - - - + - + - - - - - - - + - - + + - - + + - + + + + - - - - - - - - - - - - - + - - - - - - - + - - + + - - - - + - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - + - - - - - - - - - - - - - - - - + - - - - + - + + + + + + + + + + + + + + + + - - + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -591,289 +603,289 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + @@ -884,30 +896,37 @@ - + - - + + - - - + + + - + - + + + + + + + + @@ -916,9 +935,9 @@ - - - + + + @@ -938,49 +957,52 @@ + + - + + - - + + - - + + - + - + - + - - - - - + + + + + - - + + - + @@ -989,1519 +1011,1700 @@ - - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/pllld_count.jl b/examples/pllld_count.jl index 5daeff5..e5546e8 100644 --- a/examples/pllld_count.jl +++ b/examples/pllld_count.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.20.2 +# v0.20.4 using Markdown using InteractiveUtils @@ -184,36 +184,95 @@ combine( ) # ╔═╡ a0baf37c-8b05-49c1-a6a4-027f3404f8b4 -df_reset_failed_though_reconfig_done = combine( - groupby(qaqc_extra_run_results, :id), - AsTable([:psboard_id, :runid]) => - ( - sdf -> begin - @assert nrow(sdf) == 1 +df_reset_failed_though_reconfig_done = transform( + qaqc_extra_run_results, + [:psboard_id, :runid] => + ByRow( + (psboard_id, runid) -> begin + broken_list = @NamedTuple{psbid::Int64, runid::Int64}[ + (psbid = 1050, runid = 385), + (psbid = 1113, runid = 392), + (psbid = 1121, runid = 392), + (psbid = 131, runid = 38), + (psbid = 133, runid = 38), + (psbid = 136, runid = 38), + (psbid = 137, runid = 38), + (psbid = 1545, runid = 474), + (psbid = 16959, runid = 48), + (psbid = 16959, runid = 59), + (psbid = 198, runid = 251), + (psbid = 202, runid = 45), + (psbid = 203, runid = 45), + (psbid = 205, runid = 45), + (psbid = 206, runid = 45), + (psbid = 206, runid = 57), + (psbid = 206, runid = 59), + (psbid = 208, runid = 45), + (psbid = 210, runid = 45), + (psbid = 214, runid = 45), + (psbid = 215, runid = 48), + (psbid = 221, runid = 55), + (psbid = 223, runid = 48), + (psbid = 224, runid = 48), + (psbid = 229, runid = 48), + (psbid = 231, runid = 48), + (psbid = 234, runid = 48), + (psbid = 235, runid = 48), + (psbid = 237, runid = 45), + (psbid = 238, runid = 45), + (psbid = 239, runid = 45), + (psbid = 263, runid = 69), + (psbid = 329, runid = 69), + (psbid = 339, runid = 69), + (psbid = 42, runid = 178), + (psbid = 488791279, runid = 63), + (psbid = 48879, runid = 47), + (psbid = 723, runid = 436), + ] + if (; psbid = psboard_id, runid) in broken_list + @error "broken file psbid: $(psboard_id), runid: $(runid)" + return (; + psboard_id, + runid, + reset_failed_though_reconfig_done = missing, + ) + end - logfilename = "$(sdf.psboard_id[1])_$(sdf.runid[1])_longrun.txt" + logfilename = "$(psboard_id)_$(runid)_longrun.txt" logfile = joinpath("../test/input/slavelogs/main/", logfilename) !ispath(logfile) && begin @warn "logfile $(logfile) not found" return ( - psboard_id = sdf.psboard_id[1], - runid = sdf.runid[1], + psboard_id = psboard_id, + runid = runid, reset_failed_though_reconfig_done = missing, ) end - if sdf.runid[1] == 99 + if runid == 99 @info "skipping runid 99 since it is not exactly 100 run" return ( - psboard_id = sdf.psboard_id[1], - runid = sdf.runid[1], + psboard_id = psboard_id, + runid = runid, reset_failed_though_reconfig_done = missing, ) end - slave_result = + if psboard_id == 1545 && runid == 474 + @info "skipping psbid 1545 runid 474 since it is broken" + return ( + psboard_id = psboard_id, + runid = runid, + reset_failed_though_reconfig_done = missing, + ) + end + slave_result = try PSBoardDataBase.SlaveLogParser.parse_slavelog_file(logfile) + catch e + @error "Failed to parse slavelog file: $(logfile)" + throw(e) + end return ( - psboard_id = sdf.psboard_id[1], - runid = sdf.runid[1], + psboard_id = psboard_id, + runid = runid, reset_failed_though_reconfig_done = count( slave_result.asdtp, ) do asdtp_result @@ -221,7 +280,7 @@ df_reset_failed_though_reconfig_done = combine( asdtp_result.pllld_fail_counter == 10 end, ) - end + end, ) => [:psboard_id, :runid, :reset_failed_though_reconfig_done], ) @@ -236,7 +295,7 @@ let end # ╔═╡ dfeb3900-539f-4d8d-8103-edb67cf4e890 -#CSV.write("reset_failed_though_reconfig_done.csv", df_reset_failed_though_reconfig_done) +#CSV.write("reset_failed_though_reconfig_done.csv", df_reset_failed_though_reconfig_done[:, [:psboard_id, :runid, :reset_failed_though_reconfig_done]]) # ╔═╡ 332b7481-f6dc-4027-a5c5-cf58d5b6acd3 md""" @@ -348,7 +407,7 @@ end barplot( asdtp_result_total_pp7_vs_ch, axis = (; - title = "Campaign 7 B-1-9 PP ASIC7 BCID fail count vs channels", + title = "Campaign 7 B-1-9 PP ASIC7 BCID fail count vs channels", xlabel = "PP ASIC 7 ch id", ylabel = "total number of BCID passed", ), diff --git a/examples/pllld_wait_scan.jl b/examples/pllld_wait_scan.jl index d884272..99966ba 100644 --- a/examples/pllld_wait_scan.jl +++ b/examples/pllld_wait_scan.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.20.2 +# v0.20.4 using Markdown using InteractiveUtils diff --git a/examples/power_stats.jl b/examples/power_stats.jl index fe92286..200cf0b 100644 --- a/examples/power_stats.jl +++ b/examples/power_stats.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.20.2 +# v0.20.4 using Markdown using InteractiveUtils diff --git a/examples/ppconfig_error_analysis.jl b/examples/ppconfig_error_analysis.jl index f160515..aa97836 100644 --- a/examples/ppconfig_error_analysis.jl +++ b/examples/ppconfig_error_analysis.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.20.3 +# v0.20.4 using Markdown using InteractiveUtils @@ -18,7 +18,7 @@ begin using DataFrames using SQLite using DBInterface - using CairoMakie + # using CairoMakie using PlutoUI end @@ -55,6 +55,9 @@ qaqc_single_run_results_with_ppconfig_error = transform( if !ispath(logfilepath) return missing end + if psbid == 723 && runid == 434 + return missing + end slavelog = PSBoardDataBase.SlaveLogParser.parse_slavelog_file(logfilepath) result_asdtp = slavelog.asdtp diff --git a/examples/psboard_clock_rise_span_histogram.svg b/examples/psboard_clock_rise_span_histogram.svg index ed64d39..3c32066 100644 --- a/examples/psboard_clock_rise_span_histogram.svg +++ b/examples/psboard_clock_rise_span_histogram.svg @@ -2,368 +2,359 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + - - - - + - + + + + - + - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - + - + + + + + + + + + + - + - + + + + - + + + + + + + + + + - + - + - + - + - - - - + - - - - - - - - - + - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + @@ -383,410 +374,390 @@ - - - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -802,88 +773,86 @@ - - - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/examples/psboard_clock_turnoncurve.svg b/examples/psboard_clock_turnoncurve.svg index 5e78e51..cad531c 100644 --- a/examples/psboard_clock_turnoncurve.svg +++ b/examples/psboard_clock_turnoncurve.svg @@ -2,420 +2,408 @@ - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - + + + + - + - + + - - + + - + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - + - + - + - + - + - + - + - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -427,313 +415,367 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -743,19 +785,19 @@ - + - + - + - + - + @@ -765,16 +807,16 @@ - + - + - + - + @@ -784,21 +826,21 @@ - + - + - + - + - + @@ -816,68 +858,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -886,137 +866,140 @@ - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + diff --git a/examples/psboard_skew_histogram.svg b/examples/psboard_skew_histogram.svg index dbfd385..d0c154a 100644 --- a/examples/psboard_skew_histogram.svg +++ b/examples/psboard_skew_histogram.svg @@ -2,128 +2,146 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - + + - + - + - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -134,158 +152,190 @@ - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/examples/skew_stats.jl b/examples/skew_stats.jl index ee6a1be..682cdb2 100644 --- a/examples/skew_stats.jl +++ b/examples/skew_stats.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.20.2 +# v0.20.4 using Markdown using InteractiveUtils @@ -307,6 +307,9 @@ end) # ╔═╡ 25688d24-5aee-43d3-aff9-b9efa0556070 combine(nrow, gdf_skews_on_psbid) +# ╔═╡ 0d3f7f0a-1713-4e22-acbb-7d370fabf5a7 +combine(gdf_skews_on_psbid, :skew => (v -> all(ismissing, v)) => :hasmissing) |> (df -> sort(df, :hasmissing, rev = true)) + # ╔═╡ 239a808c-0411-4542-ae68-6ae6af333bd2 df_nrow_ordered = let df = combine(nrow, gdf_skews_on_psbid) @@ -489,8 +492,13 @@ df_skews_selected = let df gdf_skews_on_psbid, sdf -> begin all(ismissing, sdf.skew) && @info "" sdf + # TODO: update + if sdf.psbid[1] == 1563 + () + end if nrow(sdf) == 1 - @assert sdf.skew |> first |> !ismissing + # TODO: remove 1563 bypass + sdf.psbid[1] == 1563 || @assert sdf.skew |> first |> !ismissing sdf ( skew = sdf.skew |> first, width = sdf.width |> first, @@ -748,7 +756,7 @@ let ax1, 0:1:2, sdf.skew, - color = Makie.wong_colors()[sdf.campaign_id[1]], + color = Makie.wong_colors()[sdf.campaign_id[1] |> Int64], alpha = 0.7, ) scatter!( @@ -756,7 +764,7 @@ let sdf.campaign_id[1], mean(@view(sdf.skew[2:3])) - sdf.skew[1], marker = :x, - color = Makie.wong_colors()[sdf.campaign_id[1]], + color = Makie.wong_colors()[sdf.campaign_id[1] |> Int64], alpha = 0.7, ) errorbars!( @@ -764,7 +772,7 @@ let [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]], + color = Makie.wong_colors()[sdf.campaign_id[1] |> Int64], alpha = 0.4, whiskerwidth = 5, ) @@ -785,7 +793,7 @@ let align = (:left, :center), ) end - campaigns = df_compare.campaign_id |> unique |> sort! + campaigns = df_compare.campaign_id |> unique |> sort! .|> Int64 Legend( grd1[2, 1], [ @@ -860,7 +868,7 @@ md""" """ # ╔═╡ 2a24c277-6679-49f3-b387-6937b7661a25 -invalid_measurements = [215, 291, 442, 460, 462, 545, 799, 802, 444, 255, 435, 1213, 1215] +invalid_measurements = [215, 291, 442, 460, 462, 545, 799, 802, 444, 255, 435, 1213, 1215, #= TODO: remove =# 1563] # ╔═╡ 13b4112f-96ab-41a1-8ef1-d940771f6ece df_skews_selected_valids = let @@ -949,7 +957,7 @@ let push!(hists, Hist1D(gdf.skew, binedges = bins)) end sh1 = stackedhist!(ax, hists, error_color = Pattern('/')) - labels = ["campaign $i" for i in 1:6] + labels = ["campaign $i" for i in 1:7] elements = [PolyElement(polycolor = sh1.attributes.color[][i]) for i in 1:length(labels)] Legend( @@ -1040,7 +1048,10 @@ let text!(ax, [(293 + 304) / 2, (305 + 329) / 2], [-1, -1], text = ["11-11", "11-12"]) end - df_highlighted = filter(:psbid => in([973, 990, 992, 1030, 1050, 1053, 1110, 1113, 1121, 1141, 1142]), df_skews_selected_valids) + df_highlighted = filter( + :psbid => in([973, 990, 992, 1030, 1050, 1053, 1110, 1113, 1121, 1141, 1142]), + df_skews_selected_valids, + ) @info "" df_highlighted scatter!( ax, @@ -1304,6 +1315,7 @@ end # ╟─2d41c98b-630e-41e7-9332-25394a6285e8 # ╠═6ff9f397-5db9-45af-9bca-7a8d7756f8da # ╠═25688d24-5aee-43d3-aff9-b9efa0556070 +# ╠═0d3f7f0a-1713-4e22-acbb-7d370fabf5a7 # ╠═239a808c-0411-4542-ae68-6ae6af333bd2 # ╠═8e57bde1-5f97-483d-906e-8ebfb65016d0 # ╠═92c2ac3f-8034-4e9e-aadb-8bb166fbc948 diff --git a/src/import_data.jl b/src/import_data.jl index 7421dcd..dc4d0cd 100644 --- a/src/import_data.jl +++ b/src/import_data.jl @@ -25,7 +25,7 @@ end Fill qaqc_campaigns table in `db`. """ function insert_qaqc_campaign_id(db::SQLite.DB) - campaigns = [1, 2, 3, 4, 5, 6] + campaigns = [1, 2, 3, 4, 5, 6, 7] dates = [ (DateTime(2024, 7, 22), DateTime(2024, 7, 24)), (DateTime(2024, 8, 6), DateTime(2024, 8, 9)), @@ -33,6 +33,7 @@ function insert_qaqc_campaign_id(db::SQLite.DB) (DateTime(2024, 9, 30), DateTime(2024, 10, 4)), (DateTime(2024, 11, 11), DateTime(2024, 11, 14)), (DateTime(2024, 12, 9), DateTime(2024, 12, 12)), + (DateTime(2025, 1, 20), DateTime(2024, 1, 23)), ] stmt_insert_campaigns = DBInterface.prepare( db, @@ -215,8 +216,10 @@ function get_campaign_id_from_run_id(runid::Integer) 4 elseif runid < 354 5 - elseif runid < Inf # TODO: update this at the end of 6th campaign + elseif runid < 425 6 + elseif 448 ≤ runid < Inf # TODO: update this at the end of 6th campaign + 7 else @error "Fix this function" DomainError("runid $(runid) is not registered to the software") @@ -787,8 +790,14 @@ Extract QAQC results from slave log files for single runs. Slave log files are expected to located in certain format under `logs_dir`. """ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) - exclude_runs = - ((runid = 51, reason = "clock only"), (runid = 175, reason = "broken files")) + exclude_runs = ( + (runid = 51, psbid = nothing, reason = "clock only"), + (runid = 175, psbid = nothing, reason = "broken files"), + (runid = 437, psbid = 1215, reason = "PSBID 1215 is not completed"), + (runid = 439, psbid = 703, reason = "PSBID 703 is not completed"), + (runid = 434, psbid = 723, reason = "PSBID 723 is not completed"), + ) + @assert eltype(exclude_runs) != Any stmt_insert_slave_result_to_single_result = DBInterface.prepare( db, @@ -823,8 +832,10 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) # exclusion - exclude_cond = Iterators.filter(exclude_runs) do cond - runid == cond.runid + exclude_cond = filter(exclude_runs) do cond + runid_matched = runid == cond.runid + psbid_matched = isnothing(cond.psbid) || cond.psbid == psbid + runid_matched && psbid_matched end if !isempty(exclude_cond) @debug "skipping runid = $(runid) for $(first(exclude_cond).reason)" @@ -832,14 +843,18 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) end if !(runid in runids) + @debug "runid: $(runid) not in run list (psbid: $(psbid)). Parsing slave log to test its format." slave_result = SlaveLogParser.parse_slavelog_file(file) - @debug "runid: $(runid) not in run list (psbid: $(psbid))" continue end # main - slave_result = SlaveLogParser.parse_slavelog_file(file) + slave_result = try + SlaveLogParser.parse_slavelog_file(file) + catch e + throw(error("Failed to parse slave log file: $(file)\n$(e)")) + end @assert length(slave_result.power) == 1 "Too many power results for single run"