fixed more tests

This commit is contained in:
2023-04-03 15:50:11 +02:00
parent 70410fad72
commit 4716bcf0fc
2 changed files with 8 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ def scan_info(run_number, base_path=None, small_data=True):
sd_path_for_step=heuristic_extract_smalldata_path()+'run'+str(run_number).zfill(4)+'/acq'+str(i+1).zfill(4)+'.smalldata.h5'
scan.info['scan_files'][i].append(sd_path_for_step)
except KeyError:
logger.warn("Failed to load smalldata.")
logger.warning("Failed to load smalldata.")
return scan

View File

@@ -3,18 +3,15 @@ import os
import numpy as np
from cristallina.utils import ROI, print_run_info, heuristic_extract_pgroup, gauss, find_nearest, xray_transmission
__author__ = "Alexander Steppke"
def test_print(capsys):
# this currently works only if the heuristic p-group extraction works
# TODO: fix this shortcoming and use base_path throughout
os.chdir("/sf/cristallina/data/p19739/")
print_run_info(247)
print_run_info(185, base_path="tests/data/p20841/raw/")
captured = capsys.readouterr()
assert "15453208940" in captured.out
assert "LiTbF4_rocking" in captured.out
assert "17259343145" in captured.out
assert "scan_parameters" in captured.out
def test_ROI():
@@ -26,8 +23,9 @@ def test_ROI():
def test_extract_pgroup():
os.chdir("/sf/cristallina/data/p19739")
assert heuristic_extract_pgroup() == '19739'
os.chdir("tests/data/p20841/raw/")
assert heuristic_extract_pgroup() == '20841'
def test_gauss():
# Test a random Gauss value and check whether the value didn't change in time
@@ -39,7 +37,7 @@ def test_find_nearest():
assert find_nearest(a,10.1) == 10
def test_xray_transmission():
T = xray_transmission(9000,100e-6,material='Si')
T = xray_transmission(9000, 100e-6, material = 'Si')
assert T == 0.342385039732607