gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
348 stars 131 forks source link

bug-typo/Cm05.cols #715

Closed AmirMardan closed 1 month ago

AmirMardan commented 1 month ago

Problem description

Calling the shape of a Cm05Matrix throws back an attribute error.

Your environment

Date: Sun May 12 10:12:59 2024 EDT

            OS : Darwin
        CPU(s) : 10
       Machine : arm64
  Architecture : 64bit
   Environment : Python
   File system : apfs
     Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:37:07) [Clang 15.0.7 ]
       pygimli : 1.4.6
        pgcore : 1.4.0
         numpy : 1.24.4
    matplotlib : 3.6.3
         scipy : 1.11.4
          tqdm : 4.66.2
       IPython : 8.20.0
        meshio : 5.3.4
        tetgen : 0.6.4
       pyvista : 0.43.1

work, please give provide some additional information on your:

Operating system: Mac Python version: 3.11 pyGIMLi version: 1.4.6 Way of installation: Conda package

Steps to reproduce

import pygimli as pg

# No matter what mesh
A = pg.utils.covarianceMatrix(mesh, I=5)
cm05 = pg.matrix.createCm05(A)

print(cm05.shape)

...

Expected behavior

Cm05.cols() should return the number of columns in the matrix. As cm05 is a square matrix, Cm05.cols() returns Cm05.row() but the matrix does not have this method. Instead, it should return Cm05.rows(). So, there is a typo here.

Actual behavior

It throws this error

AttributeError: 'Cm05Matrix' object has no attribute 'row'
halbmy commented 1 month ago

You're absolutely right. I fixed this with 1fc2e12a89fca06dfaee4a3308e445c3c5c70fcd