Skip to content

Commit c6906dd

Browse files
committed
Add warning messages.
1 parent bf61271 commit c6906dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/annealing.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ function annealing(param, graph, I0; kwargs...)
208208
# I1[graph.delta_i .== 0] .= 0
209209
I1 *= param.K / sum(graph.delta_i .* I1)
210210
I1 = rescale_network!(param, graph, I1, Il, Iu)
211+
# Print a message if I1 has any missing, negative or infinite values
212+
if any(isnan.(I1)) || any(isinf.(I1)) || any(I1 .< 0)
213+
println("I1 has $(sum(isnan.(I1))) missing, $(sum(I1 .< 0)) negative and $(sum(isinf.(I1))) infinite values")
214+
end
211215
end
212216
k += 1
213217
end
@@ -286,6 +290,10 @@ function annealing(param, graph, I0; kwargs...)
286290
# I1[graph.delta_i .== 0] .= 0
287291
I1 *= param.K / sum(graph.delta_i .* I1)
288292
I1 = rescale_network!(param, graph, I1, Il, Iu)
293+
# Print a message if I1 has any missing, negative or infinite values
294+
if any(isnan.(I1)) || any(isinf.(I1)) || any(I1 .< 0)
295+
println("I1 has $(sum(isnan.(I1))) missing, $(sum(I1 .< 0)) negative and $(sum(isinf.(I1))) infinite values")
296+
end
289297

290298
# UPDATE AND DISPLAY RESULTS
291299
distance = sum(abs.(I1 .- I0)) / (J^2)

0 commit comments

Comments
 (0)