LAST_REVISED = "June 4, 2025"
LIFE123_VERSION = "1.0.0rc6" # Library version this experiment is based on
#import set_path # Using MyBinder? Uncomment this before running the next cell!
#import sys, os
#os.getcwd()
#sys.path.append("C:/some_path/my_env_or_install") # CHANGE to the folder containing your venv or libraries installation!
# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path
from life123 import BioSim1D, ChemData, check_version
check_version(LIFE123_VERSION)
OK
with a single non-zero bin concentration of the single chemical A, near the left edge of the system
chem_data = ChemData(names=["A", "B"], plot_colors=["turquoise", "green"])
bio = BioSim1D(n_bins=21, chem_data=chem_data)
bio.inject_gradient(chem_label="A", conc_left = 0., conc_right = 100.)
bio.inject_sine_conc(chem_label="B", number_cycles=2, amplitude=5., bias=10., phase=0)
bio.describe_state()
SYSTEM STATE at Time t = 0: 21 bins and 2 chemical species
| Species | Diff rate | Bin 0 | Bin 1 | Bin 2 | Bin 3 | Bin 4 | Bin 5 | Bin 6 | Bin 7 | ... | Bin 11 | Bin 12 | Bin 13 | Bin 14 | Bin 15 | Bin 16 | Bin 17 | Bin 18 | Bin 19 | Bin 20 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | A | None | 0.0 | 5.0000 | 10.000000 | 15.00000 | 20.000000 | 25.000000 | 30.000000 | 35.000000 | ... | 55.000000 | 60.000000 | 65.000000 | 70.000000 | 75.000000 | 80.000000 | 85.000000 | 90.00000 | 95.000000 | 100.0000 |
| 1 | B | None | 10.0 | 12.8166 | 14.654369 | 14.87464 | 13.400864 | 10.745211 | 7.830581 | 5.669873 | ... | 11.473776 | 13.909157 | 14.986019 | 14.330127 | 12.169419 | 9.254789 | 6.599136 | 5.12536 | 5.345631 | 7.1834 |
2 rows × 23 columns
bio.system_snapshot()
| A | B | |
|---|---|---|
| 0 | 0.0 | 10.000000 |
| 1 | 5.0 | 12.816600 |
| 2 | 10.0 | 14.654369 |
| 3 | 15.0 | 14.874640 |
| 4 | 20.0 | 13.400864 |
| 5 | 25.0 | 10.745211 |
| 6 | 30.0 | 7.830581 |
| 7 | 35.0 | 5.669873 |
| 8 | 40.0 | 5.013981 |
| 9 | 45.0 | 6.090843 |
| 10 | 50.0 | 8.526224 |
| 11 | 55.0 | 11.473776 |
| 12 | 60.0 | 13.909157 |
| 13 | 65.0 | 14.986019 |
| 14 | 70.0 | 14.330127 |
| 15 | 75.0 | 12.169419 |
| 16 | 80.0 | 9.254789 |
| 17 | 85.0 | 6.599136 |
| 18 | 90.0 | 5.125360 |
| 19 | 95.0 | 5.345631 |
| 20 | 100.0 | 7.183400 |
bio.visualize_system() # Line curve view
bio.system_heatmaps(text_format=".0f")
bio.membranes().set_membranes(membranes=[ (0, 5) ])
bio.membranes().membrane_list
[(0, 5)]
bio.system_heatmaps(text_format=".0f")
bio.membranes().set_membranes(membranes=[ (0, 5), (10, 11), (16,21) ]) # Overwrite previous membranes
bio.system_heatmaps(text_format=".0f")