basics and tests done.

This commit is contained in:
2022-07-12 17:15:28 +02:00
parent 2b077152f4
commit b5a54de804
6 changed files with 433 additions and 3 deletions

28
tests/test_regression.py Normal file
View File

@@ -0,0 +1,28 @@
"""
Regression tests for functionality that we assume to be working for our analysis.
"""
import pytest
from sfdata import SFDataFiles, sfdatafile, SFScanInfo
import tracemalloc
@pytest.mark.regression
def test_JU_memory():
base_path = "/sf/cristallina/data/p19739/raw/"
run_number = 49
averages = []
tracemalloc.start()
current, peak = tracemalloc.get_traced_memory()
print(f"Current memory usage is {current / 10**6:.1f}MB; Peak was {peak / 10**6:.1f}MB")
with SFDataFiles(f"{base_path}/run{run_number:04}/data/acq00*.h5") as data:
ch = data["JF16T03V01"]
current, peak = tracemalloc.get_traced_memory()
print(f"Current memory usage is {current / 10**6:.1f}MB; Peak was {peak / 10**6:.1f}MB")
tracemalloc.stop()
assert current/10**6 < 100, "Memory consumption should be below 100 MB"