momentoscope / hextof-processor

Code for preprocessing data from the HEXTOF instrument at FLASH, DESY in Hamburg (DE)
https://hextof-processor.readthedocs.io/en/latest/
GNU General Public License v3.0
7 stars 4 forks source link

Problem with reading one of lab files #113

Closed kutnyakhov closed 2 years ago

kutnyakhov commented 2 years ago

I was able to read '/asap3/fs-flash-o/gpfs/hextof/2022/data/11013726/raw/20220114/2.h5', but if I am trying to read '/asap3/fs-flash-o/gpfs/hextof/2022/data/11013726/raw/20220114/3.h5' code is hanging. Checking that file with simple with h5py.File readout, error appeared, but including (libver='latest', swmr=True) solve the error Read_h5_error

steinnymir commented 2 years ago

From reading the error message, the hdf5 file was "open for write".

E.g. f = h5py.file(fname,"w") not followed by f.close()

The argument swmr kind of goes around this . It stands for "Single Write Multiple Read". This allows you to read files which are open for read or write in different processes.

Can you try check where this file might have been open?

kutnyakhov commented 2 years ago

Do you mean that it is still open for writing by LabDAQ or if it is open in some other notebook? This is for sure not a case, as some other files were created after this one. Why then it was possible to read within the next cell with "swmr=True", the beginning of which you see also on the screenshot?

steinnymir commented 2 years ago

I cannot tell where it is open for write, but thats what the error sais. Might be in the LabDAQ, as I doubt you would load the data in a notebook using write permissions ("w" instead of "r").

The reason swmr=True makes it work, is that the writing procedure in hdf5 can be set to accept one writer and multiple simultaneous readers. The writing enabled this, and therefore, even though the file is kept open to wrtie by an other process, you can still read it from as many processes as you want.

kutnyakhov commented 2 years ago

Due to change in file naming this issue is no longer relevant.