Commit f00a4bbc authored by Anton J Prassl's avatar Anton J Prassl
Browse files

making run scripts independent of calling directory

parent 20f93bf9
......@@ -14,14 +14,12 @@ Following optional arguments with their default values are available:
./run.py --model=MBRDR
./run.py --list
"""
import os, sys
EXAMPLE_DESCRIPTIVE_NAME = 'Electromechanical Single Cell Stretcher'
EXAMPLE_AUTHOR = 'Gernot Plank <gernot.plank@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
import math
import subprocess
import numpy as np
from datetime import date
from matplotlib import pyplot
......
......@@ -17,9 +17,6 @@ Following optional arguments with their default values are available:
from __future__ import print_function
import os
import sys
import math
import subprocess
import numpy as np
from datetime import date
......@@ -30,6 +27,7 @@ from carputils import tools
EXAMPLE_DESCRIPTIVE_NAME = 'Isolated Ionic Model'
EXAMPLE_AUTHOR = 'Anton Prassl <anton.prassl@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
MODEL_EXCLUDE_LIST = ['IION_SRC', 'UCLA_RAB_SCR']
......
......@@ -17,9 +17,6 @@ Following optional arguments with their default values are available:
from __future__ import print_function
import os
import sys
import math
import subprocess
import numpy as np
from datetime import date
......@@ -32,6 +29,7 @@ from carputils import divertoutput
EXAMPLE_DESCRIPTIVE_NAME = 'LIMPET Plugins'
EXAMPLE_AUTHOR = ('Anton Prassl <anton.prassl@medunigraz.at> and '
'Andrew Crozier <andrew.crozier@medunigraz.at>')
EXAMPLE_DIR = os.path.dirname(__file__)
AXIS_LABEL = {'Tension': 'Tension (kPa)'}
......@@ -43,7 +41,7 @@ def parser():
default='LR1',
help='select IMP model')
group.add_argument('--plugin',
default='FxStress',
default='LandStress',
help='select LIMPET plugin')
group.add_argument('--param', '-p',
nargs=2, action='append',
......
......@@ -3,12 +3,12 @@
"""
One dimensional cable EP simulation.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = '1D Cable Bidomain'
EXAMPLE_AUTHOR = 'Unassigned'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -16,6 +16,7 @@ from carputils import tools
from carputils import mesh
from carputils import testing
def parser():
parser = tools.standard_parser()
parser.add_argument('--spacing',
......@@ -50,7 +51,7 @@ def run(args, job):
geom.generate_carp(meshname)
# Get basic command line, including solver options
cmd = tools.carp_cmd('cable_1D.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'cable_1D.par'))
cmd += ['-simID', job.ID,
'-meshname', meshname]
......@@ -64,7 +65,7 @@ def run(args, job):
# Prepare file paths
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'vm.igb.gz')
view = 'cable_1D.mshz'
view = os.path.join(EXAMPLE_DIR, 'cable_1D.mshz')
# Call meshalyzer
job.meshalyzer(geom, data, view)
......
......@@ -3,12 +3,12 @@
"""
Demonstration and testing of checkpointing and restarting CARP.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Checkpoint and Restart'
EXAMPLE_AUTHOR = 'Gernot Plank <gernot.plank@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -63,7 +63,7 @@ def run(args, job):
meshname = mesh.generate(geom)
# define default view settings
view = 'checkpoint.mshz'
view = os.path.join(EXAMPLE_DIR, 'checkpoint.mshz')
# Simulation output directories
chkID = job.ID
......@@ -73,7 +73,7 @@ def run(args, job):
rstID = os.path.join(job.ID, 'restart')
# Add all the non-general arguments
cmd = tools.carp_cmd('checkpoint.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'checkpoint.par'))
cmd += ['-meshname', meshname]
if args.visualize:
......@@ -103,7 +103,7 @@ def run(args, job):
geom = os.path.join(chkID, os.path.basename(meshname)+'_i')
data = os.path.join(chkID, 'vm.igb')
view = 'checkpoint.mshz'
view = os.path.join(EXAMPLE_DIR, 'checkpoint.mshz')
job.gunzip(data)
job.meshalyzer(geom, data, view)
......@@ -111,7 +111,7 @@ def run(args, job):
if args.experiment == 'restart':
geom = os.path.join(rstID, os.path.basename(meshname)+'_i')
data = os.path.join(rstID, 'vm.igb')
view = 'restart.mshz'
view = os.path.join(EXAMPLE_DIR, 'restart.mshz')
job.gunzip(data)
job.meshalyzer(geom, data, view)
......
......@@ -7,12 +7,12 @@ The wedge contains transmural (Boukens et al. Cardiovasc Res 2015) as well as ap
.. image:: /images/ecg_setup.png
:scale: 60%
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'ECG simulation on a tissue wedge with heterogeneity'
EXAMPLE_AUTHOR = 'Fernando Campos <fernando.campos@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -240,7 +240,7 @@ def run(args, job):
'-lats[0].method', 1]
# ECG
ecg = ['-phie_rec_ptf','ecg',
ecg = ['-phie_rec_ptf', os.path.join(EXAMPLE_DIR, 'ecg'),
'-dump_ecg_leads', 1]
......@@ -272,7 +272,7 @@ def run(args, job):
# Prepare file paths
geom = os.path.join(simID, os.path.basename(meshname)+'_i')
data = os.path.join(simID, 'vm.igb')
view = 'view.mshz'
view = os.path.join(EXAMPLE_DIR, 'view.mshz')
# Call meshalyzer to show Vm
job.meshalyzer(geom, data, view)
......
......@@ -3,12 +3,12 @@
"""
Demonstration of solving Laplace's equation in CARP.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Laplace\'s Equation'
EXAMPLE_AUTHOR = 'Andrew Crozier <andrew.crozier@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -87,7 +87,7 @@ def run(args, job):
# Prepare file paths
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'phie.igb.gz')
view = 'laplace.mshz'
view = os.path.join(EXAMPLE_DIR, 'laplace.mshz')
# Call meshalyzer
job.meshalyzer(geom, data, view)
......
......@@ -3,12 +3,12 @@
"""
Compute activation times from bidomain simulation.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Activation Time Computation'
EXAMPLE_AUTHOR = 'Gernot Plank <gernot.plank@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
import numpy as np
from datetime import date
......@@ -237,7 +237,7 @@ def run(args, job):
lat = LATDetector(args.measurand, args.method, args.event, args.all)
# Add all the non-general arguments
cmd = tools.carp_cmd('lats.par')
cmd = tools.carp_cmd(os.path.join(os.path.dirname(__file__), 'lats.par'))
cmd += ['-simID', job.ID,
'-meshname', meshname,
......@@ -279,7 +279,7 @@ def run(args, job):
# choosing the first
data = os.path.join(job.ID, 'all_lats_0')
view = 'lats.mshz'
view = os.path.join(EXAMPLE_DIR, 'lats.mshz')
job.meshalyzer(geom, data, view)
......
......@@ -3,12 +3,12 @@
"""
Description TBD.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Bidomain without a Ground-type Stimulus'
EXAMPLE_AUTHOR = 'Aurel Neic <aurel.neic@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -49,7 +49,7 @@ def run(args, job):
meshname = mesh.generate(geom)
# Add all the non-general arguments
cmd = tools.carp_cmd('noground-bidom.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'noground-bidom.par'))
cmd += tools.gen_physics_opts(ExtraTags=[0, 1], IntraTags=[1])
cmd += ['-meshname', meshname,
......@@ -78,7 +78,7 @@ def run(args, job):
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'phie_i.igb.gz')
view = 'view_phie.mshz'
view = os.path.join(EXAMPLE_DIR, 'view_phie.mshz')
job.meshalyzer(geom, data, view)
......
......@@ -32,8 +32,8 @@ the results in meshalyzer:
./run.py --visualize
"""
import os, sys
import os
import sys
import numpy as np
from datetime import date
from shutil import copyfile
......@@ -47,7 +47,7 @@ from carputils import tools
EXAMPLE_DESCRIPTIVE_NAME = 'Phie Recovery'
EXAMPLE_AUTHOR = 'Anton Prassl <anton.prassl@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
isPy2 = True
if sys.version_info.major > 2:
......@@ -141,7 +141,7 @@ def plot_traces(job, sourceModel, phieFile):
geomfile = os.path.join(job.ID, 'block_i')
datafile = os.path.join(job.ID, 'vm.igb')
view = 'vm_view.mshz'
view = os.path.join(EXAMPLE_DIR, 'vm_view.mshz')
# Call meshalyzer
job.meshalyzer(geomfile, datafile, view)
......@@ -203,7 +203,7 @@ def run(args, job):
# Get basic command line, including solver options
cmd = tools.carp_cmd('carp.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'carp.par'))
# determine model type
cmd += ep.model_type_opts(args.sourceModel)
......
......@@ -3,12 +3,12 @@
"""
Description TBD.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Prepace'
EXAMPLE_AUTHOR = 'Fernando Campos <fernando.campos@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......
......@@ -119,12 +119,12 @@ be seen using the --visualize function:
repolarisation heterogeneity
"""
import os, sys
EXAMPLE_DESCRIPTIVE_NAME = 'Region- vs. Gradient-Based Heterogeneities'
EXAMPLE_AUTHOR = 'Patrick Boyle <pmjboyle@gmail.com>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
import numpy as np
from datetime import date
......@@ -247,7 +247,7 @@ def run(args, job):
# setup command line and run simulation #1 (Region-wise APD variability)
simID1 = os.path.join(job.ID, 'RegionWise_{0:4.2f}-{1:4.2f}'.format(f_min_scf,f_max_scf))
cmd = tools.carp_cmd('Region-Wise-APD-Variability.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'Region-Wise-APD-Variability.par'))
cmd += ['-simID', simID1,
'-tend', args.duration,
'-imp_region[0].im_param', reg0_cmd,
......@@ -312,7 +312,7 @@ def run(args, job):
# Setup command line and run simulation #2 (Gradient-wise APD variability)
simID2 = os.path.join(job.ID, 'GradientWise_{0:4.2f}-{1:4.2f}'.format(f_min_scf,f_max_scf))
cmd = tools.carp_cmd('Gradient-Wise-APD-Variability.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'Gradient-Wise-APD-Variability.par'))
cmd += ['-simID', simID2,
'-tend', args.duration,
'-adjustment[0].file', adjf_gKr_fn + '.adj',
......@@ -348,7 +348,7 @@ def run(args, job):
if args.visualize and not settings.platform.BATCH:
geom = meshname
data = dAPD_fn
view = 'DeltaAPD.mshz'
view = os.path.join(EXAMPLE_DIR, 'DeltaAPD.mshz')
job.meshalyzer(geom, data, view)
......
......@@ -34,12 +34,12 @@ which can be set to extra_V or extra_I.
./run.py --stimulus extra_I
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'resistor'
EXAMPLE_AUTHOR = 'Gernot Plank <gernot.plank@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -103,7 +103,7 @@ def run(args, job):
raise Exception('Unknown stimulus type!')
# Add all the non-general arguments
cmd = tools.carp_cmd('resistor.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'resistor.par'))
cmd += ['-meshname', meshname,
'-gridout_i', 3,
......@@ -127,7 +127,7 @@ def run(args, job):
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'phie.igb')
view = 'resistor.mshz'
view = os.path.join(EXAMPLE_DIR, 'resistor.mshz')
job.gunzip(data)
job.meshalyzer(geom, data, view)
......
......@@ -7,12 +7,12 @@ The strand contains transmural (Boukens et al. Cardiovasc Res 2015) as well as a
.. image:: /images/ecg_setup.png
:scale: 60%
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'SCR-mediated ectopy'
EXAMPLE_AUTHOR = 'Fernando Campos <fernando.campos@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -62,7 +62,8 @@ def run(args, job):
imp_reg = ['-num_imp_regions', 1,
'-imp_region[0].im', 'UCLA_RAB_SCR',
'-imp_region[0].im_param', 'g_K1*0.3,i_NaCamax*2.0,Ca_o*2.7,CSR=1600',
'-imp_region[0].im_sv_init','UCLA_RAB_SCR_DAD_CSR_1600uM_100npls_400bcl_INIT.st']
'-imp_region[0].im_sv_init',os.path.join(EXAMPLE_DIR,
'UCLA_RAB_SCR_DAD_CSR_1600uM_100npls_400bcl_INIT.st')]
# TISSUE SETUP
g_reg = ['-bidomain',0,
......@@ -79,7 +80,7 @@ def run(args, job):
# NOTE: here we provide seeds for the random number generator (without them you can't reproduce a simulation)
imp_adj = ['-num_adjustments', 1,
'-adjustment[0].variable', 'UCLA_RAB_SCR.seed',
'-adjustment[0].file', 'Cardiac-Strand.seeds']
'-adjustment[0].file', os.path.join(EXAMPLE_DIR, 'Cardiac-Strand.seeds')]
# NO STIMULUS
stim = ['-num_stim', 0]
......@@ -128,7 +129,7 @@ def run(args, job):
# Prepare file paths
geom = os.path.join(simID, os.path.basename(meshname)+'_i')
data = os.path.join(simID, 'vm.igb')
view = 'view.mshz'
view = '' #os.path.join(EXAMPLE_DIR, 'view.mshz')
# Call meshalyzer to show Vm
job.meshalyzer(geom, data, view)
......
......@@ -44,11 +44,12 @@ the results in meshalyzer:
./run.py --tend 100 --visualize
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Simple Bidomain Example'
EXAMPLE_AUTHOR = 'Andrew Crozier <andrew.crozier@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
from datetime import date
from carputils import settings
......@@ -88,7 +89,7 @@ def run(args, job):
stim = mesh.block_bc_opencarp(geom, 'stim', 0, 'x', False)
# Get basic command line, including solver options
cmd = tools.carp_cmd('simple.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'simple.par'))
cmd += tools.gen_physics_opts(ExtraTags=[0, 1], IntraTags=[1])
cmd += ['-simID', job.ID,
......@@ -109,7 +110,7 @@ def run(args, job):
# Prepare file paths
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'vm.igb.gz')
view = 'simple.mshz'
view = os.path.join(EXAMPLE_DIR, 'simple.mshz')
# Call meshalyzer
job.meshalyzer(geom, data, view)
......
......@@ -50,12 +50,12 @@ Optional Arguments
in this case which essentially enforces the integral over the extracellular potential
to be zero at each instant in time, but no specific point is clamped.
"""
import os
EXAMPLE_DESCRIPTIVE_NAME = 'Stimulation'
EXAMPLE_AUTHOR = 'Gernot Plank <gernot.plank@medunigraz.at>'
EXAMPLE_DIR = os.path.dirname(__file__)
import os
import sys
from datetime import date
from carputils import settings
......@@ -107,7 +107,7 @@ def run(args, job):
mod = []
# define default view settings
view = 'stimulation_V.mshz'
view = os.path.join(EXAMPLE_DIR, 'stimulation_V.mshz')
# make subtest specific settings
if args.stimulus == 'extra_V':
......@@ -173,7 +173,7 @@ def run(args, job):
raise Exception('Unknown stimulus type!')
# Add all the non-general arguments
cmd = tools.carp_cmd('stimtest.par')
cmd = tools.carp_cmd(os.path.join(EXAMPLE_DIR, 'stimtest.par'))
cmd += tools.gen_physics_opts(ExtraTags=[0, 1], IntraTags=[1])
cmd += ['-meshname', meshname,
......@@ -197,7 +197,7 @@ def run(args, job):
geom = os.path.join(job.ID, os.path.basename(meshname)+'_i')
data = os.path.join(job.ID, 'phie.igb')
view = 'stimulation.mshz'
view = os.path.join(EXAMPLE_DIR, 'stimulation.mshz')
job.gunzip(data)
job.meshalyzer(geom, data, view)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment