Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
odunbar committed Jul 11, 2024
1 parent cc33614 commit a2e293d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Observations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,25 @@ function Observation(obs_dict::Dict)
snew = samples_tmp # [[1,2,3]]
end
end

if !isa(covariances, AbstractVector) # [2 1;1 2] -> [[2 1;1 2]]
ctmp = [covariances]
else
ctmp = covariances
end
# additionally provide a dimension for UniformScalings for covariances
ctmp2 = []
for (id,c) in enumerate(ctmp)
if isa(c,UniformScaling)
push!(ctmp2, Diagonal(c.λ*ones(length(snew[id])))) # get dim from samples
for (id, c) in enumerate(ctmp)
if isa(c, UniformScaling)
push!(ctmp2, Diagonal(c.λ * ones(length(snew[id])))) # get dim from samples
else
push!(ctmp2, c)
end
end
end
# then promote
T = promote_type((typeof(c) for c in ctmp2)...)
cnew = [convert(T, c) for c in ctmp2] # to re-infer eltype

if !("inv_covariances" collect(keys(obs_dict)))
inv_covariances = []
for c in cnew # ensures its a vector
Expand All @@ -159,17 +159,17 @@ function Observation(obs_dict::Dict)
ictmp = inv_covariances
end
# additionally provide a dimension for UniformScalings
ictmp2=[]
for (id,c) in enumerate(ictmp)
if isa(c,UniformScaling)
push!(ictmp2, Diagonal(c.λ*ones(length(snew[id])))) # get dim from samples
ictmp2 = []
for (id, c) in enumerate(ictmp)
if isa(c, UniformScaling)
push!(ictmp2, Diagonal(c.λ * ones(length(snew[id])))) # get dim from samples
else
push!(ictmp2, c)
end
end
end
T = promote_type((typeof(c) for c in ictmp2)...)
icnew = [convert(T, c) for c in ictmp2] # to re-infer eltype

if !isa(names, AbstractVector) # "name" -> ["name"]
nnew = [names]
else
Expand Down Expand Up @@ -292,7 +292,7 @@ function get_obs_noise_cov_inv(o::Observation; build = true)
inv_covs = get_inv_covs(o)
inv_cov_full = zeros(maximum(indices[end]), maximum(indices[end]))
for (idx, c) in zip(indices, inv_covs)
inv_cov_full[idx, idx] .= c
inv_cov_full[idx, idx] .= c
end

return inv_cov_full
Expand Down

0 comments on commit a2e293d

Please sign in to comment.