import tables import numpy r = MeasurementResult("test") def result(): try: h5 = tables.open_file("test.h5", "w") except: print("h5 already opened") accu = Accumulation(error=False) for num,ts in enumerate(results): x = numpy.linspace(0, 1, 10) y1 = [numpy.array([0, 4000, 8190, 8191, 8192, 0, -8191, -8192, -8193, 0], dtype="int16")] # Test with default (14-bit) adc1 = ADC_Result(x=x, y=y1, index=[(0,9)], sampl_freq=1000, desc={}, job_id=1, job_date=0) accu.is_clipped = True data["accu"] = accu data["data/ts %i"%num] = ts+0 ts.write_to_hdf(h5, "/", f"adc_{num}", f"adc_{num}") data["fft"] = (ts+0).fft() r[num] = ts.y[0][0] data["test"] = r accu+=ts accu.write_to_hdf(h5, "/", "name", "title") print(accu) try: h5.close() except: print("h5 already closed")