7
7
8
8
import numpy as np
9
9
10
- from ert .config import ErtConfig , ESSettings , HookRuntime , UpdateSettings
10
+ from ert .config import (
11
+ ErtConfig ,
12
+ ESSettings ,
13
+ HookRuntime ,
14
+ ParameterConfig ,
15
+ ScalarParameters ,
16
+ UpdateSettings ,
17
+ )
11
18
from ert .config .parsing .config_errors import ConfigValidationError
12
- from ert .enkf_main import sample_prior , save_design_matrix_to_ensemble
19
+ from ert .enkf_main import sample_prior
13
20
from ert .ensemble_evaluator import EvaluatorServerConfig
14
21
from ert .storage import Storage
15
22
from ert .trace import tracer
@@ -77,16 +84,20 @@ def run_experiment(
77
84
) -> None :
78
85
self .log_at_startup ()
79
86
80
- parameters_config = self ._parameter_configuration
81
- design_matrix = self ._design_matrix
82
- design_matrix_group = None
83
- if design_matrix is not None :
84
- try :
85
- parameters_config , design_matrix_group = (
86
- design_matrix .merge_with_existing_parameters (parameters_config )
87
- )
88
- except ConfigValidationError as exc :
89
- raise ErtRunError (str (exc )) from exc
87
+ if self ._design_matrix is not None :
88
+ parameters_config : list [ParameterConfig ] = []
89
+ for param in self ._parameter_configuration :
90
+ if isinstance (param , ScalarParameters ):
91
+ try :
92
+ new_scalar_config = (
93
+ self ._design_matrix .merge_with_existing_parameters (param )
94
+ )
95
+ parameters_config .append (new_scalar_config )
96
+ except ConfigValidationError as exc :
97
+ raise ErtRunError (str (exc )) from exc
98
+ else :
99
+ parameters_config .append (param )
100
+ self ._parameter_configuration = parameters_config
90
101
91
102
self .restart = restart
92
103
self .run_workflows (
@@ -95,8 +106,7 @@ def run_experiment(
95
106
)
96
107
ensemble_format = self .target_ensemble_format
97
108
experiment = self ._storage .create_experiment (
98
- parameters = parameters_config
99
- + ([design_matrix_group ] if design_matrix_group else []),
109
+ parameters = self ._parameter_configuration ,
100
110
observations = self ._observations ,
101
111
responses = self ._response_configuration ,
102
112
name = self .experiment_name ,
@@ -119,15 +129,13 @@ def run_experiment(
119
129
prior ,
120
130
np .where (self .active_realizations )[0 ],
121
131
random_seed = self .random_seed ,
132
+ design_matrix_df = (
133
+ self ._design_matrix .design_matrix_df
134
+ if self ._design_matrix is not None
135
+ else None
136
+ ),
122
137
)
123
138
124
- if design_matrix_group is not None and design_matrix is not None :
125
- save_design_matrix_to_ensemble (
126
- design_matrix .design_matrix_df ,
127
- prior ,
128
- np .where (self .active_realizations )[0 ],
129
- design_matrix_group .name ,
130
- )
131
139
self ._evaluate_and_postprocess (
132
140
prior_args ,
133
141
prior ,
0 commit comments