Skip to content

Commit e5741c8

Browse files
committed
Produce or load trajectories
1 parent a07cfc7 commit e5741c8

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

experiments/SynthBN/scripts/sample_trajectories_biodivine.jl

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@ using DrWatson
44

55
using DataFrames
66
using GraphDynamicalSystems: BooleanNetworks
7+
using Term: Progress, ProgressBar
8+
using MetaGraphsNext
79

810
mg_df = collect_results!(datadir("src_parsed", "biodivine_benchmark_as_metagraphs"))
11+
mg_df[!, :ID] = ((x -> x[1]) splitext basename).(mg_df.path)
12+
mg_df_by_id = groupby(mg_df, :ID)
913

10-
param_setup = Dict(
11-
"bn" => mg_df.metagraph_model,
12-
"id" => ((x -> x[1]) splitext basename).(mg_df.path),
13-
"n_trajectories" => 1000,
14-
"iterations" => 1000,
15-
)
14+
param_setup = Dict("id" => mg_df.ID, "n_trajectories" => 1000, "iterations" => 1000)
1615
all_params = dict_list(param_setup)
1716

18-
for params in all_params
19-
@produce_or_load(params, datadir("sims", "biodivine_trajectories"),) do params
20-
@unpack bn, n_trajectories, iterations = params
17+
pbar = ProgressBar(; columns = :detailed)
18+
Progress.foreachprogress(
19+
all_params,
20+
pbar;
21+
parallel = true,
22+
description = "Collecting trajectories",
23+
) do params
24+
@produce_or_load(params, path = datadir("sims", "biodivine_trajectories"),) do params
25+
@unpack id, n_trajectories, iterations = params
26+
bn = mg_df_by_id[(id,)].metagraph_model[1]
27+
trajectories = []
2128
for traj_i = 1:n_trajectories
2229
async_bn = BooleanNetworks.abn(bn; seed = traj_i)
23-
gather_bn_data(async_bn, iterations)
30+
push!(trajectories, gather_bn_data(async_bn, iterations))
2431
end
32+
@strdict trajectories
2533
end
2634
end

0 commit comments

Comments
 (0)