Error about Matrix is not positive definite

18 views
Skip to first unread message

Jian Ma

unread,
May 31, 2021, 11:51:43 AMMay 31
to openqua...@googlegroups.com
Dear developer,

When I run the scenario analysis from the shake map based on the oq 3.11.3.
I get the following error and the calculation file has been attached.
Do you know what's wrong?
Thanks!

Traceback (most recent call last):
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 247, in run
    self.pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\scenario_risk.py", line 118, in pre_execute
    super().pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 559, in pre_execute
    self.read_inputs()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 457, in read_inputs
    self._read_risk_data()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 753, in _read_risk_data
    haz_sitecol, assetcol)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 956, in read_shakemap
    oq.imtls)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 307, in to_gmfs
    L = cholesky(spatial_cov, cross_corr)  # shape (M * N, M * N)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in cholesky
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in <listcomp>
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "<__array_function__ internals>", line 6, in cholesky
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 755, in cholesky
    r = gufunc(a, signature=signature, extobj=extobj)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 100, in _raise_linalgerror_nonposdef
    raise LinAlgError("Matrix is not positive definite")
numpy.linalg.LinAlgError: Matrix is not positive definite
[2021-05-31 23:45:58 #761 CRITICAL] Traceback (most recent call last):
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\engine\engine.py", line 263, in run_calc
    calc.run(exports=exports, **kw)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 247, in run
    self.pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\scenario_risk.py", line 118, in pre_execute
    super().pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 559, in pre_execute
    self.read_inputs()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 457, in read_inputs
    self._read_risk_data()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 753, in _read_risk_data
    haz_sitecol, assetcol)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 956, in read_shakemap
    oq.imtls)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 307, in to_gmfs
    L = cholesky(spatial_cov, cross_corr)  # shape (M * N, M * N)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in cholesky
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in <listcomp>
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "<__array_function__ internals>", line 6, in cholesky
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 755, in cholesky
    r = gufunc(a, signature=signature, extobj=extobj)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 100, in _raise_linalgerror_nonposdef
    raise LinAlgError("Matrix is not positive definite")
numpy.linalg.LinAlgError: Matrix is not positive definite

[2021-05-31 23:45:58 #761 INFO] Stopping the workers
Traceback (most recent call last):
  File "e:\program files\openquake engine\python3.6\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\program files\openquake engine\python3.6\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Program Files\OpenQuake Engine\python3.6\Scripts\oq.exe\__main__.py", line 7, in <module>
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\commands\__main__.py", line 44, in oq
    sap.run(commands, prog='oq')
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\baselib\sap.py", line 225, in run
    return _run(parser(funcdict, **parserkw), argv)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\baselib\sap.py", line 216, in _run
    return func(**dic)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\commands\engine.py", line 164, in main
    run_jobs(job_inis, log_level, log_file, exports, **pars)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\engine\engine.py", line 407, in run_jobs
    run_calc(*args)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\engine\engine.py", line 263, in run_calc
    calc.run(exports=exports, **kw)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 247, in run
    self.pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\scenario_risk.py", line 118, in pre_execute
    super().pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 559, in pre_execute
    self.read_inputs()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 457, in read_inputs
    self._read_risk_data()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 753, in _read_risk_data
    haz_sitecol, assetcol)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 956, in read_shakemap
    oq.imtls)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 307, in to_gmfs
    L = cholesky(spatial_cov, cross_corr)  # shape (M * N, M * N)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in cholesky
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\hazardlib\shakemap.py", line 269, in <listcomp>
    L = numpy.array([numpy.linalg.cholesky(spatial_cov[i]) for i in range(M)])
  File "<__array_function__ internals>", line 6, in cholesky
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 755, in cholesky
    r = gufunc(a, signature=signature, extobj=extobj)
  File "e:\program files\openquake engine\python3.6\lib\site-packages\numpy\linalg\linalg.py", line 100, in _raise_linalgerror_nonposdef
    raise LinAlgError("Matrix is not positive definite")
numpy.linalg.LinAlgError: Matrix is not positive definite

Jian MA
Ph.D Candidate
Academy of Disaster Reduction and Emergency Management, Ministry of Emergency Management & Ministry of Education
Beijing Normal University
(86)188-1157-3353

Jian Ma

unread,
May 31, 2021, 12:02:21 PMMay 31
to openqua...@googlegroups.com

Jian MA
Ph.D Candidate
Academy of Disaster Reduction and Emergency Management, Ministry of Emergency Management & Ministry of Education
Beijing Normal University
(86)188-1157-3353


Jian Ma <bnum...@gmail.com> 于2021年5月31日周一 下午11:51写道:
shakemap.rar

Michele Simionato

unread,
Jun 1, 2021, 12:00:36 PMJun 1
to OpenQuake Users
Yes, this is a numerical error happening when the calculation has to many sites.
Extra-small negative eigenvalues start to appear. The workaround is to reduce the number of sites.
Normally this is done by increasing the region_grid_spacing.

           Michele

On Monday, May 31, 2021 at 5:51:43 PM UTC+2 bnum...@gmail.com wrote:
Dear developer,

When I run the scenario analysis from the shake map based on the oq 3.11.3.
I get the following error and the calculation file has been attached.
Do you know what's wrong?
Thanks!

Traceback (most recent call last):
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 247, in run
    self.pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\scenario_risk.py", line 118, in pre_execute
    super().pre_execute()
  File "e:\program files\openquake engine\python3.6\lib\site-packages\openquake\calculators\base.py", line 559, in pre_execute
    self.read_inputs()

984
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/svir/tasks/extract_npz_task.py", line 84, in finished
985
    self.on_success(self.extracted_npz)
986
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_gmf_data_as_layer_dialog.py", line 128, in finalize_init
987
    self.populate_rlz_or_stat_cbx()
988
  File "/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_gmf_data_as_layer_dialog.py", line 177, in populate_rlz_or_stat_cbx
989
    self.rlz_or_stat_cbx.itemData(int(rlz_id)))
990
TypeError: setCurrentIndex(self, int): argument 1 has unexpected type 'NoneType'

Jian Ma

unread,
Jun 2, 2021, 3:52:10 AMJun 2
to openqua...@googlegroups.com
Thanks  Michele  

Jian MA
Ph.D Candidate
Academy of Disaster Reduction and Emergency Management, Ministry of Emergency Management & Ministry of Education
Beijing Normal University
(86)188-1157-3353


Michele Simionato <mic...@openquake.org> 于2021年6月2日周三 上午12:00写道:
--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openquake-users/6e8c4861-f3a9-4ef7-9dd4-d7d985aeb6a7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages