8000 read_hd5 in pyerrors 2.9.0 not fully backwards compatible to <=2.8.2 · Issue #217 · fjosw/pyerrors · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
read_hd5 in pyerrors 2.9.0 not fully backwards compatible to <=2.8.2 #217
Closed
@jkuhl-uni

Description

@jkuhl-uni

Describe the issue:

Basically the title, I'm trying to read a couple of files, to put the data into a database, if I try this with pyerrors==2.9.0 or pyerrors==2.10.0-dev. I guess that the separation of name stem and suffix got mangled a little.
For the error message, I left out all the custom functions I built on top.

Code example:

import pyerrors as pe

# files in path are called e.g. "meson_0_0_0_h0.20_h0.20.500.h5"

file_name = "meson_0_0_0_h0.20_h0.20"
corr = pe.input.hadrons.read_meson_hd5(path, file_name, ens_id=ens_name, gammas=entry).symmetric()

Error message:

File "/usr/local/python/current/lib/python3.11/site-packages/pyerrors/input/hadrons.py", line 177, in read_meson_hd5
    return read_hd5(filestem=path + "/" + filestem, ens_id=ens_id,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/python/current/lib/python3.11/site-packages/pyerrors/input/hadrons.py", line 93, in read_hd5
    files, idx = _get_files(path, filestem, idl)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/python/current/lib/python3.11/site-packages/pyerrors/input/hadrons.py", line 25, in _get_files
    files.sort(key=get_cnfg_number)
  File "/usr/local/python/current/lib/python3.11/site-packages/pyerrors/input/hadrons.py", line 22, in get_cnfg_number
    return int(n.replace(".h5", "")[len(filestem) + 1:])  # From python 3.9 onward the safer 'removesuffix' method can be used.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '20.100'

Runtime information:

system           Linux
python           3.11.5
pyerrors         2.8.2
numpy            1.24.4
scipy            1.11.1
matplotlib       3.7.2
pandas           2.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0