Tidied up file opening method.

这个提交包含在:
Craig Warren
2022-01-20 09:00:48 +00:00
父节点 b77ba84c5b
当前提交 5d49f5311f

查看文件

@@ -410,7 +410,7 @@ class GeometryObjects:
"""
# Write the geometry objects to a HDF5 file
fdata = h5py.File(self.filename_hdf5, 'w')
with h5py.File(self.filename_hdf5, 'w') as fdata:
fdata.attrs['gprMax'] = __version__
fdata.attrs['Title'] = G.title
fdata.attrs['dx_dy_dz'] = (G.dx, G.dy, G.dz)
@@ -434,7 +434,7 @@ class GeometryObjects:
# Write materials list to a text file
# This includes all materials in range whether used in volume or not
fmaterials = open(self.filename_materials, 'w')
with open(self.filename_materials, 'w') as fmaterials:
for numID in range(minmat, maxmat + 1):
for material in G.materials:
if material.numID == numID: