new(slavelog parser): parser for asdtp section

- a lot of boilerplates...
- there should be smarter way
This commit is contained in:
Wataru Otsubo 2024-10-25 22:50:48 +09:00
parent 9a4a4e8952
commit 3b490cd28c
8 changed files with 8938 additions and 0 deletions

View file

@ -5,3 +5,6 @@ slavelogs/main/*
!slavelogs/main/448_103_clk.txt
!slavelogs/main/444_103_clk.txt
!slavelogs/main/209_51_clk.txt
!slavelogs/main/525_244.txt
!slavelogs/main/525_245_longrun.txt
!slavelogs/main/430_100.txt

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
using Test
using PSBoardDataBase
using StaticArrays
using CSV, DataFrames
using SQLite, DBInterface
using Dates
@ -45,6 +46,64 @@ true || include("../src/PSBoardDataBase.jl")
) == 22
end
@testset "Slave Log parser" begin
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/430_100.txt"), 2280),
)
result_asdtp = PSBoardDataBase.SlaveLogParser.parse_asdtp_section!(lines)
# target = PSBoardDataBase.SlaveLogParser.AsdtpResult(
# 1,
# 0,
# true,
# fill(PSBoardDataBase.SlaveLogParser.AsdtpMeasurement.(fill((0, 1, 0), 32)), 8),
# 0,
# 1,
# 1,
# 0,
# 0x1,
# 0x1,
# 0xff,
# 0x0,
# 0x0,
# 0x0,
# MVector((0x1001, 0x2001, 0x3001, 0x4001, 0x5001, 0x6001, 0x7001, 0x8001)),
# )
# @info "" target == result_asdtp zip(result_asdtp.pp_pllds, target.pp_pllds) |>
# collect result_asdtp.pp_pllds == target.pp_pllds Iterators.filter(
# x -> x[1] != x[2],
# zip(result_asdtp.pp_pllds, target.pp_pllds),
# ) |> collect
# @info "" map(fieldnames(typeof(result_asdtp))) do field
# (; field, diff = getfield(result_asdtp, field) == getfield(target, field))
# end
@test result_asdtp == PSBoardDataBase.SlaveLogParser.AsdtpResult(
1,
0,
true,
fill(PSBoardDataBase.SlaveLogParser.AsdtpMeasurement.(fill((0, 1, 0), 32)), 8),
0,
1,
1,
0,
0x1,
0x1,
0xff,
0x0,
0x0,
0x0,
MVector((0x1001, 0x2001, 0x3001, 0x4001, 0x5001, 0x6001, 0x7001, 0x8001)),
)
@info "pass"
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/525_244.txt"), 2280),
)
PSBoardDataBase.SlaveLogParser.parse_asdtp_section!(lines)
# PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
# "./input/slavelogs/main/525_244.txt",
# )
end
@testset "Download data csv" begin
out = tempname()
@test CSV.read(