smash-transport / smash-analysis

Analysis tools that are useful to calculate observables from SMASH.
http://theory.gsi.de/~smash/analysis_suite/current/
Other
8 stars 2 forks source link

Change comparison to previous version for detailed balance #6

Closed akschaefer closed 5 years ago

akschaefer commented 5 years ago

Reading the old results for detailed balance currently requires reading unicode strings in 'txt_io.py':

if 'detailed_balance' in path:
    # Unicode strings in first column. Data type needs to be specified.
    array = genfromtxt(f, missing_values='-', dtype='unicode', encoding='utf-8')

This is however only supported from numpy version 1.14.0 upwards, which is not preinstalled on Kronos and other machines. Hence, the build of the analysis suite fails as the installed version is too old and it needs to be updated manually. It would be nice to find a different representation for those unicode strings such that reading them in is also possible with an older version of numpy and users would not need to update their numpy version when attempting to run the analysis suite.

vks commented 5 years ago

I'm surprised this ever worked. When I use save_table for strings, it crashes, without involving any unicode. Also, the current implementation of load_table is problematic, because it crashes if f is not a path.

vks commented 5 years ago

If we somehow make save_table work for strings (as @akschaefer managed to do), I think we only have two options:

  1. Raise the required numpy version to 1.14.
  2. Implement the numpy functionality used by save_table ourselves. This could be as simple as copy-and-pasting the numpy code.
akschaefer commented 5 years ago

I'm surprised this ever worked. When I use save_table for strings, it crashes, without involving any unicode. Also, the current implementation of load_table is problematic, because it crashes if f is not a path.

Well, for me it somehow works. But it went in hand with a lot of trial and error. Maybe it doesn't work for you because you do not globally declare the encoding? This is in the header of the python_scripts/comp_to_prev_version.py, in which the save_tablefunction is called for strings:

# -*- encoding: utf-8 -*-

If I remember it correctly, it wasn't working properly without this line.

akschaefer commented 5 years ago
  1. Raise the required numpy version to 1.14.

This is already the case on master.

akschaefer commented 5 years ago

But if we leave the numpy version as is, we should maybe add a comment in the end of the readme that this new version is only required for plotting the previous results in the detailed balance plots and not necessary for any analysis. The simulations and analysis can be run when simply decreasing the required numpy version in the top level CMakeLists.txt