-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrun_wrapper.py
40 lines (29 loc) · 1.06 KB
/
run_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pandas as pd
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
from cadCAD.configuration import Experiment
from cadCAD import configs
def run(drop_midsteps: bool=True) -> pd.DataFrame:
exec_mode = ExecutionMode()
exec_context = ExecutionContext(exec_mode.local_mode)
run = Executor(exec_context=exec_context, configs=configs)
# results = pd.DataFrame()
(system_events, tensor_field, sessions) = run.execute()
df = pd.DataFrame(system_events)
if drop_midsteps:
max_substep = max(df.substep)
is_droppable = (df.substep != max_substep)
is_droppable &= (df.substep != 0)
df = df.loc[~is_droppable]
return (df.reset_index(), tensor_field, sessions)
# if __name__ == '__main__':
# import sys
# # check
# sys.path.append('./src')
# from config_wrapper import ConfigWrapper
# # import options as options
# # change
# import model as model
# config = ConfigWrapper(market_model)
# config.append()
# results = run(drop_midsteps=True)
# print(results)