Skip to content

Commit 2fe829a

Browse files
committed
Add poly_design example
1 parent ab006f1 commit 2fe829a

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

test-data/ert/poly_design/POLY_EVAL

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EXECUTABLE poly_eval.py

test-data/ert/poly_design/poly.ert

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
QUEUE_SYSTEM LOCAL
2+
QUEUE_OPTION LOCAL MAX_RUNNING 10
3+
4+
RUNPATH poly_out/realization-<IENS>/iter-<ITER>
5+
6+
REALIZATION_MEMORY 50mb
7+
8+
NUM_REALIZATIONS 10
9+
MIN_REALIZATIONS 1
10+
11+
GEN_DATA POLY_RES RESULT_FILE:poly.out
12+
13+
DESIGN_MATRIX poly_design.xlsx DESIGN_SHEET:DesignSheet01 DEFAULT_SHEET:DefaultSheet
14+
15+
INSTALL_JOB poly_eval POLY_EVAL
16+
FORWARD_MODEL poly_eval
6.05 KB
Binary file not shown.
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
import json
3+
4+
5+
def _load_coeffs(filename):
6+
with open(filename, encoding="utf-8") as f:
7+
return json.load(f)["DESIGN_MATRIX"]
8+
9+
10+
def _evaluate(coeffs, x):
11+
return coeffs["a"] * x**2 + coeffs["b"] * x + coeffs["c"]
12+
13+
14+
if __name__ == "__main__":
15+
coeffs = _load_coeffs("parameters.json")
16+
output = [_evaluate(coeffs, x) for x in range(10)]
17+
with open("poly.out", "w", encoding="utf-8") as f:
18+
f.write("\n".join(map(str, output)))

0 commit comments

Comments
 (0)