Bugfix: do not open a measurement for writing on constructor of measurement
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Anne de Jong 2023-02-01 22:41:54 +01:00
parent e435dc9ecd
commit 5a7ae3eb33
2 changed files with 5 additions and 6 deletions

View File

@ -1,8 +1,8 @@
// lasp_clip.h // lasp_clip.h
// //
// Author: J.A. de Jong - ASCEE // Author: J.A. de Jong, C.R.D. Jansen - ASCEE
// //
// Description: Peak Programme Meter // Description: Clip handler
#pragma once #pragma once
#include <memory> #include <memory>
#include "lasp_filter.h" #include "lasp_filter.h"

View File

@ -196,7 +196,7 @@ class Measurement:
# Open the h5 file in read-plus mode, to allow for changing the # Open the h5 file in read-plus mode, to allow for changing the
# measurement comment. # measurement comment.
with h5.File(fn, 'r+') as f: with h5.File(fn, 'r') as f:
# Check for video data # Check for video data
try: try:
f['video'] f['video']
@ -234,10 +234,9 @@ class Measurement:
self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)] self._channelNames = [f'Unnamed {i}' for i in range(self.nchannels)]
# comment = read-write thing # comment = read-write thing
try: if 'comment' in f.keys():
self._comment = f.attrs['comment'] self._comment = f.attrs['comment']
except KeyError: else:
f.attrs['comment'] = ''
self._comment = '' self._comment = ''
# Sensitivity # Sensitivity