#!/usr/bin/env python # coding: utf-8 # # Membranes in 1D : Data Structure # # ## Data Structure and Visualization of Membranes in 1D # # No simulations done here; for diffusion and transport across membranes, please see `membranes_2` and other experiments # ### TAGS : "membranes 1D", "basic", "quick-start" # In[1]: LAST_REVISED = "June 4, 2025" LIFE123_VERSION = "1.0.0rc6" # Library version this experiment is based on # In[2]: #import set_path # Using MyBinder? Uncomment this before running the next cell! # In[3]: #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 # In[4]: check_version(LIFE123_VERSION) # In[ ]: # ## Prepare the initial system # with a single non-zero bin concentration of the single chemical `A`, near the left edge of the system # In[5]: chem_data = ChemData(names=["A", "B"], plot_colors=["turquoise", "green"]) bio = BioSim1D(n_bins=21, chem_data=chem_data) # In[6]: 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() # In[7]: bio.system_snapshot() # In[8]: bio.visualize_system() # Line curve view # In[9]: bio.system_heatmaps(text_format=".0f") # In[ ]: # # Add Membranes # In[10]: bio.membranes().set_membranes(membranes=[ (0, 5) ]) # In[11]: bio.membranes().membrane_list # In[12]: bio.system_heatmaps(text_format=".0f") # In[13]: bio.membranes().set_membranes(membranes=[ (0, 5), (10, 11), (16,21) ]) # Overwrite previous membranes # In[14]: bio.system_heatmaps(text_format=".0f") # In[ ]: