Skip to content

Commit

Permalink
set up funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
olive004 committed Oct 27, 2024
1 parent 8d43ecb commit 75805ed
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions notebooks/23_Monte_Carlo_adaptability_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,15 @@
"\n",
"\n",
"def mutate(circuits):\n",
" return circuits\n"
" return circuits\n",
"\n",
"\n",
"def simulate(y00, reverse_rates):\n",
" sol_steady_states = jax.vmap(bioreaction_sim_dfx_expanded)(y00, reverse_rates)\n",
" y01 = np.array(sol_steady_states.ys[:, -1])\n",
" y01[:, np.array(idxs_signal)] = y01[:, np.array(idxs_signal)] * signal_target\n",
" sol_signal = jax.vmap(bioreaction_sim_dfx_expanded)(y01, reverse_rates)\n",
" return sol_steady_states, sol_signal\n"
]
},
{
Expand All @@ -300,16 +308,16 @@
"metadata": {},
"outputs": [],
"source": [
"starting = reverse_rates\n",
"\n",
"for step in range(total_steps):\n",
" \n",
" print(f'\\n\\nStarting step {step+1} out of {total_steps}\\n\\n')\n",
"\n",
" batch = mutate(starting, evolver, algorithm=config['mutations_args']['algorithm'])\n",
" batch = simulate(batch, modeller, config)\n",
" batch = mutate(starting)\n",
" batch = simulate(y00, batch)\n",
" starting, summary_data = choose_next(batch=expanded_batchs, data_writer=data_writer, distance_func=distance_func, \n",
" choose_max=choose_max, target_species=target_species, use_diversity=config.get('use_diversity', False))\n",
" starting = process_for_next_run(starting, data_writer=data_writer)\n",
" "
]
}
Expand Down

0 comments on commit 75805ed

Please sign in to comment.