Skip to content

Commit 04b5053

Browse files
committed
start on bootstrap-init
1 parent 4a9d497 commit 04b5053

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from paths_cli.parameters import (
2+
MULTI_INIT_SNAP, MULTI_NETWORK, OUTPUT_FILE, INPUT_FILE
3+
)
4+
5+
@MULTI_INIT_SNAP.clicked()
6+
@MULTI_NETWORK.clicked()
7+
@OUTPUT_FILE.clicked()
8+
@INPUT_FILE.clicked()
9+
def bootstrap_init(init_frame, network, output_file, input_file):
10+
...
11+
12+
def _update_init_frames(transitions, init_frames):
13+
transition_to_init_frame = {}
14+
for transition in transitions:
15+
# raise error if not TIS transition
16+
transition_to_init_frame[transition] = None
17+
for snap in init_frames:
18+
if init_frame.initial_state(snap):
19+
transition_to_init_frame[transition] = snap
20+
break
21+
return transition_to_init_frame
22+
23+
24+
def bootstrap_init_main(init_frames, networks, output_file):
25+
all_transitions = {trans for trans in network.sampling_transitions
26+
for network in networks}
27+
trans_to_init_frame = _update_init_frames(all_transitions, init_frames)
28+
missing = {trans for trans, frame in trans_to_init_frame.items()
29+
if frame is None}
30+
# TODO warn about missing initial frames
31+
found = set(trans_to_init_frame) - missing
32+
completed = set()
33+
for transition in found:
34+
...
35+

paths_cli/parameters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@
8787
store='schemes'
8888
)
8989

90+
MULTI_INIT_SNAP = OPSStorageLoadMultiple(
91+
param=Option('-f', '--init-frame',
92+
help="identifier for potential initial snapshots"),
93+
store='snapshots',
94+
value_strategies=[GetByName('tags'), GetByNumber('snapshots')],
95+
none_strategies=[GetOnlySnapshot(),
96+
GetPredefinedName('tags', 'initial_snapshot')]
97+
)
98+
9099
INPUT_FILE = StorageLoader(
91100
param=Argument('input_file',
92101
type=click.Path(exists=True, readable=True)),

0 commit comments

Comments
 (0)