First time here? Checkout the FAQ!
x
0 votes
by (300 points)
For some reason, I get the following error when applying a stimulus to a whole-heart mesh. Would anyone have any ideas on why this might be occurring? I tried looking through the .pts and .elem files for any non-ASCII characters but I couldn't find any.

File "/usr/local/lib/python3.10/dist-packages/carputils/divertoutput.py", line 116, in call
    for line in iter(proc.stdout.readline, ''):
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 6: invalid continuation byte
by (340 points)
I am getting the same error on my simulation attempts, however I want to contribute by stressing the fact that when I use -stim[0].crct.type 0 I get the error on time 0. When I use 1 I do not get the error, simulation runs normally. When I use 2 I get the error on time 2.

3 Answers

+1 vote
by (17.5k points)
Could it be that you saved your stimulus text file with latin1 encoding instead of utf8?

If this is not the problem, please share a minimum example to reproduce. Otherwise it will be hard to provide help.
by (300 points)
edited by
Ahh i think the error was in the mesh itself. I deleted the carp_txt mesh and then reconverted it from the vtk  and it worked just fine!

edit: There may have been something deeper, it periodically was working and then stopped however I think I figured out the root cause- When the radius is large enough (>200) the simulation starts working perfectly fine.
by (340 points)
Hi Brayden,

I am having the same error. Can you please tell us what you mean by radius large enough?

Best,

Kocak
by (130 points)
Hi, I am getting a similar error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 5: invalid continuation byte. For me it seems to be ionic model specific, i.e. for the exact same mesh and stimulus input, works fine for  Courtemanche but not Bondarenko
by (17.5k points)
Thanks for following up. Could you share a working example to reproduce this issue?
by (130 points)
Thank you for your help. The only change that causes the error is changing (OHara used here, but other works fine too':     
    imp_reg = ['-num_imp_regions',1,
               '-imp_region[0].im','OHara',
               '-imp_region[0].num_IDs', 1,
               '-imp_region[0].ID[0]', "1"]

Too:


imp_reg = ['-num_imp_regions',1,
               '-imp_region[0].im','Bondarenko',
               '-imp_region[0].num_IDs', 1,
               '-imp_region[0].ID[0]', "1"]

As it seems others have identified this issue when applying stimuli, this is my stimulus:

    E1_lower_bound = nplist([x/2-res, y/2 - res, 0])
    E1_upper_bound = nplist([x/2 + res, y/2 + res, res])

    electrode1 = mesh.block_region(geom, 'stimulus', 0, E1_lower_bound,E1_upper_bound, False)

    electrode = electrode1

    stim = ['-num_stim',1,
            '-stimulus[0].stimtype', 0,
            '-stimulus[0].strength',200.0,
            '-stimulus[0].duration', 2,
            '-stimulus[0].start',5,
            '-stimulus[0].npls', 1]

The full error is below and indeed happens on time of stimlus (i.e. if i change to start at 0ms, 10ms this is when the error occurs):
Traceback (most recent call last):
  File "/home/osheac/Desktop/OMTool/./mouse.py", line 125, in <module>
    run()
  File "/usr/local/lib/python3.10/dist-packages/carputils/tools.py", line 542, in wrapped
    ret = run(args, job)
  File "/home/osheac/Desktop/OMTool/./mouse.py", line 122, in run
    job.carp(cmd)
  File "/usr/local/lib/python3.10/dist-packages/carputils/job/job.py", line 380, in carp
    self.mpi(cmd, msg, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/carputils/job/job.py", line 262, in mpi
    self.register(MPICommand(cmd, message), *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/carputils/job/job.py", line 119, in register
    self._queue.pop(0).execute()
  File "/usr/local/lib/python3.10/dist-packages/carputils/job/command.py", line 288, in execute
    divertoutput.call(self._cmd, interactive, timeout, stderr=stderr)
  File "/usr/local/lib/python3.10/dist-packages/carputils/divertoutput.py", line 43, in wrapped
    return func(cmd, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/carputils/divertoutput.py", line 116, in call
    for line in iter(proc.stdout.readline, ''):
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 5: invalid start byte
0 votes
by (3.4k points)
I think the error actually happens when the solver diverges.

I can reproduce the error, and when I run the experiment using the openCARP executable directly, I get the following output:

    *** Launching simulation ***

PROG    -----     ----    -------    -------|
time    %%comp    time     ctime       ETA  |
0.00    0.0    0.0    0:00:00    0:00:00
0.10    2.0    0.0    0:00:00    0:00:01
L5 : (??'?U solver diverged. Reason: NaN or inf encountered.

As we see, the name of the solver is corrupted, and that is actually causing the Python error.
We are investigating  this issue.
0 votes
by (3.4k points)
The issue should now be fixed in the master branch, via the merge request https://git.opencarp.org/openCARP/openCARP/-/merge_requests/180 .
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
...