n-claes / legolas

Legolas: a modern tool for MHD spectroscopy
https://legolas.science
GNU General Public License v3.0
11 stars 4 forks source link

Eigenvalue selection from inverse vector-iteration spectrum #118

Closed nicolasbrughmans closed 1 year ago

nicolasbrughmans commented 1 year ago

Issue description

Bug report: after running inverse vector-iteration, the result is one eigenmode. When selecting this one eigenmode, an error is thrown because eigenfunc_interface._get_clicked_point_data tries to apply an index to something that is no list.

Bug report

Minimal example for reproduction

#Parfile:
&gridlist
  gridpoints = 100
/

&equilibriumlist
  equilibrium_type = "MRI_accretion"
  use_defaults = .false.
/

&savelist
  write_eigenfunctions = .true.
  write_derived_eigenfunctions = .false.
  show_results = .true.
  basename_datfile = "sari_GK2022_quasi_continuum_test"
/

&physicslist
  flow = .true.
  external_gravity = .true.
  incompressible = .false.
/

&paramlist
  k2 = 1.0d0
  k3 = 50.0d0
  delta = 0.28862653d0 ! for most unstable mode
  beta = 10.0d0
  tau = 10.0d0     !fixes mu1 parameter
  nu = 0.045d0    !fixes epsilon parameter
/

&solvelist
  solver = "inverse-iteration"
  sigma = (0.59639333d0, 0.17629975d0)
  maxiter = 20000
  tolerance = 1.d-7
/

Actual result

  File "/users/cpa/nicolasb/codes/legolas/post_processing/pylbo/visualisation/eigenfunctions/eigfunc_interface.py", line 262, in on_left_click
    idx, xdata, ydata = self._get_clicked_point_data(event)
  File "/users/cpa/nicolasb/codes/legolas/post_processing/pylbo/visualisation/eigenfunctions/eigfunc_interface.py", line 345, in _get_clicked_point_data
    return idx, xdata[idx], ydata[idx]
  File "/users/cpa/nicolasb/Documents/no_backup/miniconda3/envs/legolasenv/lib/python3.9/site-packages/numpy/ma/core.py", line 3224, in __getitem__
    dout = self.data[indx]
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

Expected result

The eigenvalue is selected and everyone lives happily ever after.

When selecting xdata, ydata from the artist in _get_cicked_point_data, the result is probably a float instead of a list now if the spectrum consists of only one point.

Version info

n-claes commented 1 year ago

Just fixed this in develop