File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
pymc_experimental/statespace/utils Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,18 @@ def add_data_to_active_model(values, index):
112112 if OBS_STATE_DIM in pymc_mod .coords :
113113 data_dims = [TIME_DIM , OBS_STATE_DIM ]
114114
115- pymc_mod .add_coord (TIME_DIM , index )
115+ if TIME_DIM not in pymc_mod .coords :
116+ pymc_mod .add_coord (TIME_DIM , index )
117+ else :
118+ found_time = pymc_mod .coords [TIME_DIM ]
119+ if found_time is None :
120+ pymc_mod .coords .update ({TIME_DIM : index })
121+ elif not np .array_equal (found_time , index ):
122+ raise ValueError (
123+ "Provided data has a different time index than the model. Please ensure that the time values "
124+ "set on coords matches that of the exogenous data."
125+ )
126+
116127 data = pm .Data ("data" , values , dims = data_dims )
117128
118129 return data
You can’t perform that action at this time.
0 commit comments