Skip to content

Commit

Permalink
composites run using docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
blairlyons committed Jun 9, 2022
1 parent 4fcd2b9 commit 81a076f
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 359 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,5 @@ cython_debug/
.python-version
/in
/out
/working
*.simularium
13 changes: 5 additions & 8 deletions vivarium_models/composites/actin_fiber.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import numpy as np
import argparse

from vivarium.core.composer import Composer
from vivarium.core.engine import Engine
from vivarium.processes.alternator import Alternator, PeriodicEvent
Expand All @@ -9,10 +6,10 @@
from vivarium_medyan import MedyanProcess
from vivarium_models.processes.monomer_to_fiber import MonomerToFiber
from vivarium_models.processes.fiber_to_monomer import FiberToMonomer
from vivarium_models.data.fibers import initial_fibers
from vivarium_models.data.fibers import centered_initial_fibers

READDY_TIMESTEP = 0.0000001
ALTERNATOR_PERIODS = [10.0, READDY_TIMESTEP]
ALTERNATOR_PERIODS = [2.0, READDY_TIMESTEP]


class ActinFiber(Composer):
Expand All @@ -22,7 +19,7 @@ class ActinFiber(Composer):
"time_step": READDY_TIMESTEP,
"_condition": ("choices", "readdy_active"),
},
"medyan": {"time_step": 5.0, "_condition": ("choices", "medyan_active")},
"medyan": {"time_step": 2.0, "_condition": ("choices", "medyan_active")},
"fiber_to_monomer": {"_condition": ("choices", "medyan_active")},
"monomer_to_fiber": {"_condition": ("choices", "readdy_active")},
"alternator": {"choices": ["medyan_active", "readdy_active"]},
Expand Down Expand Up @@ -85,7 +82,7 @@ def generate_topology(self, config):


def test_actin_fiber():
initial_state = initial_fibers
initial_state = centered_initial_fibers()
initial_state["choices"] = {"medyan_active": True, "readdy_active": False}
medyan_config = {
"template_directory": "vivarium_models/templates/",
Expand All @@ -102,7 +99,7 @@ def test_actin_fiber():
emitter="simularium",
emit_processes=True,
)
engine.update(15)
engine.update(5)
engine.emitter.get_data()


Expand Down
250 changes: 14 additions & 236 deletions vivarium_models/composites/filament_alternatives.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import numpy as np
import argparse

from vivarium.core.composer import Composer
from vivarium.core.engine import Engine
from vivarium.processes.alternator import Alternator, PeriodicEvent

from vivarium_medyan import MedyanProcess
from vivarium_cytosim import CytosimProcess
from vivarium_models.data.fibers import centered_initial_fibers

ALTERNATOR_PERIODS = [2.0, 2.0]

Expand Down Expand Up @@ -64,251 +62,31 @@ def generate_topology(self, config):


def test_filament_alternatives():
parser = argparse.ArgumentParser(description="Run a MEDYAN simulation")
parser.add_argument(
"medyan_executable_path",
help="the file path to the MEDYAN executable",
)
args = parser.parse_args()
initial_state = {
"choices": {"medyan_active": False, "cytosim_active": True},
"fibers": {
"1": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 912.50000000, 1000.00000000]),
np.array([3160.00000000, 912.50000000, 1000.00000000]),
],
},
"2": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 947.50000000, 939.37822174]),
np.array([3160.00000000, 947.50000000, 939.37822174]),
],
},
"3": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 930.00000000, 969.68911087]),
np.array([3160.00000000, 930.00000000, 969.68911087]),
],
},
"4": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 947.50000000, 1000.00000000]),
np.array([3160.00000000, 947.50000000, 1000.00000000]),
],
},
"5": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 930.00000000, 1030.31088913]),
np.array([3160.00000000, 930.00000000, 1030.31088913]),
],
},
"6": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 947.50000000, 1060.62177826]),
np.array([3160.00000000, 947.50000000, 1060.62177826]),
],
},
"7": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 965.00000000, 909.06733260]),
np.array([3160.00000000, 965.00000000, 909.06733260]),
],
},
"8": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 982.50000000, 939.37822174]),
np.array([3160.00000000, 982.50000000, 939.37822174]),
],
},
"9": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 965.00000000, 969.68911087]),
np.array([3160.00000000, 965.00000000, 969.68911087]),
],
},
"10": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 982.50000000, 1000.00000000]),
np.array([3160.00000000, 982.50000000, 1000.00000000]),
],
},
"11": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 965.00000000, 1030.31088913]),
np.array([3160.00000000, 965.00000000, 1030.31088913]),
],
},
"12": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 982.50000000, 1060.62177826]),
np.array([3160.00000000, 982.50000000, 1060.62177826]),
],
},
"13": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 965.00000000, 1090.93266740]),
np.array([3160.00000000, 965.00000000, 1090.93266740]),
],
},
"14": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1000.00000000, 909.06733260]),
np.array([3160.00000000, 1000.00000000, 909.06733260]),
],
},
"15": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1017.50000000, 939.37822174]),
np.array([3160.00000000, 1017.50000000, 939.37822174]),
],
},
"16": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1000.00000000, 969.68911087]),
np.array([3160.00000000, 1000.00000000, 969.68911087]),
],
},
"17": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1017.50000000, 1000.00000000]),
np.array([3160.00000000, 1017.50000000, 1000.00000000]),
],
},
"18": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1000.00000000, 1030.31088913]),
np.array([3160.00000000, 1000.00000000, 1030.31088913]),
],
},
"19": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1017.50000000, 1060.62177826]),
np.array([3160.00000000, 1017.50000000, 1060.62177826]),
],
},
"20": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1000.00000000, 1090.93266740]),
np.array([3160.00000000, 1000.00000000, 1090.93266740]),
],
},
"21": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1035.00000000, 909.06733260]),
np.array([3160.00000000, 1035.00000000, 909.06733260]),
],
},
"22": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1052.50000000, 939.37822174]),
np.array([3160.00000000, 1052.50000000, 939.37822174]),
],
},
"23": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1035.00000000, 969.68911087]),
np.array([3160.00000000, 1035.00000000, 969.68911087]),
],
},
"24": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1052.50000000, 1000.00000000]),
np.array([3160.00000000, 1052.50000000, 1000.00000000]),
],
},
"25": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1035.00000000, 1030.31088913]),
np.array([3160.00000000, 1035.00000000, 1030.31088913]),
],
},
"26": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1052.50000000, 1060.62177826]),
np.array([3160.00000000, 1052.50000000, 1060.62177826]),
],
},
"27": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1035.00000000, 1090.93266740]),
np.array([3160.00000000, 1035.00000000, 1090.93266740]),
],
},
"28": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1070.00000000, 969.68911087]),
np.array([3160.00000000, 1070.00000000, 969.68911087]),
],
},
"29": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1087.50000000, 1000.00000000]),
np.array([3160.00000000, 1087.50000000, 1000.00000000]),
],
},
"30": {
"type_name": "Actin-Polymer",
"points": [
np.array([1000.00000000, 1070.00000000, 1030.31088913]),
np.array([3160.00000000, 1070.00000000, 1030.31088913]),
],
},
},
}

initial_state = centered_initial_fibers()
initial_state["choices"] = {"medyan_active": False, "cytosim_active": True}
medyan_config = {
"medyan_executable": args.medyan_executable_path, # "...../medyan/build/medyan"
"transform_points": [2000, 1000, 1000],
"template_directory": "vivarium_models/templates/",
"transform_points": [2000.0, 1000.0, 1000.0],
"filament_projection_type": "PREDEFINED",
}
cytosim_config = {
"template_directory": "vivarium_models/templates/",
}
filament_alternatives_config = {
"medyan": medyan_config,
"cytosim": cytosim_config,
}

filament_alternatives_config = {"medyan": medyan_config}
filament_alternatives = FilamentAlternatives(filament_alternatives_config)

composite = filament_alternatives.generate()
composite["initial_state"] = initial_state

engine = Engine(
processes=composite["processes"],
topology=composite["topology"],
initial_state=composite["initial_state"],
emitter="simularium",
emit_processes=True,
)

# import ipdb; ipdb.set_trace()

engine.update(10)

engine.update(6)
engine.emitter.get_data()


Expand Down
11 changes: 11 additions & 0 deletions vivarium_models/data/fibers.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,14 @@
},
},
}


def centered_initial_fibers():
result = initial_fibers
for fiber_id in initial_fibers["fibers"]:
fiber_points = initial_fibers["fibers"][fiber_id]["points"]
for point_index in range(len(fiber_points)):
result["fibers"][fiber_id]["points"][point_index] = (
fiber_points[point_index] - 0.5 * initial_fibers["fibers_box_extent"]
)
return result
2 changes: 1 addition & 1 deletion vivarium_models/library/scan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from vivarium.core.engine import Engine, pf
from vivarium.core.engine import Engine


class Scan:
Expand Down
2 changes: 1 addition & 1 deletion vivarium_models/processes/fiber_to_monomer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def ports_schema(self):
},
"monomers": {
"box_center": {
"_default": np.array([3000.0, 1000.0, 1000.0]),
"_default": np.array([1000.0, 0.0, 0.0]),
"_updater": "set",
"_emit": True,
},
Expand Down
Loading

0 comments on commit 81a076f

Please sign in to comment.