From 854a3e33fcf0e428595d57af07abf554b2510db2 Mon Sep 17 00:00:00 2001 From: Tom Neiser Date: Thu, 23 Jul 2026 10:15:20 -0700 Subject: [PATCH 1/2] fix: treat NaN values as equal in diff comparisons equals_with_missing used ==, so two identical NaN parameter values (e.g. FUSE ActorSOLPSNN.Psol with default=NaN) made diff() error. Use isequal, which treats missing==missing and NaN==NaN as true, including inside arrays. Also fix a copy-paste bug in diff(::AbstractParametersVector, ...): v2 was read from p1 instead of p2, so vector diffs compared p1 against itself. Co-Authored-By: Claude Fable 5 --- Project.toml | 2 +- src/io.jl | 11 ++--------- src/utils.jl | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Project.toml b/Project.toml index 7833c44..6962dc2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SimulationParameters" uuid = "32ab26d3-25d6-405d-a295-367385e16093" authors = ["Orso Meneghini "] -version = "2.1.3" +version = "2.1.4" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/src/io.jl b/src/io.jl index f2a777a..96d3754 100644 --- a/src/io.jl +++ b/src/io.jl @@ -13,15 +13,8 @@ function par2ystr(par::AbstractParametersVector, txt::Vector{String}; show_info: end end -function equals_with_missing(a, b) - if ismissing(a) && ismissing(b) - return true - elseif ismissing(a) || ismissing(b) - return false - else - return a == b - end -end +# isequal treats missing==missing and NaN==NaN as true, unlike == +equals_with_missing(a, b) = isequal(a, b) function YAML._print(io::IO, value::Missing, level::Int=0, ignore_level::Bool=false) return println(io, "~") diff --git a/src/utils.jl b/src/utils.jl index 0c4f548..1da60a0 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -41,7 +41,7 @@ function Base.diff(p1::AbstractParametersVector, p2::AbstractParametersVector) end for key in commonkeys v1 = p1[key] - v2 = p1[key] + v2 = p2[key] if typeof(v1) !== typeof(v2) error("$key is of different type") elseif typeof(v1) <: AbstractParameters From d0be7213e6cb9e1341119894badf9dc8fc8c8e95 Mon Sep 17 00:00:00 2001 From: Tom Neiser Date: Thu, 23 Jul 2026 17:18:48 -0700 Subject: [PATCH 2/2] Revert version bump; done after merge per repo convention Co-Authored-By: Claude Fable 5 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6962dc2..7833c44 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SimulationParameters" uuid = "32ab26d3-25d6-405d-a295-367385e16093" authors = ["Orso Meneghini "] -version = "2.1.4" +version = "2.1.3" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"