Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
odunbar committed Jun 13, 2023
1 parent 063794e commit 0617967
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/LearningRateSchedulers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,10 @@ function calculate_timestep!(
end

# overload ==
function Base.:(==)(lrs_a::LRS, lrs_b::LRS) where {LRS <: LearningRateScheduler}
checks = [false for i = 1:length(fieldnames(LRS))]
for (i,f) in enumerate(fieldnames(LRS))
checks[i] =getfield(lrs_a,f) == getfield(lrs_b,f)
function Base.:(==)(lrs_a::LRS, lrs_b::LRS) where {LRS <: LearningRateScheduler}
checks = [false for i in 1:length(fieldnames(LRS))]
for (i, f) in enumerate(fieldnames(LRS))
checks[i] = getfield(lrs_a, f) == getfield(lrs_b, f)
end
return all(checks)
end

8 changes: 4 additions & 4 deletions test/EnsembleKalmanProcess/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ end
dlrs2 = EKP.DefaultScheduler(Δt)
@test dlrs2.Δt_default == Float64(Δt)
@test EKP.DefaultScheduler() == EKP.DefaultScheduler()

#Mutable
mlrs1 = EKP.MutableScheduler()
@test mlrs1.Δt_mutable == Float64[1]
Expand All @@ -98,8 +98,8 @@ end
ekslrs2 = EKP.EKSStableScheduler(num, nug)
@test ekslrs2.numerator == Float64(3)
@test ekslrs2.nugget == Float64(0.0001)


num = Float32(3)
nug = Float32(0.0001)
ekslrs2 = EKP.EKSStableScheduler(num, nug)
Expand Down Expand Up @@ -127,7 +127,7 @@ end
dmclrs3 = EKP.DataMisfitController(on_terminate = "continue_fixed")
@test dmclrs3.on_terminate == "continue_fixed"
@test EKP.DataMisfitController() == EKP.DataMisfitController()

# build EKP and eki objects
# Get an inverse problem
y_obs, G, Γy, _ = inv_problems[end] #additive noise inv problem
Expand Down

0 comments on commit 0617967

Please sign in to comment.