mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-07-03 01:59:24 +09:00
add: count_riseup
This commit is contained in:
parent
c0bd4b01b2
commit
48d701b3a3
1 changed files with 42 additions and 2 deletions
|
@ -28,14 +28,14 @@ function get_skew(file::T) where {T <: AbstractString}
|
||||||
if high > 0
|
if high > 0
|
||||||
@debug "Unexpected first line" file
|
@debug "Unexpected first line" file
|
||||||
return missing
|
return missing
|
||||||
elseif high > 500
|
elseif high >= 500
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
time_and_counts = Iterators.map(_parse_line, lines)
|
time_and_counts = Iterators.map(_parse_line, lines)
|
||||||
for (time, high) in time_and_counts
|
for (time, high) in time_and_counts
|
||||||
if high > 500
|
if high >= 500
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,4 +43,44 @@ function get_skew(file::T) where {T <: AbstractString}
|
||||||
return missing
|
return missing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
search_oscillation(file::T) where {T <: AbstractString}
|
||||||
|
|
||||||
|
Search oscillation (two or more rise up) for clock measurement file.
|
||||||
|
"""
|
||||||
|
function count_riseup(file::T) where {T <: AbstractString}
|
||||||
|
lines = Iterators.Stateful(eachline(file))
|
||||||
|
|
||||||
|
rising_count = 0
|
||||||
|
first_line = popfirst!(lines)
|
||||||
|
is_high = let
|
||||||
|
time, high = _parse_line(first_line)
|
||||||
|
high >= 500
|
||||||
|
end
|
||||||
|
|
||||||
|
time_and_counts = Iterators.map(_parse_line, lines)
|
||||||
|
for (time, high) in time_and_counts
|
||||||
|
if !is_high && high >= 500
|
||||||
|
is_high = true
|
||||||
|
rising_count += 1
|
||||||
|
elseif is_high && high < 500
|
||||||
|
is_high = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return rising_count
|
||||||
|
|
||||||
|
# lines = eachline(file)
|
||||||
|
# time_and_counts = Iterators.map(_parse_line, lines)
|
||||||
|
# is_high = Iterators.map(time_and_counts) do (time, counts)
|
||||||
|
# counts >= 500
|
||||||
|
# end
|
||||||
|
# edges = Iterators.map(accumulate((p, n) -> (n, !p[1] & n), is_high, init = (false, false))) do x
|
||||||
|
# _prev, edge = x
|
||||||
|
# edge
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# return sum(edges)
|
||||||
|
end
|
||||||
|
|
||||||
end # module ClockParser
|
end # module ClockParser
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue