First time here? Checkout the FAQ!
x
0 votes
by (120 points)

This is the tutorial  video example from "Intoduction to cellular simulations", I got the error: 

  File "run.py", line 127, in run

    '--imp={}'.format(args.imp)]

AttributeError: 'Namespace' object has no attribute 'imp'

Here is part of that code, can any one help to answer? thanks!

def parser():
parser = tools.standard_parser()
group = parser.add_argument_group('experiment specific options')
group.add_argument('--ionic_model', default='TT2',
choices=['TT2', 'Courtemanche', 'HH'],
help='pick ionic model')
group.add_argument('--duration',
type=float, default=1000.,
help='Duration of simulation (ms)')
group.add_argument('--stim-strength',
type=float, default=60.,
help='pick transmembrane current stimulus strength')
group.add_argument('--stim-dur',
type=float, default=2.,
help='pick transmembrane current stimulus duration')
return parser
 
def jobID(args):
"""
Generate name of top level output directory.
"""
today = date.today()
return '{}_basic_{}'.format(today.isoformat(), args.duration)
 
@tools.carpexample(parser, jobID)
def run(args, job):
# define & config EP model
cmd = [settings.execs.BENCH,
'--imp={}'.format(args.imp)]
if args.imp_par is not '':
cmd += ['--imp-par', args.imp_par]
 
if args.plug_in is not '':
cmd += ['--plug-in', args.plug_in]
 
if args.plug_par is not '':
cmd += ['--plug-par', args.plug_par]
 
# setup stimulus
cmd += ['--stim-curr', args.stim_strength,
'--numstim', int(float(args.duration)/float(args.bcl)+1),
'--bcl', args.bcl,
'--stim-assign', 'on',
'--stim-species', 'K_i']
# run bench with available ionic models
cmd += ['--duration', args.duration]
 
# executing bench
job.mpi(cmd, 'Running {}'.format(args.imp))
 
if args.visualize:
visualization(args. job.ID)
 
if __name__ == '__main__':
run()

1 Answer

0 votes
by (18.3k points)

It's hard to see from your screenshot but my guess would be that you have a line break between

cmd = [settings.execs.BECH,

and

'--imp={}'.forma(args.imp)]

these should be in one line. In the video tutorial this is likely a line wrap rather than a line break.

If this is not the issue, please share a minimum example to reproduce.

Another thing to be aware of: the names of the ionic have changed since openCARP v9.0. You'll need to use the new names to make your example work: https://git.opencarp.org/openCARP/openCARP/-/blob/master/physics/limpet/models/README.md

Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...