Skip to content

Commit fb7e87c

Browse files
committed
Temporary fix: restore experiment design types when reloading CSV outputs
1 parent 0ce67e1 commit fb7e87c

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

simopt/data_farming_base.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from contextlib import suppress
88
from copy import deepcopy
99
from pathlib import Path
10-
from typing import Literal
10+
from typing import Any, Literal
1111

1212
import pandas as pd
1313

@@ -141,7 +141,7 @@ def simulate(self, num_macroreps: int = 1) -> None:
141141
response_key: {
142142
factor_key: [] for factor_key in gradients[response_key]
143143
}
144-
for response_key in responses
144+
for response_key in gradients
145145
}
146146
# Append responses and gradients.
147147
for key in self.responses:
@@ -266,6 +266,20 @@ def __init__(
266266
sep="\t",
267267
encoding="utf-8",
268268
)
269+
270+
def fn(x: Any) -> Any: # noqa: ANN401
271+
import ast
272+
273+
if isinstance(x, str):
274+
try:
275+
return ast.literal_eval(x)
276+
except Exception:
277+
return x
278+
279+
return x
280+
281+
design_table = design_table.applymap(fn)
282+
269283
# If we don't have factor headers, use the column names from the design table.
270284
if not factor_headers:
271285
factor_headers = design_table.columns.tolist()

0 commit comments

Comments
 (0)