Skip to content

Commit 5f57e63

Browse files
committed
Fixed issue with closing file at the end in non-mpi mode
1 parent 937da7b commit 5f57e63

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

hazel/multiprocess.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def nonmpi_work(self):
147147
if (self.model.working_mode == 'inversion'):
148148
for k, v in self.model.spectrum.items():
149149
v.close_observation()
150+
151+
self.model.close_output()
150152

151153

152154
def mpi_parent_work(self, start=0, end=None):

test/test_nonmpi_syn1d.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ def test_nonmpi_syn1d():
1515

1616
assert f['spec1']['stokes'].shape == (1,1,1,4,150), "incorrect dimensions in inversion"
1717

18-
f.close()
18+
f.close()
19+
20+
try:
21+
os.remove('output.h5')
22+
except:
23+
pass

test/test_single_inv.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ def test_single_inv():
1717

1818
assert f['spec1']['stokes'].shape == (1,1,2,4,150), "incorrect dimensions in inversion"
1919

20-
f.close()
20+
f.close()
21+
22+
try:
23+
os.remove('output.h5')
24+
except:
25+
pass

0 commit comments

Comments
 (0)