simulation fails

Issue #3 resolved
jverbrug created an issue

e.g. example 1EET1, processing fails:

#!

python /home/jverbrug/git/gnt/src/rev5/python/gnt.py process -i 'acgnt{:d}.ac' -o gnt.ac --source V1 --output v2 --eet ignt --log spectre.out --bin-replace
initialized Simulation instance with number 1
initialized Simulation instance with number 2
initialized Simulation instance with number 3
arguments: Namespace(ascii=False, bin=False, bin_add=False, bin_replace='logFile', eet=None, func=<function gnt_process at 0x2d3ab90>, gft=None, gnt=None, i='acgnt{:d}.ac', log='spectre.out', nested_analysis=NestedAnalysis(sources = [V1], outputs = [v2], analyses = [SimpleGNTAnalysis(probes = [VoltageProbe(ignt)])]), norefsim=False, o='gnt.ac', output=None, refsim=<gnt.simulation.Simulation object at 0x2d5f310>, source=None)
initiated psf reader, formatstr=acgnt{:d}.ac
starting <SimpleGNTAnalysis inst>.decompose(...) ...
     ... finished (0.000157118 seconds)
starting <Tf inst>.flatten(...) ...
starting <TfMatrix inst>.det(...) ...
cache hit for arguments outputs = frozenset([v2]), sources = frozenset([V1])
calculating det with sources frozenset([V1]) and outputs frozenset([v2])
Traceback (most recent call last):
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt.py", line 139, in <module>
    args.func(args)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt.py", line 39, in gnt_process
    flatten(H)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/util.py", line 106, in __call__
    res = self.f(obj, *args, **kw)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt.py", line 37, in flatten
    results[newname] = gtf.children[child].value
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/util.py", line 43, in __get__
    val = self.fget(obj)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/determinant_expr.py", line 41, in value
    return sum([det.value for det in self.nums])/sum([det.value for det in self.denoms])
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/data.py", line 65, in value
    return self.data.det(sources = self.sources, outputs = self.outputs)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/util.py", line 106, in __call__
    res = self.f(obj, *args, **kw)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/util.py", line 139, in __call__
    return self.f(obj, *args, **kwargs)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/util.py", line 87, in __call__
    res = cache[key] = self.f(obj, *args, **kw)
  File "/home/jverbrug/git/gnt/src/rev5/python/gnt/data.py", line 51, in det
    return np.linalg.det(self.mat[indices])
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 1703, in det
    sign, logdet = slogdet(a)
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 1645, in slogdet
    _assertRank2(a)
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 155, in _assertRank2
    'two-dimensional' % len(a.shape))
numpy.linalg.linalg.LinAlgError: 3-dimensional array given. Array must be two-dimensional

Comments (7)

  1. jverbrug reporter
    • changed status to open

    installed numpy 1.9, but the same error

    schematic/psf> pip list
    lxml (3.2.1)
    numpy (1.9.0)
    pip (1.4.1)
    pygobject (3.10.2)
    python-onedrive (14.06.3)
    setuptools (0.9.8)
    sympy (0.7.5)
    
  2. Bart Moeneclaey

    issue with different python versions/environments?

    try the following within the same python env:

    python -c "import numpy as np; print np.version; np.linalg.det(np.arange(16).reshape(4,2,2))"

    also consider the shebang in gnt.py

  3. Bart Moeneclaey

    autocorrected, try

    python -c "import numpy as np; print np.__version__; np.linalg.det(np.arange(16).reshape(4,2,2))"
    
  4. jverbrug reporter

    Found the root cause: pip defaults to python3.3 environment on my system

    had to use

    pip-2.7 install numpy --upgrade
    

    to fix the numpy installation

  5. Log in to comment