ADicksonLab / wepy

Weighted Ensemble simulation framework in Python
https://adicksonlab.github.io/wepy/index.html
MIT License
51 stars 20 forks source link

HDF5 file reading error #56

Open ndonyapour opened 1 year ago

ndonyapour commented 1 year ago

Hello,

I recently installed wepy from pip. I had some issues when I tried to run my simulations so I updated h5py and networkx. I ran into "Type names and field names must be valid identifiers" error when I read from my HDF5 reporter file. I would appreciate it if you could help me out.

Thank you!

salotz commented 1 year ago

You'll have to give me which versions you have installed of all of that and the full stack trace. Also clarify exactly the process you followed. Are you reading the HDF5 data from a different version than you wrote with etc.

ndonyapour commented 1 year ago

Thank you for being so helpful. I had a discrepancy in the version of h5py. The HDF5 file was written with version 2.10, and I've been reading the data with version 3.10.

salotz commented 1 year ago

There are compatibility problems with reading >=3 with things written in version 2, so I would try to read with <3 if you can.

alexrd commented 1 year ago

Following up on this, since I was about to post a separate issue. For anyone else who is interested, here are some more details:

Raises a ValueError: Type names and field names must be valid identifiers: "b'decision_id'"

Minimal code needed to reproduce:

we = WepyHDF5(h5name,'r')
we.open()
we.resampling_records([0])

It can also be observed with:

print(we.record_fields)

where byte strings are shown using the "b" character before string.

We can fix this in HDF5=3.10 by using the .asstr() function when reading the record fields.

salotz commented 1 year ago

depends on #78