From df78f1f1e8fc390a039dd76ab892919a15da640c Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 18 Jun 2024 23:05:26 -0400 Subject: added simple test for trace loading --- tests/test_trace.py | 11 +++++++++++ tests/trace_test_data/xtrace1.dat | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/test_trace.py create mode 100644 tests/trace_test_data/xtrace1.dat diff --git a/tests/test_trace.py b/tests/test_trace.py new file mode 100644 index 0000000..06f43c5 --- /dev/null +++ b/tests/test_trace.py @@ -0,0 +1,11 @@ +from qolab.data.trace import loadTrace +import numpy as np + +def test_load_uncompressed_v0dot1_trace(): + tr = loadTrace('tests/trace_test_data/xtrace1.dat') + cfg = tr.getConfig() + assert cfg['config']['version'] == '0.1' + assert cfg['config']['model'] == 'Trace' + data = tr.getData() + assert np.all( (data - np.array([[1], [3], [2], [5]])) == 0 ) + diff --git a/tests/trace_test_data/xtrace1.dat b/tests/trace_test_data/xtrace1.dat new file mode 100644 index 0000000..0ea1925 --- /dev/null +++ b/tests/trace_test_data/xtrace1.dat @@ -0,0 +1,15 @@ +% config: +% label: x trace +% model: Trace +% version: '0.1' +% type: null +% item_format: .15e +% tags: +% tag1: xxxx +% tag2: xxxx +% unit: s +% +1.000000000000000e+00 +3.000000000000000e+00 +2.000000000000000e+00 +5.000000000000000e+00 -- cgit v1.2.3