You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
length(window) ==length(times) ||throw(ArgumentError("When providing a vector of windows, its length $(length(window)) must match the number of specified times $(length(times))."))
121
132
perm =sortperm(times)
122
133
sorted_times = times[perm]
123
134
sorted_window = window[perm]
124
135
time_diff =diff(vcat(0, sorted_times))
125
136
126
-
any(time_diff .- sorted_window .<-eps(eltype(window))) &&throw(ArgumentError("Averaging windows overlap. Ensure that for each specified time tᵢ, tᵢ - windowᵢ ≥ tᵢ₋₁."))
137
+
epsilon =determine_epsilon(eltype(window))
138
+
any(time_diff .- sorted_window .<-epsilon) &&throw(ArgumentError("Averaging windows overlap. Ensure that for each specified time tᵢ, tᵢ - windowᵢ ≥ tᵢ₋₁."))
any(time_diff .- window .<-eps(typeof(window))) &&throw(ArgumentError("Averaging window $window is too large and causes overlapping windows. Ensure that for each specified time tᵢ, tᵢ - window ≥ tᵢ₋₁."))
147
+
epsilon =determine_epsilon(typeof(window))
148
+
149
+
any(time_diff .- window .<-epsilon) &&throw(ArgumentError("Averaging window $window is too large and causes overlapping windows. Ensure that for each specified time tᵢ, tᵢ - window ≥ tᵢ₋₁."))
# function AveragedSpecifiedTimes(times; window, kw...)
141
-
# perm = sortperm(times)
142
-
# sorted_times = times[perm]
143
-
# time_diff = diff(vcat(0, sorted_times))
144
-
145
-
# if window isa Vector{Float64}
146
-
# length(window) == length(times) || throw(ArgumentError("When providing a vector of windows, its length $(length(window)) must match the number of specified times $(length(times))."))
147
-
148
-
# sorted_window = window[perm]
149
-
# @info "timediff", time_diff
150
-
# @info "sortedwindow", sorted_window
151
-
152
-
# any(time_diff .- sorted_window .< -eps(eltype(window))) && throw(ArgumentError("Averaging windows overlap. Ensure that for each specified time tᵢ, tᵢ - windowᵢ ≥ tᵢ₋₁."))
# any(time_diff .- window .< -eps(typeof(window))) && throw(ArgumentError("Averaging window $window is too large and causes overlapping windows. Ensure that for each specified time tᵢ, tᵢ - window ≥ tᵢ₋₁."))
0 commit comments