Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visualize.parameters produces error when working with hdf5-stored result.problem.x_scales #1535

Open
C-Peiter opened this issue Dec 4, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@C-Peiter
Copy link
Contributor

C-Peiter commented Dec 4, 2024

Seems like, when I load a result using result=pypesto.store.read_result("path/to/result.hdf5") the result.problem.x_scales attribute gets loaded as an array of byte-strings. This produces a type error at visualize/parameters.py:128 when all scales are the same. The error is TypeError: can only concatenate str (not "bytes") to str and otherwise prints the scale as, for example, b'log10'.

The result file was saved with

pypesto.store.write_result(
    result=result,
    filename="path/to/result.hdf5",
    problem=True,
    optimize=True,
    profile=True,
    sample=True,
)

OS: Ubuntu 22.04
HDF5 lib on ubuntu: libhdf5-103-1 1.10.7+repack-4ubuntu2
Python version: 3.10.12
pyPESTO version: 0.5.4
h5py version: 3.12.1

@stephanmg
Copy link
Contributor

stephanmg commented Dec 10, 2024

@C-Peiter Could you provide the snippet which produces the error with the .hdf5 file? Then I'll try to reproduce this on my Ubuntu and have a look. (And possibly the error output)

@C-Peiter
Copy link
Contributor Author

I attached a result stored in hdf5 and the code to load the result and plot the parameters. I also have a whole PEtab problem for that, if you want.
mwe.zip

@stephanmg
Copy link
Contributor

I attached a result stored in hdf5 and the code to load the result and plot the parameters. I also have a whole PEtab problem for that, if you want. mwe.zip

Thanks, that should suffice.

stephanmg added a commit that referenced this issue Dec 18, 2024
@stephanmg
Copy link
Contributor

stephanmg commented Dec 18, 2024

Think a simple decode('utf-8') should be enough, realized in PR #1542 --- @C-Peiter I did not see your suggestions ;) Sorry.

The issue is in pypesto.store.read_from_hdf5 where x_scales is not decoded from the byte str to str after reading the .hdf5 file, fixed in PR #1542.

@stephanmg stephanmg self-assigned this Dec 18, 2024
@stephanmg stephanmg added the bug Something isn't working label Dec 18, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 8, 2025
* Update parameters.py

Fix issue #1535

* Update parameters.py

* Update parameters.py

Linting

* Update parameters.py

Revert changes.

* Update read_from_hdf5.py

Decode byte str to str.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants