Code Monkey home page Code Monkey logo

Comments (16)

mccoys avatar mccoys commented on June 26, 2024 1

Thank you for suggesting this. I actually had the same comment a few days ago from a colleague.

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024 1

ok, sent again, hopefully right person this time :)

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

Admittedly the 'flush_every' function helps reduce the chance of the HDF5 file being corrupted during a write while it's running, so part of what I said is not quite right, but the problem still exists that some bits of data at the end of the HDF5 files is miswritten sometimes during a crash.

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

Sorry, bad code in previous thing, this recreates the probes hdf5 file (at least I think it does) and seems to work all of the time as far as I have tested:

`

import h5py
f_dest = h5py.File("Probes0_fixed.h5", "w")
f_src = h5py.File("Probes0.h5", "r")
for key in f_src:
    try:
        f_dest.create_dataset_like(str(key), f_src[key])
        f_dest[key][()] = f_src[key][()]
        for attrib in f_src[key].attrs.keys():
            f_dest[key].attrs.create(attrib, f_src[key].attrs[attrib])

    except KeyError:
        print("faulty key = " + str(key))

for attrib in f_src.attrs.keys():
    f_dest.attrs.create(attrib, f_src.attrs[attrib])

`

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

Just to note when I use the above script it doesn't always work. The individual attributes must also be tested before the key is written to the new H5 file as sometimes a key can be correctly created but not filled with attributes correctly.

from smilei.

mccoys avatar mccoys commented on June 26, 2024

Do you have an idea of to reproduce this? I cannot get a corrupted file

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

from smilei.

mccoys avatar mccoys commented on June 26, 2024

It does not happen on my system for some reason. Would you be able to produce a small example and send it with dropbox or equivalent?

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

It does not happen on my system for some reason. Would you be able to produce a small example and send it with dropbox or equivalent?

I've sent you a link in element chat

from smilei.

mccoys avatar mccoys commented on June 26, 2024

I have not received it. My name on element is fredpz

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

from smilei.

mccoys avatar mccoys commented on June 26, 2024

I made a change for happi in the develop branch. Could you test it?

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

Yes, that seems to allow me to access files which I couldn't before, thanks! That's eliminated a step which was quite annoying and will save me some time too, really appreciated!

from smilei.

DoubleAgentDave avatar DoubleAgentDave commented on June 26, 2024

Just to be clear, with the old version I tried to access a broken probes0.h5 file and got this error:

Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/media/david_blackman/left_external/broadband/simulation_results/bandwidth/redone_diags/fixed_ions/narrow/../../../../py1D/make_signal_files.py", line 193, in start
signal = Ez_probe.getData()
File "/home/david_blackman/codes/smilei_new/Smilei/happi/_Diagnostics/Diagnostic.py", line 163, ingetData
data.append( self._dataAtTime(t) )
File "/home/david_blackman/codes/smilei_new/Smilei/happi/_Diagnostics/Diagnostic.py", line 862, in_dataLinAtTime
A = self._getDataAtTime(t)
File "/home/david_blackman/codes/smilei_new/Smilei/happi/_Diagnostics/Probe.py", line 372, in _getDataAtTime
data = self._dataForTime[t][n,first:last]
TypeError: 'NoneType' object is not subscriptable

Now I get no error and successfully build up my probe signals so I can process them properly.!

from smilei.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.