Feat/Data handler to save data #638
7 fail, 3 skipped, 375 pass in 22s
Annotations
Check warning on line 0 in tests.data_handler.test_data_handler
github-actions / Unit Test Results
test_data_handler_basic (tests.data_handler.test_data_handler) failed
pytest-junit-report/report.xml
Raw output
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_data_handler_basic0')
def test_data_handler_basic(tmp_path):
data_handler = DataHandler(root_data_folder=tmp_path)
data = {"a": 1, "b": 2, "c": 3}
now = datetime.now()
> data_handler.save_data("my_data", data, use_datetime=now)
tests/data_handler/test_data_handler.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qualang_tools/results/data_handler/data_handler.py:105: in save_data
return save_data(
qualang_tools/results/data_handler/data_handler.py:41: in save_data
processed_data = data_processor.process(processed_data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qualang_tools.results.data_handler.data_processors.XarraySaver object at 0x7ffa865b6e00>
data = {'a': 1, 'b': 2, 'c': 3}
def process(self, data):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
qualang_tools/results/data_handler/data_processors.py:146: ModuleNotFoundError
Check warning on line 0 in tests.data_handler.test_data_handler
github-actions / Unit Test Results
test_data_handler_metadata (tests.data_handler.test_data_handler) failed
pytest-junit-report/report.xml
Raw output
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_data_handler_metadata0')
def test_data_handler_metadata(tmp_path):
data_handler = DataHandler(root_data_folder=tmp_path)
data = {"a": 1, "b": 2, "c": 3}
metadata = {"meta": "data"}
now = datetime.now()
> data_handler.save_data("my_data", data, metadata=metadata, use_datetime=now)
tests/data_handler/test_data_handler.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qualang_tools/results/data_handler/data_handler.py:105: in save_data
return save_data(
qualang_tools/results/data_handler/data_handler.py:41: in save_data
processed_data = data_processor.process(processed_data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qualang_tools.results.data_handler.data_processors.XarraySaver object at 0x7ffa865842e0>
data = {'a': 1, 'b': 2, 'c': 3}
def process(self, data):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
qualang_tools/results/data_handler/data_processors.py:146: ModuleNotFoundError
Check warning on line 0 in tests.data_handler.test_data_handler
github-actions / Unit Test Results
test_data_handler_matplotlib_processor (tests.data_handler.test_data_handler) failed
pytest-junit-report/report.xml
Raw output
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_data_handler_matplotlib_p0')
def test_data_handler_matplotlib_processor(tmp_path):
data_handler = DataHandler(root_data_folder=tmp_path)
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
data = {"a": 1, "b": 2, "c": 3, "my_fig": fig}
now = datetime.now()
> data_handler.save_data("my_data", data, use_datetime=now)
tests/data_handler/test_data_handler.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qualang_tools/results/data_handler/data_handler.py:105: in save_data
return save_data(
qualang_tools/results/data_handler/data_handler.py:41: in save_data
processed_data = data_processor.process(processed_data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qualang_tools.results.data_handler.data_processors.XarraySaver object at 0x7ffa8655e170>
data = {'a': 1, 'b': 2, 'c': 3, 'my_fig': './my_fig.png'}
def process(self, data):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
qualang_tools/results/data_handler/data_processors.py:146: ModuleNotFoundError
Check warning on line 0 in tests.data_handler.test_data_handler
github-actions / Unit Test Results
test_custom (tests.data_handler.test_data_handler) failed
pytest-junit-report/report.xml
Raw output
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_custom0')
def test_custom(tmp_path):
from matplotlib import pyplot as plt
import numpy as np
data = {"T1": 5e-6, "T1_figure": plt.figure(), "IQ_array": np.array([[1, 2, 3], [4, 5, 6]])}
# Initialize the DataHandler
data_handler = DataHandler(root_data_folder=tmp_path)
# Save results
> data_folder = data_handler.save_data("T1_measurement", data=data)
tests/data_handler/test_data_handler.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qualang_tools/results/data_handler/data_handler.py:105: in save_data
return save_data(
qualang_tools/results/data_handler/data_handler.py:41: in save_data
processed_data = data_processor.process(processed_data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qualang_tools.results.data_handler.data_processors.XarraySaver object at 0x7ffa86593460>
data = {'IQ_array': './arrays.npz#IQ_array', 'T1': 5e-06, 'T1_figure': './T1_figure.png'}
def process(self, data):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
qualang_tools/results/data_handler/data_processors.py:146: ModuleNotFoundError
Check warning on line 0 in tests.data_handler.test_numpy_array_saver
github-actions / Unit Test Results
test_numpy_array_saver_process_merged_below_min_size (tests.data_handler.test_numpy_array_saver) failed
pytest-junit-report/report.xml
Raw output
def test_numpy_array_saver_process_merged_below_min_size():
data = {"a": np.array([1, 2, 3]), "b": np.array([4, 5, 6]), "c": 3}
data_processor = NumpyArraySaver()
processed_data = data.copy()
processed_data = data_processor.process(processed_data)
> assert processed_data == data
E AssertionError: assert {'a': './arra...pz#b', 'c': 3} == {'a': array([..., 6]), 'c': 3}
E Omitting 1 identical items, use -vv to show
E Differing items:
E {'a': './arrays.npz#a'} != {'a': array([1, 2, 3])}
E {'b': './arrays.npz#b'} != {'b': array([4, 5, 6])}
E Use -v to get the full diff
tests/data_handler/test_numpy_array_saver.py:12: AssertionError
Check warning on line 0 in tests.data_handler.test_xarray_saver
github-actions / Unit Test Results
test_xarray_saver_no_xarrays (tests.data_handler.test_xarray_saver) failed
pytest-junit-report/report.xml
Raw output
def test_xarray_saver_no_xarrays():
xarray_saver = XarraySaver()
data = {"a": 1, "b": 2, "c": 3}
> assert xarray_saver.process(data) == data
tests/data_handler/test_xarray_saver.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qualang_tools.results.data_handler.data_processors.XarraySaver object at 0x7ffa6e3371c0>
data = {'a': 1, 'b': 2, 'c': 3}
def process(self, data):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
qualang_tools/results/data_handler/data_processors.py:146: ModuleNotFoundError
Check warning on line 0 in tests.data_handler.test_xarray_saver
github-actions / Unit Test Results
test_xarray_saver_no_merge_netcdf (tests.data_handler.test_xarray_saver) failed
pytest-junit-report/report.xml
Raw output
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_xarray_saver_no_merge_net0')
def test_xarray_saver_no_merge_netcdf(tmp_path):
> import xarray as xr
E ModuleNotFoundError: No module named 'xarray'
tests/data_handler/test_xarray_saver.py:77: ModuleNotFoundError