Source code for ewoksid16b.tests.test_read

import numpy as np

from ..tasks import xeoltasks
from ..tasks.utils import read
from .data import resource_path


[docs] def test_read_task(): with resource_path("for_test.h5") as path: inputs = dict( stack_path=str(path), scan_number=30, threshold=0, calibration_x=[0, 1], calibration_y=[0, 1], norm_counter="It", counter="qepro_det0", ) task = xeoltasks.ReadStack(inputs=inputs) task.execute() assert task.outputs.y[0][0][0] == 83.15 assert task.outputs.stack[0][0][0] == 1663 assert all(task.outputs.x[:3] == [0, 1, 2])
[docs] def test_normalizer_name(): with resource_path("for_test.h5") as path: dummy_stack = np.array([[[1]] * 54] * 50) result = read.read_y_normalization_counter( str(path), dummy_stack, "It", 30, [50, 54] ) assert result.all()
[docs] def test_amesh_scan_dimensions(): with resource_path("test_xeolonline_march26_ewoksid16b.h5") as path: inputs = dict( stack_path=str(path), scan_number=3, threshold=0, calibration_x=[0, 1], calibration_y=[0, 1], norm_counter="It", counter="qepro_det0", ) task = xeoltasks.ReadStack(inputs=inputs) task.execute() assert task.outputs.stack.shape == (6, 6, 1044) assert task.outputs.stack[0][0][0] == 1664