From edcdcac0fbbe9d5d1b5d628dc08390f2be4abfba Mon Sep 17 00:00:00 2001 From: andre_ramos Date: Wed, 13 Aug 2025 20:56:49 -0300 Subject: [PATCH] fix empty estimated_stochastic --- Project.toml | 2 +- src/utils.jl | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 9a739b9..22ddb54 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StateSpaceLearning" uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b" authors = ["andreramosfc "] -version = "2.0.10" +version = "2.0.11" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/utils.jl b/src/utils.jl index 02c8602..5750b60 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -153,9 +153,13 @@ function get_stochastic_values( valid_indices = filter(idx -> start_idx <= idx <= final_idx, seasonal_indices) # Sample with randomness and sign flip - stochastic_term[t, :] = - rand(estimated_stochastic[valid_indices], N_scenarios) .* - rand([1, -1], N_scenarios) + if !isempty(estimated_stochastic[valid_indices]) + stochastic_term[t, :] = + rand(estimated_stochastic[valid_indices], N_scenarios) .* + rand([1, -1], N_scenarios) + else + stochastic_term[t, :] .= 0.0 + end end else stochastic_term =