Skip to content
Snippets Groups Projects
Commit 45ce1dc9 authored by Brian Groenke's avatar Brian Groenke
Browse files

Add period scaling to LinearTrend

parent 4e3021dc
No related branches found
No related tags found
1 merge request!66Add period scaling to LinearTrend parameter transform
......@@ -76,19 +76,19 @@ end
return pmodel
end
end
# Transform implementations
@with_kw struct LinearTrend{P} <: ParamTransform
slope::P = Param(0.0)
intercept::P = Param(0.0)
tstart::Float64 = 0.0
tstop::Float64 = Inf; @assert tstop > tstart
period::Float64 = 1.0
minval::Float64 = -Inf
maxval::Float64 = Inf
end
function transform(state, trend::LinearTrend)
let t = min(state.t - trend.tstart, trend.tstop),
β = trend.slope,
β = trend.slope / trend.period,
α = trend.intercept;
min(max(β*t + α, trend.minval), trend.maxval)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment