Skip to content

Commit

Permalink
Order changes, updated ToDo
Browse files Browse the repository at this point in the history
  • Loading branch information
RGonTheNoble committed May 15, 2024
1 parent 6ee7c3a commit 9deeaea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ToDo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(1) Make the "time_average" fully depend on the "time_integrals" output
- We can change the "TimeSeries" output one element at a time (dividing by dt) in order to minimize allocations

(2) Make the "time_integrals" less dependent on the total cumulative integral
- Reconstruct local cumulative integrals to interpolate
- Use the existing time_integral(ts::AbstractTimeSeries{T}, Δt::TimeInterval) implementation which is efficient
- Consider adding an "indhint" argument to make it more efficient (with an indhint output)
- Modify the interpolated results by subtracting the first value
2 changes: 1 addition & 1 deletion src/time_integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Time-weigted averages between the nodes of vt using either
Timestamps in the resulting period refers to the END of the integral period, so the first element is always NaN
"""
function time_averages(ts::AbstractTimeSeries{T}, vt::AbstractVector{<:Real}; order=1) where T
∫ts = interpolate(cumulative_integral(ts, order=order), vt, order=order)
∫ts = interpolate(cumulative_integral(ts, order=order), vt, order=1)
return TimeSeries(vt, [NaN; diff(values(∫ts))./diff(vt)])
end

Expand Down

0 comments on commit 9deeaea

Please sign in to comment.