From 0a6badde06420009929ac540bdd302a8cef7a18e Mon Sep 17 00:00:00 2001 From: Ansgar Wehrhahn <31626864+AWehrhahn@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:44:07 +0200 Subject: [PATCH] Fix NLTE InputDeparture Coefficients --- src/pysme/nlte.py | 2 +- src/pysme/smelib/_smelib.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pysme/nlte.py b/src/pysme/nlte.py index dee475a5..6d79c459 100644 --- a/src/pysme/nlte.py +++ b/src/pysme/nlte.py @@ -1065,7 +1065,7 @@ def update_coefficients(self, sme, dll, lfs_nlte): # loop through the list of relevant _lines_, substitute both their levels into the main b matrix # Make sure both levels have corrections available if lr[0] != -1 and lr[1] != -1: - dll.InputDepartureCoefficients(bmat[:, lr].T, li) + dll.InputDepartureCoefficients(bmat[:, lr], li) for elem in marked_for_removal: self.remove_nlte(elem) diff --git a/src/pysme/smelib/_smelib.cpp b/src/pysme/smelib/_smelib.cpp index 0ccfc565..e5d163fb 100644 --- a/src/pysme/smelib/_smelib.cpp +++ b/src/pysme/smelib/_smelib.cpp @@ -637,16 +637,16 @@ static PyObject *smelib_InputDepartureCoefficients(PyObject *self, PyObject *arg PyErr_SetString(PyExc_ValueError, "Expected bmatrix with ndim == 2"); return NULL; } - if (PyArray_DIM(bmatrix_arr, 0) != 2) + if (PyArray_DIM(bmatrix_arr, 1) != 2) { Py_XDECREF(bmatrix_arr); - PyErr_SetString(PyExc_ValueError, "Expected bmatrix with shape (2, nrhox)"); + PyErr_SetString(PyExc_ValueError, "Expected bmatrix with shape (nrhox, 2)"); return NULL; } - if (PyArray_DIM(bmatrix_arr, 1) != nrhox) + if (PyArray_DIM(bmatrix_arr, 0) != nrhox) { Py_XDECREF(bmatrix_arr); - PyErr_SetString(PyExc_ValueError, "Expected bmatrix with shape (2, nrhox)"); + PyErr_SetString(PyExc_ValueError, "Expected bmatrix with shape (nrhox, 2)"); return NULL; }