uob-positron-imaging-centre / up4

Post-processor for particle data.
https://uob-positron-imaging-centre.github.io/up4/
GNU General Public License v3.0
9 stars 1 forks source link

Vtk - Converter #9

Closed dwerner95 closed 2 years ago

dwerner95 commented 2 years ago

Hello Everyone! I implemented a converter for VTK (LIGGGHTS) files. ( With a nice fancy progress bar using indicatif ) Please check the converter with on one of your LIGGGHTS simulations using this code:

import uPPPP 
from glob import glob
from natsort import natsorted
sim_files = natsorted([x for x in glob("Your/sim/folder/post/particles_*.vtk") if not "bound" in x])
uPPPP.Converter.vtk(sim_files, 1e-5,"output.hdf5")
data=uPPPP.Data.from_tdata("output.hdf5")
print("Mean absolute velocity of your system is: ",data.mean_velocity())

If this gives you a sensible mean velocity everything should be good and you can merge.

Grüße, Dominik

DanW97 commented 2 years ago

HSM_Glass_2l_250.hdf5 lacks a dimension attribute. According to h5py when read in and using .attrs.keys(), the fields are: 'particle number', 'sample rate', 'time', 'timesteps', 'type', 'velocity', 'velocity magnitude', 'version'.

DanW97 commented 2 years ago

If this gives you a sensible mean velocity everything should be good

@dwerner95 I got 0.166m/s (I assume the units are SI). However I don't think we should close this PR yet due to the issues I've mentioned above, unless I've built it wrongly. On closer inspection, the Data and Converter classes, according to lib.rs, do not interact with each other, which causes unintended issues in test_vtkio()

dwerner95 commented 2 years ago

i changed the test script. I am not entirely sure why the HSM_Glass_2l_250.hdf5 file lost the "dimension" dataset... but there is nothing i can do about it so far. next week i will implement the reader for csv/pept data and we can implement the tester completely. Feel free to merge @DanW97