fusion-energy / dagmc_h5m_file_inspector

Extracts information from DAGMC h5m files including volumes number, material tags
MIT License
1 stars 1 forks source link

making use of h5py #22

Open shimwell opened 2 years ago

shimwell commented 2 years ago

material tags can be read

import h5py
dag = h5py.File("dagmc.h5m")
d=dag['/tstt/tags/NAME']
c=d.get('values')
c.shape
c[1]
c[0]
import numpy as np
np.array2string(c[0])
shimwell commented 2 years ago

s2=s.rstrip("\x00'") s3=s2.replace('\x','')

s4=s3.lstrip("b'") bytes.fromhex(s4)

shimwell commented 2 years ago

import h5py dagmc_file_contents = h5py.File('dagmc.h5m') groups=dagmc_file_contents['/tstt/sets/children'] print(len(groups)