Skip to content

Commit

Permalink
JuliaFormatter.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Feb 5, 2024
1 parent 1fa8ab5 commit 2035884
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/data_likelihoods/data_likelihoods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ function dalton_data_loglik(
args...;
# observation model
observation_matrix=I,
observation_noise_cov::Union{Number, AbstractMatrix},
observation_noise_cov::Union{Number,AbstractMatrix},
# data
data::NamedTuple{(:t, :u)},
kwargs...
kwargs...,
)
if alg.smooth
str = "The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
str =
"The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
"You might want to set `smooth=false` to imprpove performance."
@warn str
end
if !(:adaptive in keys(kwargs))
throw(ArgumentError("`dalton_nll` only works with fixed step sizes. Set `adaptive=false`."))
str = "`dalton_nll` only works with fixed step sizes. Set `adaptive=false`."
throw(ArgumentError(str))
end

if :tstops in keys(kwargs)
throw(ArgumentError("`dalton_nll` needs to set the tstops for the second solve, so setting it separately is not supported."))
str = "`dalton_nll` needs to set the tstops for the second solve, so setting it separately is not supported."
throw(ArgumentError(str))
end


data_ll = DataUpdateLogLikelihood(zero(eltype(prob.p)))

cb = DataUpdateCallback(
Expand All @@ -43,9 +45,10 @@ function dalton_data_loglik(
tstops=data.t,
)

dalton_ll = (data_ll.ll
+ sol_with_data.pnstats.log_likelihood
- sol_without_data.pnstats.log_likelihood)
dalton_ll = (
data_ll.ll + sol_with_data.pnstats.log_likelihood -
sol_without_data.pnstats.log_likelihood
)

return dalton_ll
end
Expand All @@ -56,14 +59,16 @@ function filtering_data_loglik(
args...;
# observation model
observation_matrix=I,
observation_noise_cov::Union{Number, AbstractMatrix},
observation_noise_cov::Union{Number,AbstractMatrix},
# data
data::NamedTuple{(:t, :u)},
kwargs...
kwargs...,
)
if alg.smooth
str = "The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
str = (
"The passed algorithm performs smoothing, but `dalton_nll` can be used without. " *
"You might want to set `smooth=false` to imprpove performance."
)
@warn str
end

Expand Down

0 comments on commit 2035884

Please sign in to comment.