dynamics-of-stellar-systems / dynamite

dynamics, age and metallicity indicators tracing evolution
MIT License
10 stars 1 forks source link

Bugfix for multiple kinematics with different number of PSF components. #356

Closed maindlt closed 6 months ago

maindlt commented 7 months ago

This PR fixes a bug that caused DYNAMITE to crash in case there are multiple kinematics with different numbers of PSF components.

Tested with test_nnls.py (one kinematics set) and verified that there is no error for Anirban's recent galaxy (two kinematic sets with a different number of components in the PSFs).

Please test and verify that the results make sense ;-)

sthater commented 6 months ago

No, it is not fixed yet.

Both, me and Anirban get:

Traceback (most recent call last): File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/multiprocess-0.70.14-py3.10.egg/multiprocess/pool.py", line 121, in worker result = (True, func(*args, *kwds)) File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/multiprocess-0.70.14-py3.10.egg/multiprocess/pool.py", line 44, in mapstar return list(map(args)) File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/model_iterator.py", line 412, in create_and_run_model orblib = mod.get_orblib() File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/model.py", line 957, in get_orblib orblib.get_orblib() File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/orblib.py", line 91, in get_orblib self.create_fortran_input_orblib(self.mod_dir+'infil/') File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/orblib.py", line 285, in create_fortran_input_orblib write_orblib_dot_in(box=False) File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/orblib.py", line 249, in write_orblib_dot_in weight_ij, sigma_ij = psf_i['weight'][j], psf_i['sigma'][j] IndexError: list index out of range """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/gpfs/data/fs71474/sthater/Dynamite/Anirban_test/run_dyna.py", line 84, in run_user_test() File "/gpfs/data/fs71474/sthater/Dynamite/Anirban_test/run_dyna.py", line 39, in run_user_test smi = dyn.model_iterator.ModelIterator(c) File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/model_iterator.py", line 92, in init status = model_inner_iterator.run_iteration() File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/dynamite-3.0.0-py3.10.egg/dynamite/model_iterator.py", line 547, in run_iteration output = p.map(self.create_and_run_model, input_list) File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/multiprocess-0.70.14-py3.10.egg/multiprocess/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/fs71474/sthater/.local/lib/python3.10/site-packages/multiprocess-0.70.14-py3.10.egg/multiprocess/pool.py", line 657, in get raise self._value IndexError: list index out of range

maindlt commented 6 months ago

Hi Sabine,

the error messages and logfile /gpfs/data/fs71474/sthater/Dynamite/Anirban_test/dynamite.log suggest that the error occurs with DYNAMITE 3.0.0, a release without the bugfix for different numbers of PSFs. Please update the version of DYNAMITE to the latest version (the current release is 4.1 + the bugfix), making sure the branch of this PR is checked out.

I copied your example script and data into /gpfs/data/fs71474/tmaindl/sabine20231207 and ran it successfully. Before running I double-checked that of the two used kinematics MUSE_input/gauss_hermite_kins_cut.ecsv has 1 PSF and SINFONI_input/gauss_hermite_kins.ecsv has 2 PSFs, respectively.

Let me know if this works for you ;-)

Cheers, Thomas

maindlt commented 6 months ago

Confirmed the fix works (together with Sabine) - will merge, close, & delete branch...