Skip to content

Commit 0b41c88

Browse files
authored
Merge pull request #71 from BrainAnnex/dev
Dev Release Candidate 0
2 parents fddc5b3 + 9cc02e6 commit 0b41c88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+585468
-315233
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,4 @@ dmypy.json
131131
/.idea
132132

133133
# Project-specific
134+
/experiments/PRIVATE/

experiments/1D/diffusion/diffusion_along_gradient_1.ipynb

Lines changed: 76 additions & 73 deletions
Large diffs are not rendered by default.

experiments/1D/diffusion/diffusion_along_gradient_1.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@
1717
# A single chemical, whose initial concentration is a mix of a bell shape and a gradient.
1818
# Contrary to perhaps an intuition of a "pile sliding down a sand dune as a unit", the concentration peak
1919
# remains in place, and simply spreads out from there
20-
#
21-
# LAST REVISED: June 23, 2024 (using v. 1.0 beta34.1)
2220

2321
# %%
24-
import set_path # Importing this module will add the project's home directory to sys.path
22+
LAST_REVISED = "Nov. 12, 2024"
23+
LIFE123_VERSION = "1.0.0.rc.0" # Library version this experiment is based on
24+
25+
# %%
26+
#import set_path # Using MyBinder? Uncomment this before running the next cell!
2527

2628
# %%
27-
from life123 import BioSim1D
29+
#import sys
30+
#sys.path.append("C:/some_path/my_env_or_install") # CHANGE to the folder containing your venv or libraries installation!
31+
# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path
2832

29-
from life123 import ChemData as chem
33+
from life123 import BioSim1D, ChemData
3034

3135
# %%
3236
# Initialize the system
33-
chem_data = chem(names=["A"], diffusion_rates=[10.])
37+
chem_data = ChemData(names=["A"], diffusion_rates=[10.])
3438

3539
bio = BioSim1D(n_bins=200, chem_data=chem_data)
3640

experiments/1D/diffusion/gradient_1.ipynb

Lines changed: 98 additions & 97 deletions
Large diffs are not rendered by default.

experiments/1D/diffusion/gradient_1.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@
1818
#
1919
# The system starts out with a uniform concentration.
2020
# Then identical concentrations are repeatedly *injected to the left* and *drained from the right*
21-
#
22-
# LAST REVISED: June 23, 2024 (using v. 1.0 beta34.1)
2321

2422
# %%
25-
import set_path # Importing this module will add the project's home directory to sys.path
23+
LAST_REVISED = "Nov. 12, 2024"
24+
LIFE123_VERSION = "1.0.0.rc.0" # Library version this experiment is based on
25+
26+
# %%
27+
#import set_path # Using MyBinder? Uncomment this before running the next cell!
2628

2729
# %%
30+
#import sys
31+
#sys.path.append("C:/some_path/my_env_or_install") # CHANGE to the folder containing your venv or libraries installation!
32+
# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path
33+
2834
from experiments.get_notebook_info import get_notebook_basename
2935

30-
from life123 import BioSim1D
36+
from life123 import BioSim1D, ChemData, GraphicLog, HtmlLog as log
3137

3238
import plotly.express as px
3339

34-
from life123 import ChemData as chem
35-
from life123 import HtmlLog as log
36-
from life123 import GraphicLog
37-
3840
# %%
3941
# Initialize the HTML logging
4042
log_file = get_notebook_basename() + ".log.htm" # Use the notebook base filename for the log file
@@ -56,7 +58,7 @@
5658

5759
# %%
5860
# Initialize the system with a uniform concentration (of the only species)
59-
chem_data = chem(names=["A"], diffusion_rates=[0.6])
61+
chem_data = ChemData(names=["A"], diffusion_rates=[0.6])
6062
bio = BioSim1D(n_bins=9, chem_data=chem_data)
6163

6264
bio.set_uniform_concentration(species_index=0, conc=100.)

experiments/1D/diffusion/validate_diffusion_1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from life123 import BioSim1D
3030
from life123 import ChemData as chem
31-
from life123 import MovieArray
31+
from life123 import CollectionArray
3232
from life123 import Numerical as num
3333

3434
import numpy as np
@@ -78,7 +78,7 @@
7878

7979
# %%
8080
# All the system states will get collected in this object
81-
history = MovieArray()
81+
history = CollectionArray()
8282

8383
# %%
8484
# Store the initial state

experiments/1D/diffusion/validate_diffusion_2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
from life123 import BioSim1D
3636
from life123 import ChemData as chem
37-
from life123 import MovieArray
37+
from life123 import CollectionArray
3838
from life123 import Numerical as num
3939

4040
import numpy as np
@@ -79,7 +79,7 @@
7979

8080
# %%
8181
# All the system state will get collected in this object
82-
history = MovieArray()
82+
history = CollectionArray()
8383

8484
# %%
8585
# Store the initial state
@@ -157,7 +157,7 @@
157157
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
158158

159159
# %%
160-
history = MovieArray() # All the system state will get collected in this object
160+
history = CollectionArray() # All the system state will get collected in this object
161161
# Store the initial state
162162
arr = bio.lookup_species(species_index=0, copy=True)
163163
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -215,7 +215,7 @@
215215
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
216216

217217
# %%
218-
history = MovieArray() # All the system state will get collected in this object
218+
history = CollectionArray() # All the system state will get collected in this object
219219
# Store the initial state
220220
arr = bio.lookup_species(species_index=0, copy=True)
221221
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -274,7 +274,7 @@
274274
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
275275

276276
# %%
277-
history = MovieArray() # All the system state will get collected in this object
277+
history = CollectionArray() # All the system state will get collected in this object
278278
# Store the initial state
279279
arr = bio.lookup_species(species_index=0, copy=True)
280280
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -332,7 +332,7 @@
332332
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
333333

334334
# %%
335-
history = MovieArray() # All the system state will get collected in this object
335+
history = CollectionArray() # All the system state will get collected in this object
336336
# Store the initial state
337337
arr = bio.lookup_species(species_index=0, copy=True)
338338
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -391,7 +391,7 @@
391391
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
392392

393393
# %%
394-
history = MovieArray() # All the system state will get collected in this object
394+
history = CollectionArray() # All the system state will get collected in this object
395395
# Store the initial state
396396
arr = bio.lookup_species(species_index=0, copy=True)
397397
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -448,7 +448,7 @@
448448
bio.inject_sine_conc(species_name="A", frequency=2, amplitude=8)
449449

450450
# %%
451-
history = MovieArray() # All the system state will get collected in this object
451+
history = CollectionArray() # All the system state will get collected in this object
452452
# Store the initial state
453453
arr = bio.lookup_species(species_index=0, copy=True)
454454
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")

experiments/1D/diffusion/validate_diffusion_3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from life123 import BioSim1D
3131
from life123 import ChemData as chem
32-
from life123 import MovieArray
32+
from life123 import CollectionArray
3333
from life123 import Numerical as num
3434

3535
import numpy as np
@@ -74,7 +74,7 @@
7474
# #### Now do 4 rounds of single-step diffusion, to collect the system state at a total of 5 time points: t0 (the initial state), plus t1, t2, t3 and t4
7575

7676
# %%
77-
history = MovieArray() # All the system state will get collected in this object
77+
history = CollectionArray() # All the system state will get collected in this object
7878
# Store the initial state
7979
arr = bio.lookup_species(species_index=0, copy=True)
8080
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")
@@ -137,7 +137,7 @@
137137
# #### Now do 4 rounds of single-step diffusion, to collect the system state at a total of 5 time points: t0 (the initial state), plus t1, t2, t3 and t4
138138

139139
# %%
140-
history = MovieArray() # All the system state will get collected in this object
140+
history = CollectionArray() # All the system state will get collected in this object
141141
# Store the initial state
142142
arr = bio.lookup_species(species_index=0, copy=True)
143143
history.store(par=bio.system_time, data_snapshot=arr, caption=f"State at time {bio.system_time}")

experiments/1D/reaction_diffusion/rd_1.ipynb

Lines changed: 116 additions & 114 deletions
Large diffs are not rendered by default.

experiments/1D/reaction_diffusion/rd_1.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@
2626
#
2727
# A LOT of plots are sent to the log file from this experiment; the reason is to compare two
2828
# graphic elements, "vue_curves_3" and "vue_curves_4"
29-
#
30-
# LAST REVISED: June 23, 2024 (using v. 1.0 beta34.1)
3129

3230
# %%
33-
import set_path # Importing this module will add the project's home directory to sys.path
31+
LAST_REVISED = "Nov. 13, 2024"
32+
LIFE123_VERSION = "1.0.0.rc.0" # Library version this experiment is based on
33+
34+
# %%
35+
#import set_path # Using MyBinder? Uncomment this before running the next cell!
3436

3537
# %%
38+
#import sys
39+
#sys.path.append("C:/some_path/my_env_or_install") # CHANGE to the folder containing your venv or libraries installation!
40+
# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path
41+
3642
from experiments.get_notebook_info import get_notebook_basename
3743

38-
from life123 import BioSim1D
44+
from life123 import BioSim1D, ChemData, GraphicLog, HtmlLog as log
3945

4046
import plotly.express as px
41-
from life123 import ChemData as chem
42-
from life123 import HtmlLog as log
43-
from life123 import GraphicLog
4447

4548
# %%
4649
# Initialize the HTML logging
@@ -53,7 +56,7 @@
5356

5457
# %%
5558
# Initialize the system
56-
chem_data = chem(names=["A", "B", "C"], diffusion_rates=[50., 50., 1.])
59+
chem_data = ChemData(names=["A", "B", "C"], diffusion_rates=[50., 50., 1.])
5760

5861

5962

0 commit comments

Comments
 (0)