From 9f56d05d6ea4c163cd30b94013c3eb1ffb6b6b11 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Thu, 26 Dec 2024 16:12:20 -0700 Subject: [PATCH 1/5] update assertions --- src/simulation/simulation_state.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation_state.jl b/src/simulation/simulation_state.jl index 6dd7dc0cbf..c089ef185f 100644 --- a/src/simulation/simulation_state.jl +++ b/src/simulation/simulation_state.jl @@ -158,7 +158,8 @@ function _initialize_system_states!( dm_cols = get_column_names(key, get_dataset(decision_states, key)) if has_dataset(emulator_states, key) em_cols = get_column_names(key, get_dataset(emulator_states, key)) - @assert_op dm_cols == em_cols + @assert_op length(dm_cols) == length(em_cols) + @assert isempty(symdiff(dm_cols, em_cols)) continue end From 2ed22fc1b56026a10fe5ab90f5d17c63720f07d2 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Thu, 26 Dec 2024 16:42:10 -0700 Subject: [PATCH 2/5] change assert for error --- src/simulation/simulation_state.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation_state.jl b/src/simulation/simulation_state.jl index c089ef185f..4b0daacf9f 100644 --- a/src/simulation/simulation_state.jl +++ b/src/simulation/simulation_state.jl @@ -159,7 +159,9 @@ function _initialize_system_states!( if has_dataset(emulator_states, key) em_cols = get_column_names(key, get_dataset(emulator_states, key)) @assert_op length(dm_cols) == length(em_cols) - @assert isempty(symdiff(dm_cols, em_cols)) + if !isempty(symdiff(dm_cols, em_cols)) + error("Mismatch in column names for dataset $key: $(symdiff(dm_cols, em_cols))") + end continue end From 5da44385f25c03ff16354b273b47b6357433dc38 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Mon, 6 Jan 2025 16:23:54 -0700 Subject: [PATCH 3/5] formatter --- src/simulation/simulation_state.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation_state.jl b/src/simulation/simulation_state.jl index 4b0daacf9f..11ccf6c643 100644 --- a/src/simulation/simulation_state.jl +++ b/src/simulation/simulation_state.jl @@ -160,7 +160,9 @@ function _initialize_system_states!( em_cols = get_column_names(key, get_dataset(emulator_states, key)) @assert_op length(dm_cols) == length(em_cols) if !isempty(symdiff(dm_cols, em_cols)) - error("Mismatch in column names for dataset $key: $(symdiff(dm_cols, em_cols))") + error( + "Mismatch in column names for dataset $key: $(symdiff(dm_cols, em_cols))", + ) end continue end From 53927a06a197460b60accbc26b6688185bfc9e0e Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Mon, 6 Jan 2025 17:14:44 -0700 Subject: [PATCH 4/5] extract the col names from tuple --- src/simulation/simulation_state.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/simulation_state.jl b/src/simulation/simulation_state.jl index 11ccf6c643..fbd1422d54 100644 --- a/src/simulation/simulation_state.jl +++ b/src/simulation/simulation_state.jl @@ -159,7 +159,7 @@ function _initialize_system_states!( if has_dataset(emulator_states, key) em_cols = get_column_names(key, get_dataset(emulator_states, key)) @assert_op length(dm_cols) == length(em_cols) - if !isempty(symdiff(dm_cols, em_cols)) + if !isempty(symdiff(first(dm_cols), first(em_cols))) error( "Mismatch in column names for dataset $key: $(symdiff(dm_cols, em_cols))", ) From 256029e9a8ebefb2a072d657d42a5ac3cc837875 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Wed, 8 Jan 2025 10:42:12 -0700 Subject: [PATCH 5/5] use error match the number of dimensions --- src/simulation/simulation_state.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation_state.jl b/src/simulation/simulation_state.jl index fbd1422d54..8dc1b66ce7 100644 --- a/src/simulation/simulation_state.jl +++ b/src/simulation/simulation_state.jl @@ -158,7 +158,11 @@ function _initialize_system_states!( dm_cols = get_column_names(key, get_dataset(decision_states, key)) if has_dataset(emulator_states, key) em_cols = get_column_names(key, get_dataset(emulator_states, key)) - @assert_op length(dm_cols) == length(em_cols) + if length(dm_cols) != length(em_cols) + error( + "The number of dimensions between the decision states and emulator states don't match", + ) + end if !isempty(symdiff(first(dm_cols), first(em_cols))) error( "Mismatch in column names for dataset $key: $(symdiff(dm_cols, em_cols))",