ensure closed file
This commit is contained in:
parent
36d2ae1c2a
commit
4a943ff844
|
@ -111,7 +111,7 @@ class ConfigMaterial(Config):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
fname : str
|
fname : str or pathlib.Path
|
||||||
Filename of the DREAM.3D (HDF5) file.
|
Filename of the DREAM.3D (HDF5) file.
|
||||||
grain_data : str
|
grain_data : str
|
||||||
Name of the group (folder) containing grain-wise data. Defaults
|
Name of the group (folder) containing grain-wise data. Defaults
|
||||||
|
@ -154,9 +154,9 @@ class ConfigMaterial(Config):
|
||||||
defined separately.
|
defined separately.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
b = util.DREAM3D_base_group(fname) if base_group is None else base_group
|
with h5py.File(fname, 'r') as f:
|
||||||
c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data
|
b = util.DREAM3D_base_group(f) if base_group is None else base_group
|
||||||
f = h5py.File(fname,'r')
|
c = util.DREAM3D_cell_data_group(f) if cell_data is None else cell_data
|
||||||
|
|
||||||
if grain_data is None:
|
if grain_data is None:
|
||||||
phase = f['/'.join([b,c,phases])][()].flatten()
|
phase = f['/'.join([b,c,phases])][()].flatten()
|
||||||
|
|
|
@ -365,7 +365,7 @@ class Grid:
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
fname : str or or pathlib.Path
|
fname : str or pathlib.Path
|
||||||
Filename of the DREAM.3D (HDF5) file.
|
Filename of the DREAM.3D (HDF5) file.
|
||||||
feature_IDs : str, optional
|
feature_IDs : str, optional
|
||||||
Name of the dataset containing the mapping between cells and
|
Name of the dataset containing the mapping between cells and
|
||||||
|
@ -401,9 +401,9 @@ class Grid:
|
||||||
orientation and phase are considered.
|
orientation and phase are considered.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
b = util.DREAM3D_base_group(fname) if base_group is None else base_group
|
with h5py.File(fname, 'r') as f:
|
||||||
c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data
|
b = util.DREAM3D_base_group(f) if base_group is None else base_group
|
||||||
f = h5py.File(fname, 'r')
|
c = util.DREAM3D_cell_data_group(f) if cell_data is None else cell_data
|
||||||
|
|
||||||
cells = f['/'.join([b,'_SIMPL_GEOMETRY','DIMENSIONS'])][()]
|
cells = f['/'.join([b,'_SIMPL_GEOMETRY','DIMENSIONS'])][()]
|
||||||
size = f['/'.join([b,'_SIMPL_GEOMETRY','SPACING'])] * cells
|
size = f['/'.join([b,'_SIMPL_GEOMETRY','SPACING'])] * cells
|
||||||
|
|
Loading…
Reference in New Issue