ColRadPy icon indicating copy to clipboard operation
ColRadPy copied to clipboard

ss_ion_bal_adf11.py eigenvector error

Open d-v-t opened this issue 1 year ago • 2 comments

I was running ss_ion_bal_adf11.py and got the following error:

Traceback (most recent call last):

  File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File ~/Documents/au physics/colradpy/examples/ss_ion_bal_adf11.py:35
    ion.solve_time_independent()#solve the ionization balance matrix in steady state

  File ~/Documents/au physics/colradpy/colradpy/ionization_balance_class.py:607 in solve_time_independent
    self.data['processed']['eigen_vec'] = solve_matrix_exponential_steady_state(

  File ~/Documents/au physics/colradpy/colradpy/solve_matrix_exponential.py:117 in solve_matrix_exponential_steady_state
    ev = eigenvectors.transpose(0,1,3,2)[index]#egienvectors sorted on eigenvals

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

I peeked into the code and determined that index is initialized as a list of inhomogenous zero arrays. I'm not sure how this ever works, perhaps this is a deprecated feature? However, I didn't write the code or spend >5 min attempting to understand what goes on, as I suspect I would need to spend >5 weeks to debug this on my own.

I did pull up an old copy of colradpy on a different machine since I changed file reading parts on another machine. Without these mods, I get the same error. This reinforces the deprecated feature narrative.

d-v-t avatar Apr 11 '24 00:04 d-v-t

Interesting, I haven't seen this error before and can't reproduce it. Can you send me the versions of numpy, python.....

johnson-c avatar Apr 11 '24 22:04 johnson-c

Python 3.10.9, np 1.23.5 on the machine with updated colradpy Interesting, this is something new? I also decided to add some information about the shapes of these arrays inside of solve_matrix_exponential_steady_state for better debug info.

matrix.shape
# (27, 27, 1000, 1)

eigenvectors.shape
# (1000, 1, 27, 27)

[arr.shape for arr in index]
# [(1000, 1, 1), (1, 1, 1), (1000, 1, 27)]

d-v-t avatar Apr 12 '24 14:04 d-v-t